Merge branch 'master' into refactor

This commit is contained in:
Maruno17
2020-10-18 21:40:04 +01:00
49 changed files with 2885 additions and 2861 deletions

View File

@@ -171,7 +171,7 @@ class PokeBattle_Battler
return true
end
def pbCanSynchronizeStatus?(status,target)
def pbCanSynchronizeStatus?(newStatus,target)
return false if fainted?
# Trying to replace a status problem with another one
return false if self.status!=PBStatuses::NONE
@@ -179,7 +179,7 @@ class PokeBattle_Battler
return false if @battle.field.terrain==PBBattleTerrains::Misty && affectedByTerrain?
# Type immunities
hasImmuneType = false
case self.status
case newStatus
when PBStatuses::POISON
# NOTE: target will have Synchronize, so it can't have Corrosion.
if !(target && target.hasActiveAbility?(:CORROSION))
@@ -193,15 +193,15 @@ class PokeBattle_Battler
end
return false if hasImmuneType
# Ability immunity
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(@ability,self,status)
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(@ability,self,newStatus)
return false
end
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(@ability,self,status)
if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(@ability,self,newStatus)
return false
end
eachAlly do |b|
next if !b.abilityActive?
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,status)
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,newStatus)
return false
end
# Safeguard immunity

View File

@@ -752,7 +752,7 @@ class PokeBattle_Move_09F < PokeBattle_Move
elsif isConst?(@id,PBMoves,:MULTIATTACK)
@itemTypes = {
:FIGHTINGMEMORY => :FIGHTING,
:SLYINGMEMORY => :FLYING,
:FLYINGMEMORY => :FLYING,
:POISONMEMORY => :POISON,
:GROUNDMEMORY => :GROUND,
:ROCKMEMORY => :ROCK,
@@ -1132,7 +1132,7 @@ class PokeBattle_Move_0AE < PokeBattle_Move
return false
end
def pbEffectGeneral(user)
def pbEffectAgainstTarget(user,target)
user.pbUseMoveSimple(target.lastRegularMoveUsed,target.index)
end
@@ -2403,18 +2403,19 @@ end
#===============================================================================
class PokeBattle_Move_0D3 < PokeBattle_Move
def pbBaseDamage(baseDmg,user,target)
shift = (4-user.effects[PBEffects::Rollout]) # 0-4, where 0 is most powerful
shift = (5 - user.effects[PBEffects::Rollout]) # 0-4, where 0 is most powerful
shift = 0 if user.effects[PBEffects::Rollout] == 0 # For first turn
shift += 1 if user.effects[PBEffects::DefenseCurl]
baseDmg = baseDmg << shift
baseDmg *= 2**shift
return baseDmg
end
def pbEffectAfterAllHits(user,target)
if !target.damageState.unaffected && user.effects[PBEffects::Rollout]==0
if !target.damageState.unaffected && user.effects[PBEffects::Rollout] == 0
user.effects[PBEffects::Rollout] = 5
user.currentMove = @id
end
user.effects[PBEffects::Rollout] -= 1 if user.effects[PBEffects::Rollout]>0
user.effects[PBEffects::Rollout] -= 1 if user.effects[PBEffects::Rollout] > 0
end
end

View File

@@ -169,7 +169,7 @@ class PokeBattle_Battle
idxPartyForName = idxPartyNew
enemyParty = pbParty(idxBattler)
if isConst?(enemyParty[idxPartyNew].ability,PBAbilities,:ILLUSION)
idxPartyForName = pbGetLastPokeInTeam(idxBattler)
idxPartyForName = pbLastInTeam(idxBattler)
end
if pbDisplayConfirm(_INTL("{1} is about to send in {2}. Will you switch your Pokémon?",
opponent.fullname,enemyParty[idxPartyForName].name))
@@ -245,7 +245,7 @@ class PokeBattle_Battle
pbDisplayBrief(_INTL("{1}, switch out! Come back!",battler.name))
end
else
owner = pbGetOwnerName(b.index)
owner = pbGetOwnerName(battler.index)
pbDisplayBrief(_INTL("{1} withdrew {2}!",owner,battler.name))
end
end

View File

@@ -135,7 +135,7 @@ class PokeBattle_AI
if @battle.pbRegisterSwitch(idxBattler,list[0])
PBDebug.log("[AI] #{battler.pbThis} (#{idxBattler}) will switch with " +
"#{@battle.pbParty(idxBattler)[list[0]].name}")
return
return true
end
end
end

View File

@@ -1364,7 +1364,7 @@ class PokeBattle_AI
:ROCK, # Cave
:GROUND # Sand
]
type = envtypes[@environment]
type = envtypes[@battle.environment]
score -= 90 if user.pbHasType?(type)
end
#---------------------------------------------------------------------------
@@ -2806,7 +2806,7 @@ class PokeBattle_AI
when "152"
#---------------------------------------------------------------------------
when "153"
score -= 95 if target.pbOwnSide.effects[PBEffects::StickyWeb]
score -= 95 if user.pbOpposingSide.effects[PBEffects::StickyWeb]
#---------------------------------------------------------------------------
when "154"
#---------------------------------------------------------------------------

View File

@@ -5,19 +5,19 @@ module PBTargets
User = 10
NearAlly = 100 # Aromatic Mist, Helping Hand, Hold Hands
UserOrNearAlly = 200 # Acupressure
UserAndAllies = 5 # Aromatherapy, Gear Up, Heal Bell, Life Dew, Magnetic Flux, Howl (in Gen 8+)
NearFoe = 400 # Me First
AllNearFoes = 4
RandomNearFoe = 2 # Petal Dance, Outrage, Struggle, Thrash, Uproar
AllNearFoes = 4
Foe = 9 # For throwing a Poké Ball
AllFoes = 6 # Unused (for completeness)
NearOther = 0
AllNearOthers = 8
Other = 3 # Most Flying-type moves, pulse moves (hits non-near targets)
AllBattlers = 7 # Flower Shield, Perish Song, Rototiller, Teatime
UserSide = 40
FoeSide = 80 # Entry hazards
BothSides = 20
UserAndAllies = 5 # Aromatherapy, Gear Up, Heal Bell, Life Dew, Magnetic Flux, Howl (in Gen 8+)
AllFoes = 6 # Unused (for completeness)
AllBattlers = 7 # Flower Shield, Perish Song, Rototiller, Teatime
def self.noTargets?(target)
return target==None ||

View File

@@ -24,7 +24,7 @@ BattleHandlers::SpeedCalcAbility.add(:SANDRUSH,
BattleHandlers::SpeedCalcAbility.add(:SLOWSTART,
proc { |ability,battler,mult|
next mult/2 if battler.turnCount<=5
next mult/2 if battler.effects[PBEffects::SlowStart]>0
}
)
@@ -1030,7 +1030,7 @@ BattleHandlers::DamageCalcUserAbility.add(:SHEERFORCE,
BattleHandlers::DamageCalcUserAbility.add(:SLOWSTART,
proc { |ability,user,target,move,mults,baseDmg,type|
mults[ATK_MULT] /= 2 if user.turnCount<=5 && move.physicalMove?
mults[ATK_MULT] /= 2 if user.effects[PBEffects::SlowStart]>0 && move.physicalMove?
}
)
@@ -2405,7 +2405,7 @@ BattleHandlers::AbilityOnSwitchOut.add(:NATURALCURE,
BattleHandlers::AbilityOnSwitchOut.add(:REGENERATOR,
proc { |ability,battler,endOfBattle|
next if !endOfBattle
next if endOfBattle
PBDebug.log("[Ability triggered] #{battler.pbThis}'s #{battler.abilityName}")
battler.pbRecoverHP(battler.totalhp/3,false,false)
}