mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 22:54:59 +00:00
Made more use of nil_or_empty?, fixed incorrect default species body shape, fixed Illusion, fixed potential foreign Pokémon with blank names
This commit is contained in:
@@ -344,7 +344,7 @@ class PokeBattle_Battler
|
||||
def hasActiveAbility?(check_ability, ignore_fainted = false)
|
||||
return false if !abilityActive?(ignore_fainted)
|
||||
return check_ability.include?(@ability_id) if check_ability.is_a?(Array)
|
||||
return check_ability == self.ability
|
||||
return self.ability == check_ability
|
||||
end
|
||||
alias hasWorkingAbility hasActiveAbility?
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class PokeBattle_Battler
|
||||
@battle.pbHideAbilitySplash(target)
|
||||
pbItemHPHealCheck
|
||||
else
|
||||
msg = _INTL("{1} had its energy drained!",target.pbThis) if !msg || msg==""
|
||||
msg = _INTL("{1} had its energy drained!",target.pbThis) if nil_or_empty?(msg)
|
||||
@battle.pbDisplay(msg)
|
||||
if canHeal?
|
||||
amt = (amt*1.3).floor if hasActiveItem?(:BIGROOT)
|
||||
|
||||
@@ -484,7 +484,7 @@ class PokeBattle_Battler
|
||||
def pbConfuse(msg=nil)
|
||||
@effects[PBEffects::Confusion] = pbConfusionDuration
|
||||
@battle.pbCommonAnimation("Confusion",self)
|
||||
msg = _INTL("{1} became confused!",pbThis) if !msg || msg==""
|
||||
msg = _INTL("{1} became confused!",pbThis) if nil_or_empty?(msg)
|
||||
@battle.pbDisplay(msg)
|
||||
PBDebug.log("[Lingering effect] #{pbThis}'s confusion count is #{@effects[PBEffects::Confusion]}")
|
||||
# Confusion cures
|
||||
@@ -551,7 +551,7 @@ class PokeBattle_Battler
|
||||
def pbAttract(user,msg=nil)
|
||||
@effects[PBEffects::Attract] = user.index
|
||||
@battle.pbCommonAnimation("Attract",self)
|
||||
msg = _INTL("{1} fell in love!",pbThis) if !msg || msg==""
|
||||
msg = _INTL("{1} fell in love!",pbThis) if nil_or_empty?(msg)
|
||||
@battle.pbDisplay(msg)
|
||||
# Destiny Knot
|
||||
if hasActiveItem?(:DESTINYKNOT) && user.pbCanAttract?(self,false)
|
||||
|
||||
@@ -401,7 +401,7 @@ class PokeBattle_Battle
|
||||
party.each_with_index do |pkmn,i|
|
||||
next if i<idxPartyStart || i>=idxPartyEnd # Check the team only
|
||||
next if !pkmn || !pkmn.able? # Can't copy a non-fainted Pokémon or egg
|
||||
ret = i if partyOrders[i]>partyOrders[ret]
|
||||
ret = i if ret < 0 || partyOrders[i] > partyOrders[ret]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -170,7 +170,7 @@ class PokeBattle_Battle
|
||||
enemyParty = pbParty(idxBattler)
|
||||
if enemyParty[idxPartyNew].ability == :ILLUSION
|
||||
new_index = pbLastInTeam(idxBattler)
|
||||
idxPartyForName = new_index if new_index >= 0
|
||||
idxPartyForName = new_index if new_index >= 0 && new_index != idxPartyNew
|
||||
end
|
||||
if pbDisplayConfirm(_INTL("{1} is about to send in {2}. Will you switch your Pokémon?",
|
||||
opponent.full_name, enemyParty[idxPartyForName].name))
|
||||
@@ -257,7 +257,7 @@ class PokeBattle_Battle
|
||||
newPkmnName = party[idxParty].name
|
||||
if party[idxParty].ability == :ILLUSION
|
||||
new_index = pbLastInTeam(idxBattler)
|
||||
newPkmnName = party[new_index].name if new_index >= 0
|
||||
newPkmnName = party[new_index].name if new_index >= 0 && new_index != idxParty
|
||||
end
|
||||
if pbOwnedByPlayer?(idxBattler)
|
||||
opposing = @battlers[idxBattler].pbDirectOpposing
|
||||
|
||||
@@ -147,9 +147,7 @@ class PokeBattle_Battle
|
||||
@scene.pbRefreshOne(idxBattler)
|
||||
pbCommonAnimation("MegaEvolution2",battler)
|
||||
megaName = battler.pokemon.megaName
|
||||
if !megaName || megaName==""
|
||||
megaName = _INTL("Mega {1}", battler.pokemon.speciesName)
|
||||
end
|
||||
megaName = _INTL("Mega {1}", battler.pokemon.speciesName) nil_or_empty?(megaName)
|
||||
pbDisplay(_INTL("{1} has Mega Evolved into {2}!",battler.pbThis,megaName))
|
||||
side = battler.idxOwnSide
|
||||
owner = pbGetOwnerIndexFromBattlerIndex(idxBattler)
|
||||
|
||||
@@ -538,7 +538,7 @@ class TargetMenuDisplay < BattleMenuBase
|
||||
@overlay.bitmap.clear
|
||||
textpos = []
|
||||
@buttons.each_with_index do |button,i|
|
||||
next if !button || @texts[i].nil? || @texts[i]==""
|
||||
next if !button || nil_or_empty?(@texts[i])
|
||||
x = button.x-self.x+button.src_rect.width/2
|
||||
y = button.y-self.y+2
|
||||
textpos.push([@texts[i],x,y,2,TEXT_BASE_COLOR,TEXT_SHADOW_COLOR])
|
||||
|
||||
@@ -480,7 +480,7 @@ class PokeBattle_Scene
|
||||
|
||||
# Plays a common animation.
|
||||
def pbCommonAnimation(animName,user=nil,target=nil)
|
||||
return if !animName || animName==""
|
||||
return if nil_or_empty?(animName)
|
||||
target = target[0] if target && target.is_a?(Array)
|
||||
animations = pbLoadBattleAnimations
|
||||
return if !animations
|
||||
|
||||
Reference in New Issue
Block a user