mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-12 07:35:00 +00:00
Added decent spacing to all scripts thanks to Rubocop
This commit is contained in:
@@ -12,7 +12,7 @@ class Battle::Battler
|
||||
if Battle::AbilityEffects.triggerStatusCheckNonIgnorable(self.ability, self, checkStatus)
|
||||
return true
|
||||
end
|
||||
return @status==checkStatus
|
||||
return @status == checkStatus
|
||||
end
|
||||
|
||||
def pbHasAnyStatus?
|
||||
@@ -22,11 +22,11 @@ class Battle::Battler
|
||||
return @status != :NONE
|
||||
end
|
||||
|
||||
def pbCanInflictStatus?(newStatus,user,showMessages,move = nil,ignoreStatus = false)
|
||||
def pbCanInflictStatus?(newStatus, user, showMessages, move = nil, ignoreStatus = false)
|
||||
return false if fainted?
|
||||
selfInflicted = (user && user.index==@index)
|
||||
selfInflicted = (user && user.index == @index)
|
||||
# Already have that status problem
|
||||
if self.status==newStatus && !ignoreStatus
|
||||
if self.status == newStatus && !ignoreStatus
|
||||
if showMessages
|
||||
msg = ""
|
||||
case self.status
|
||||
@@ -42,18 +42,18 @@ class Battle::Battler
|
||||
end
|
||||
# Trying to replace a status problem with another one
|
||||
if self.status != :NONE && !ignoreStatus && !selfInflicted
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) if showMessages
|
||||
return false
|
||||
end
|
||||
# Trying to inflict a status problem on a Pokémon behind a substitute
|
||||
if @effects[PBEffects::Substitute]>0 && !(move && move.ignoresSubstitute?(user)) &&
|
||||
if @effects[PBEffects::Substitute] > 0 && !(move && move.ignoresSubstitute?(user)) &&
|
||||
!selfInflicted
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) if showMessages
|
||||
return false
|
||||
end
|
||||
# Weather immunity
|
||||
if newStatus == :FROZEN && [:Sun, :HarshSun].include?(effectiveWeather)
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) if showMessages
|
||||
return false
|
||||
end
|
||||
# Terrains immunity
|
||||
@@ -66,15 +66,15 @@ class Battle::Battler
|
||||
return false
|
||||
end
|
||||
when :Misty
|
||||
@battle.pbDisplay(_INTL("{1} surrounds itself with misty terrain!",pbThis(true))) if showMessages
|
||||
@battle.pbDisplay(_INTL("{1} surrounds itself with misty terrain!", pbThis(true))) if showMessages
|
||||
return false
|
||||
end
|
||||
end
|
||||
# Uproar immunity
|
||||
if newStatus == :SLEEP && !(hasActiveAbility?(:SOUNDPROOF) && !@battle.moldBreaker)
|
||||
@battle.allBattlers.each do |b|
|
||||
next if b.effects[PBEffects::Uproar]==0
|
||||
@battle.pbDisplay(_INTL("But the uproar kept {1} awake!",pbThis(true))) if showMessages
|
||||
next if b.effects[PBEffects::Uproar] == 0
|
||||
@battle.pbDisplay(_INTL("But the uproar kept {1} awake!", pbThis(true))) if showMessages
|
||||
return false
|
||||
end
|
||||
end
|
||||
@@ -96,7 +96,7 @@ class Battle::Battler
|
||||
hasImmuneType |= pbHasType?(:ICE)
|
||||
end
|
||||
if hasImmuneType
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) if showMessages
|
||||
return false
|
||||
end
|
||||
# Ability immunity
|
||||
@@ -133,19 +133,19 @@ class Battle::Battler
|
||||
case newStatus
|
||||
when :SLEEP
|
||||
msg = _INTL("{1} stays awake because of {2}'s {3}!",
|
||||
pbThis,immAlly.pbThis(true),immAlly.abilityName)
|
||||
pbThis, immAlly.pbThis(true), immAlly.abilityName)
|
||||
when :POISON
|
||||
msg = _INTL("{1} cannot be poisoned because of {2}'s {3}!",
|
||||
pbThis,immAlly.pbThis(true),immAlly.abilityName)
|
||||
pbThis, immAlly.pbThis(true), immAlly.abilityName)
|
||||
when :BURN
|
||||
msg = _INTL("{1} cannot be burned because of {2}'s {3}!",
|
||||
pbThis,immAlly.pbThis(true),immAlly.abilityName)
|
||||
pbThis, immAlly.pbThis(true), immAlly.abilityName)
|
||||
when :PARALYSIS
|
||||
msg = _INTL("{1} cannot be paralyzed because of {2}'s {3}!",
|
||||
pbThis,immAlly.pbThis(true),immAlly.abilityName)
|
||||
pbThis, immAlly.pbThis(true), immAlly.abilityName)
|
||||
when :FROZEN
|
||||
msg = _INTL("{1} cannot be frozen solid because of {2}'s {3}!",
|
||||
pbThis,immAlly.pbThis(true),immAlly.abilityName)
|
||||
pbThis, immAlly.pbThis(true), immAlly.abilityName)
|
||||
end
|
||||
else
|
||||
case newStatus
|
||||
@@ -162,15 +162,15 @@ class Battle::Battler
|
||||
return false
|
||||
end
|
||||
# Safeguard immunity
|
||||
if pbOwnSide.effects[PBEffects::Safeguard]>0 && !selfInflicted && move &&
|
||||
if pbOwnSide.effects[PBEffects::Safeguard] > 0 && !selfInflicted && move &&
|
||||
!(user && user.hasActiveAbility?(:INFILTRATOR))
|
||||
@battle.pbDisplay(_INTL("{1}'s team is protected by Safeguard!",pbThis)) if showMessages
|
||||
@battle.pbDisplay(_INTL("{1}'s team is protected by Safeguard!", pbThis)) if showMessages
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def pbCanSynchronizeStatus?(newStatus,target)
|
||||
def pbCanSynchronizeStatus?(newStatus, target)
|
||||
return false if fainted?
|
||||
# Trying to replace a status problem with another one
|
||||
return false if self.status != :NONE
|
||||
@@ -204,7 +204,7 @@ class Battle::Battler
|
||||
return false
|
||||
end
|
||||
# Safeguard immunity
|
||||
if pbOwnSide.effects[PBEffects::Safeguard]>0 &&
|
||||
if pbOwnSide.effects[PBEffects::Safeguard] > 0 &&
|
||||
!(user && user.hasActiveAbility?(:INFILTRATOR))
|
||||
return false
|
||||
end
|
||||
@@ -214,7 +214,7 @@ class Battle::Battler
|
||||
#=============================================================================
|
||||
# Generalised infliction of status problem
|
||||
#=============================================================================
|
||||
def pbInflictStatus(newStatus,newStatusCount = 0,msg = nil,user = nil)
|
||||
def pbInflictStatus(newStatus, newStatusCount = 0, msg = nil, user = nil)
|
||||
# Inflict the new status
|
||||
self.status = newStatus
|
||||
self.statusCount = newStatusCount
|
||||
@@ -234,7 +234,7 @@ class Battle::Battler
|
||||
when :SLEEP
|
||||
@battle.pbDisplay(_INTL("{1} fell asleep!", pbThis))
|
||||
when :POISON
|
||||
if newStatusCount>0
|
||||
if newStatusCount > 0
|
||||
@battle.pbDisplay(_INTL("{1} was badly poisoned!", pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1} was poisoned!", pbThis))
|
||||
@@ -304,7 +304,7 @@ class Battle::Battler
|
||||
# NOTE: Bulbapedia claims that Safeguard shouldn't prevent sleep due to
|
||||
# drowsiness. I disagree with this too. Compare with the other sided
|
||||
# effects Misty/Electric Terrain, which do prevent it.
|
||||
return false if pbOwnSide.effects[PBEffects::Safeguard]>0
|
||||
return false if pbOwnSide.effects[PBEffects::Safeguard] > 0
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -438,20 +438,20 @@ class Battle::Battler
|
||||
#=============================================================================
|
||||
# Confusion
|
||||
#=============================================================================
|
||||
def pbCanConfuse?(user = nil,showMessages = true,move = nil,selfInflicted = false)
|
||||
def pbCanConfuse?(user = nil, showMessages = true, move = nil, selfInflicted = false)
|
||||
return false if fainted?
|
||||
if @effects[PBEffects::Confusion]>0
|
||||
@battle.pbDisplay(_INTL("{1} is already confused.",pbThis)) if showMessages
|
||||
if @effects[PBEffects::Confusion] > 0
|
||||
@battle.pbDisplay(_INTL("{1} is already confused.", pbThis)) if showMessages
|
||||
return false
|
||||
end
|
||||
if @effects[PBEffects::Substitute]>0 && !(move && move.ignoresSubstitute?(user)) &&
|
||||
if @effects[PBEffects::Substitute] > 0 && !(move && move.ignoresSubstitute?(user)) &&
|
||||
!selfInflicted
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if showMessages
|
||||
return false
|
||||
end
|
||||
# Terrains immunity
|
||||
if affectedByTerrain? && @battle.field.terrain == :Misty && Settings::MECHANICS_GENERATION >= 7
|
||||
@battle.pbDisplay(_INTL("{1} surrounds itself with misty terrain!",pbThis(true))) if showMessages
|
||||
@battle.pbDisplay(_INTL("{1} surrounds itself with misty terrain!", pbThis(true))) if showMessages
|
||||
return false
|
||||
end
|
||||
if selfInflicted || !@battle.moldBreaker
|
||||
@@ -459,31 +459,31 @@ class Battle::Battler
|
||||
if showMessages
|
||||
@battle.pbShowAbilitySplash(self)
|
||||
if Battle::Scene::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} doesn't become confused!",pbThis))
|
||||
@battle.pbDisplay(_INTL("{1} doesn't become confused!", pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevents confusion!",pbThis,abilityName))
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevents confusion!", pbThis, abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(self)
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
if pbOwnSide.effects[PBEffects::Safeguard]>0 && !selfInflicted &&
|
||||
if pbOwnSide.effects[PBEffects::Safeguard] > 0 && !selfInflicted &&
|
||||
!(user && user.hasActiveAbility?(:INFILTRATOR))
|
||||
@battle.pbDisplay(_INTL("{1}'s team is protected by Safeguard!",pbThis)) if showMessages
|
||||
@battle.pbDisplay(_INTL("{1}'s team is protected by Safeguard!", pbThis)) if showMessages
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def pbCanConfuseSelf?(showMessages)
|
||||
return pbCanConfuse?(nil,showMessages,nil,true)
|
||||
return pbCanConfuse?(nil, showMessages, nil, true)
|
||||
end
|
||||
|
||||
def pbConfuse(msg = nil)
|
||||
@effects[PBEffects::Confusion] = pbConfusionDuration
|
||||
@battle.pbCommonAnimation("Confusion",self)
|
||||
msg = _INTL("{1} became confused!",pbThis) if nil_or_empty?(msg)
|
||||
@battle.pbCommonAnimation("Confusion", self)
|
||||
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
|
||||
@@ -492,7 +492,7 @@ class Battle::Battler
|
||||
end
|
||||
|
||||
def pbConfusionDuration(duration = -1)
|
||||
duration = 2+@battle.pbRandom(4) if duration<=0
|
||||
duration = 2 + @battle.pbRandom(4) if duration <= 0
|
||||
return duration
|
||||
end
|
||||
|
||||
@@ -503,27 +503,27 @@ class Battle::Battler
|
||||
#=============================================================================
|
||||
# Attraction
|
||||
#=============================================================================
|
||||
def pbCanAttract?(user,showMessages = true)
|
||||
def pbCanAttract?(user, showMessages = true)
|
||||
return false if fainted?
|
||||
return false if !user || user.fainted?
|
||||
if @effects[PBEffects::Attract]>=0
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!",pbThis)) if showMessages
|
||||
if @effects[PBEffects::Attract] >= 0
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", pbThis)) if showMessages
|
||||
return false
|
||||
end
|
||||
agender = user.gender
|
||||
ogender = gender
|
||||
if agender==2 || ogender==2 || agender==ogender
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!",pbThis)) if showMessages
|
||||
if agender == 2 || ogender == 2 || agender == ogender
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", pbThis)) if showMessages
|
||||
return false
|
||||
end
|
||||
if !@battle.moldBreaker
|
||||
if hasActiveAbility?([:AROMAVEIL,:OBLIVIOUS])
|
||||
if hasActiveAbility?([:AROMAVEIL, :OBLIVIOUS])
|
||||
if showMessages
|
||||
@battle.pbShowAbilitySplash(self)
|
||||
if Battle::Scene::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!",pbThis))
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevents romance!",pbThis,abilityName))
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevents romance!", pbThis, abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(self)
|
||||
end
|
||||
@@ -534,9 +534,9 @@ class Battle::Battler
|
||||
if showMessages
|
||||
@battle.pbShowAbilitySplash(self)
|
||||
if Battle::Scene::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!",pbThis))
|
||||
@battle.pbDisplay(_INTL("{1} is unaffected!", pbThis))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevents romance!",b.pbThis,b.abilityName))
|
||||
@battle.pbDisplay(_INTL("{1}'s {2} prevents romance!", b.pbThis, b.abilityName))
|
||||
end
|
||||
@battle.pbHideAbilitySplash(self)
|
||||
end
|
||||
@@ -547,14 +547,14 @@ class Battle::Battler
|
||||
return true
|
||||
end
|
||||
|
||||
def pbAttract(user,msg = nil)
|
||||
def pbAttract(user, msg = nil)
|
||||
@effects[PBEffects::Attract] = user.index
|
||||
@battle.pbCommonAnimation("Attract",self)
|
||||
msg = _INTL("{1} fell in love!",pbThis) if nil_or_empty?(msg)
|
||||
@battle.pbCommonAnimation("Attract", self)
|
||||
msg = _INTL("{1} fell in love!", pbThis) if nil_or_empty?(msg)
|
||||
@battle.pbDisplay(msg)
|
||||
# Destiny Knot
|
||||
if hasActiveItem?(:DESTINYKNOT) && user.pbCanAttract?(self,false)
|
||||
user.pbAttract(self,_INTL("{1} fell in love from the {2}!",user.pbThis(true),itemName))
|
||||
if hasActiveItem?(:DESTINYKNOT) && user.pbCanAttract?(self, false)
|
||||
user.pbAttract(self, _INTL("{1} fell in love from the {2}!", user.pbThis(true), itemName))
|
||||
end
|
||||
# Attraction cures
|
||||
pbItemStatusCureCheck
|
||||
|
||||
Reference in New Issue
Block a user