#注:不考虑任何插件覆盖和冲突情况
#0定义三个天气 (√)
GameData::BattleWeather.register({
:id => :FullMoon,
:name => _INTL("满月夜"),
:animation => "FullMoon"
})
GameData::BattleWeather.register({
:id => :ScaryNight,
:name => _INTL("惊魂夜"),
:animation => "ScaryNight"
})
GameData::BattleWeather.register({
:id => :Midnight,
:name => _INTL("子午夜"),
:animation => "Midnight"
})
when :FullMoon then pbDisplay(_INTL("今夜月光正好!"))
when :ScaryNight then pbDisplay(_INTL("今晚可不太平!"))
when :Midnight then pbDisplay(_INTL("太阳下山了!"))
#1:开启午夜 (√)
#1-1:招式开启午夜
class Battle::Move::StartNightWeather < Battle::Move::WeatherMove
def pbOnStartUse(user, targets)
@weatherType = :Midnight #其余情况变为午夜
@weatherType = :FullMoon if %i[FullMoon Sun].include?(user.battle.field.weather) #晴天下入夜变为满月,满月不变
@weatherType = :ScaryNight if %i[ScaryNight Rain].include?(user.battle.field.weather) #雨天下入夜变为鬼夜,鬼夜不变
end
end
#1-2:特性开启午夜
Battle::AbilityEffects::OnSwitchIn.add(:INNIGHT,
proc { |ability, battler, battle, switch_in|
case battler.effectiveWeather
when :Sun, :FullMoon then battle.pbStartWeatherAbility(:FullMoon, battler) #晴天下入夜变为满月
when :Rain, :ScaryNight then battle.pbStartWeatherAbility(:ScaryNight, battler) #雨天下入夜变为鬼夜
#满月和鬼夜不变
else
battle.pbStartWeatherAbility(:Midnight, battler) #其余情况变为午夜
end
}
)
#1-3:夜间的转换
#1-3.1:雨天相关
#1-3.1.1:降雨特性
Battle::AbilityEffects::OnSwitchIn.add(:DRIZZLE,
proc { |ability, battler, battle, switch_in|
case battler.effectiveWeather
when :FullMoon, :Midnight then battle.pbStartWeatherAbility(:ScaryNight, battler) #满月和午夜下雨变成鬼夜
when :ScaryNight then battle.pbStartWeatherAbility(:ScaryNight, battler) #鬼夜下雨不变
else
battle.pbStartWeatherAbility(:Rain, battler) #其余情况下雨
end
}
)
#1-3.1.2:降雨招式
class Battle::Move::StartRainWeather < Battle::Move::WeatherMove
def pbOnStartUse(user, targets)
@weatherType = :Rain #其余情况下雨
@weatherType = :ScaryNight if %i[FullMoon Midnight ScaryNight].include?(user.battle.field.weather) #满月和午夜放晴下雨鬼夜,鬼夜不变
end
end
#1-3.2:晴天相关
#1-3.2.1:日照特性
Battle::AbilityEffects::OnSwitchIn.add(:DROUGHT,
proc { |ability, battler, battle, switch_in|
case battler.effectiveWeather
when :ScaryNight, :Midnight then battle.pbStartWeatherAbility(:FullMoon, battler) #鬼夜和午夜放晴变成满月
when :FullMoon then battle.pbStartWeatherAbility(:FullMoon, battler) #满月放晴不变
else
battle.pbStartWeatherAbility(:Sun, battler) #其余情况放晴
end
}
)
#1-3.2.2:放晴招式
class Battle::Move::StartSunWeather < Battle::Move::WeatherMove
def pbOnStartUse(user, targets)
@weatherType = :Sun #其余情况放晴
@weatherType = :FullMoon if %i[FullMoon Midnight ScaryNight].include?(user.battle.field.weather) #鬼夜和午夜放晴变成满月,满月不变
end
end
#1-3.3:沙雪
#1-3.3.1:沙雪特性
Battle::AbilityEffects::OnSwitchIn.add(:SANDSTREAM,
proc { |ability, battler, battle, switch_in|
case battler.effectiveWeather
when :ScaryNight, :FullMoon then battle.pbStartWeatherAbility(:Midnight, battler) #鬼夜和满月沙暴变成午夜
when :Midnight then battle.pbStartWeatherAbility(:Midnight, battler) #午夜沙暴不变
else
battle.pbStartWeatherAbility(:Sandstorm, battler) #其余情况沙暴
end
}
)
Battle::AbilityEffects::OnSwitchIn.add(:SNOWWARNING,
proc { |ability, battler, battle, switch_in|
case battler.effectiveWeather
when :ScaryNight, :FullMoon then battle.pbStartWeatherAbility(:Midnight, battler) #鬼夜和满月下雪变成午夜
when :Midnight then battle.pbStartWeatherAbility(:Midnight, battler) #午夜下雪不变
else
battle.pbStartWeatherAbility(:Hail, battler) #其余情况下雪
end
}
)
#1-3.3.1:沙雪招式
class Battle::Move::StartSandstormWeather < Battle::Move::WeatherMove
def pbOnStartUse(user, targets)
@weatherType = :Sandstorm #其余情况沙暴
@weatherType = :Midnight if %i[FullMoon Midnight ScaryNight].include?(user.battle.field.weather) #鬼夜和满月沙暴变成午夜,午夜不变
end
end
class Battle::Move::StartHailWeather < Battle::Move::WeatherMove
def pbOnStartUse(user, targets)
@weatherType = :Hail #其余情况下雪
@weatherType = :Midnight if %i[FullMoon Midnight ScaryNight].include?(user.battle.field.weather) #鬼夜和满月下雪变成午夜,午夜不变
end
end
#2:夜晚效果
#2-1:基础属性(√)
#2-1.1:满月夜:妖精系招式命中后随机提升一项能力(√)
#写在# Cramorant - Gulp Missile和# User's ability中间
#使用者能力随机上升
if user.effectiveWeather == :FullMoon && moveType == :FAIRY
case @battle.pbRandom(7)
when 0 then user.pbRaiseStatStage(:ATTACK, 1, user) if user.pbCanRaiseStatStage?(:ATTACK, user)
when 1 then user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user) if user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user)
when 2 then user.pbRaiseStatStage(:DEFENSE, 1, user) if user.pbCanRaiseStatStage?(:DEFENSE, user)
when 3 then user.pbRaiseStatStage(:SPECIAL_DEFENSE, 1, user) if user.pbCanRaiseStatStage?(:SPECIAL_DEFENSE, user)
when 4 then user.pbRaiseStatStage(:SPEED, 1, user) if user.pbCanRaiseStatStage?(:SPEED, user)
when 5 then user.pbRaiseStatStage(:ACCURACY, 1, user) if user.pbCanRaiseStatStage?(:ACCURACY, user)
when 6 then user.pbRaiseStatStage(:EVASION, 1, user) if user.pbCanRaiseStatStage?(:EVASION, user)
end
end
#2-1.2:子午夜:恶系宝可梦CT+2(√)
#写在def pbIsCritical
c += 1 if user.effectiveWeather == :Midnight && user.pbHasType?(:DARK)
#2-1.3:惊魂夜:鬼系技能可以攻击到一般系(√)
#写在def pbCalcTypeModSingle
if user.effectiveWeather == :ScaryNight && moveType == :GHOST && defType == :NORMAL
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
#2:夜晚效果
#2-1:基础属性(√)
#2-1.1:满月夜:妖精系招式命中后随机提升一项能力(√)
#写在# Cramorant - Gulp Missile和# User's ability中间
#使用者能力随机上升
if user.effectiveWeather == :FullMoon && moveType == :FAIRY
case @battle.pbRandom(7)
when 0 then user.pbRaiseStatStage(:ATTACK, 1, user) if user.pbCanRaiseStatStage?(:ATTACK, user)
when 1 then user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user) if user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user)
when 2 then user.pbRaiseStatStage(:DEFENSE, 1, user) if user.pbCanRaiseStatStage?(:DEFENSE, user)
when 3 then user.pbRaiseStatStage(:SPECIAL_DEFENSE, 1, user) if user.pbCanRaiseStatStage?(:SPECIAL_DEFENSE, user)
when 4 then user.pbRaiseStatStage(:SPEED, 1, user) if user.pbCanRaiseStatStage?(:SPEED, user)
when 5 then user.pbRaiseStatStage(:ACCURACY, 1, user) if user.pbCanRaiseStatStage?(:ACCURACY, user)
when 6 then user.pbRaiseStatStage(:EVASION, 1, user) if user.pbCanRaiseStatStage?(:EVASION, user)
end
end
#2-1.2:子午夜:恶系宝可梦CT+2(√)
#写在def pbIsCritical
c += 1 if user.effectiveWeather == :Midnight && user.pbHasType?(:DARK)
#2-1.3:惊魂夜:鬼系技能可以攻击到一般系(√)
#写在def pbCalcTypeModSingle
if user.effectiveWeather == :ScaryNight && moveType == :GHOST && defType == :NORMAL
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
#2-2:招式联动
#2-2.0:通用效果(√)
#2-2.0.1:气象球:妖精系,恶系,鬼系(√)
#写在TypeAndPowerDependOnWeather
when :FullMoon
ret = :FAIRY if GameData::Type.exists?(:FAIRY)
when :Midnight
ret = :DARK if GameData::Type.exists?(:DARK)
when :ScaryNight
ret = :GHOST if GameData::Type.exists?(:GHOST)
#2-2.0.2:晨光,光合作用回血量大幅降低(√)
#写在HealUserDependingOnWeather
when :FullMoon, :ScaryNight, :Midnight
@battle.pbDisplay(_INTL("笨蛋,晚上哪来的太阳!"))
@healAmount = (user.totalhp * 9 / 200.0).round
#2-2.1:满月夜(√)
#2-2.1.1:月爆在造成伤害之前降低对手一级特防(√)
#写在LowerTargetSpAtk1
#PBS文件里记得改月亮之力的FunctionCode为LowerTargetSpAtk1MoonBlast
class Battle::Move::LowerTargetSpAtk1MoonBlast < Battle::Move::TargetStatDownMove
def pbOnStartUse(user, targets)
targets.each do |b|
b.pbLowerStatStage(:SPECIAL_DEFENSE, 1, user) if user.effectiveWeather == :FullMoon && b.pbCanLowerStatStage?(:SPECIAL_DEFENSE, user)
end
end
def initialize(battle, move)
super
@statDown = [:SPECIAL_ATTACK, 1]
end
end
#2-2.1.2:月光回血100%(√)
#写在HealUserDependingOnWeather
#PBS文件里记得改月光的FunctionCode为HealUserDependingOnWeatherFullMoon
class Battle::Move::HealUserDependingOnWeatherFullMoon < Battle::Move::HealingMove
def pbOnStartUse(user, targets)
case user.effectiveWeather
when :Sun, :HarshSun
@battle.pbDisplay(_INTL("那么大的太阳你竟然用月光!?"))
@healAmount = (user.totalhp * 0 / 3.0).round
when :FullMoon
@healAmount = (user.totalhp * 2 / 2.0).round
when :None, :StrongWinds
@healAmount = (user.totalhp / 2.0).round
else
@healAmount = (user.totalhp / 4.0).round
end
end
def pbHealAmount(user)
return @healAmount
end
end
#2-2.1.3:血月威力降至100,可以连续使用(√)
#写在CantSelectConsecutiveTurns
#PBS文件里记得改血月的FunctionCode为CantSelectConsecutiveTurnsBloodMoon
class Battle::Move::CantSelectConsecutiveTurnsBloodMoon < Battle::Move
def pbBaseDamage(baseDmg, user, target)
return 100 if user.effectiveWeather == :FullMoon
return super
end
def pbEffectWhenDealingDamage(user, target)
if user.effectiveWeather != :FullMoon
user.effects[PBEffects::SuccessiveMove] = @id
end
end
end
#2-2.2:子午夜(√)
#2-2.2.1:催眠术必定命中且睡眠时间固定为4回合(√)
#写在SleepTargetHypnosis
#PBS文件里记得改催眠术的FunctionCode为SleepTargetHypnosis
class Battle::Move::SleepTargetHypnosis < Battle::Move
def canMagicCoat?
return true
end
def pbBaseAccuracy(user, target)
case target.effectiveWeather
when :Midnight
return 0
end
return super
end
def pbFailsAgainstTarget?(user, target, show_message)
return false if damagingMove?
return !target.pbCanSleep?(user, show_message, self)
end
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.pbSleep
end
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbSleep if target.pbCanSleep?(user, false, self)
end
end
#写在pbSleepDuration
def pbSleepDuration(duration = -1)
duration = 2 + @battle.pbRandom(3) if duration <= 0
duration = 5 if effectiveWeather == :Midnight
duration = (duration / 2).floor if hasActiveAbility?(:EARLYBIRD)
return duration
end
#2-2.2.2:大声咆哮强制解除睡眠且令对手混乱(√)
#写在LowerTargetSpAtk1
#PBS文件里记得改大声咆哮的FunctionCode为LowerTargetSpAtk1Snarl
class Battle::Move::LowerTargetSpAtk1Snarl < Battle::Move::TargetStatDownMove
def initialize(battle, move)
super
@statDown = [:SPECIAL_ATTACK, 1]
end
def pbEffectAfterAllHits(user, target)
if user.effectiveWeather == :Midnight
return if target.fainted?
return if target.damageState.unaffected || target.damageState.substitute
return if target.status != :SLEEP
target.pbCureStatus
if target.pbCanConfuse?(user, false, self)
target.pbConfuse
end
end
end
end
#2-2.2.3:食梦吸血3/4且对恶系也能造成伤害(√)
#写在HealUserByHalfOfDamageDoneIfTargetAsleep
#PBS文件里记得改食梦的FunctionCode为HealUserByHalfOfDamageDoneIfTargetAsleepDreamEater
class Battle::Move::HealUserByHalfOfDamageDoneIfTargetAsleepDreamEater < Battle::Move
def healingMove?; return Settings::MECHANICS_GENERATION >= 6; end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.asleep?
@battle.pbDisplay(_INTL("对于{1},完全没有效果!", target.pbThis)) if show_message
return true
end
return false
end
def pbCalcTypeModSingle(moveType, defType, user, target)
return Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER if defType == :DARK && user.effectiveWeather == :Midnight
return super
end
def pbEffectAgainstTarget(user, target)
return if target.damageState.hpLost <= 0
if user.effectiveWeather == :Midnight
hpGain = (target.damageState.hpLost * 3 / 4.0).round
else
hpGain = (target.damageState.hpLost / 2.0).round
end
user.pbRecoverHPFromDrain(hpGain, target)
end
end
#2-2.3:惊魂夜(√)
#2-2.3.1:影子分身额外扣血1/8召唤替身(√)
#写在RaiseUserEvasion1
#PBS文件里记得改影子分身的FunctionCode为RaiseUserEvasion1DoubleTeam
class Battle::Move::RaiseUserEvasion1DoubleTeam < Battle::Move::StatUpMove
def initialize(battle, move)
super
@statUp = [:EVASION, 1]
end
def canSnatch?
return true
end
def pbMoveFailed?(user, targets)
if user.effectiveWeather == :ScaryNight
if user.effects[PBEffects::Substitute] > 0
@battle.pbDisplay(_INTL("{1}的分身已经出现了。", user.pbThis))
return true
end
@lifeCost = [(user.totalhp / 8).ceil, 1].max
@subLife = [(user.totalhp / 4).ceil, 1].max
if user.hp <= @lifeCost
@battle.pbDisplay(_INTL("但是,已经没有力气再分身了!"))
return true
end
return false
end
end
def pbOnStartUse(user, targets)
if user.effectiveWeather == :ScaryNight
user.pbReduceHP(@lifeCost, false, false)
user.pbItemHPHealCheck
end
end
def pbEffectGeneral(user)
if user.effectiveWeather == :ScaryNight
user.effects[PBEffects::Trapping] = 0
user.effects[PBEffects::TrappingMove] = nil
user.effects[PBEffects::Substitute] = @subLife
@battle.pbDisplay(_INTL("{1}的替身出现了!", user.pbThis))
end
super
end
end
#2-2.3.2:影子球AOE且根据攻击较强、防御较弱的一项计算(√)
#写在LowerTargetSpDef1
#PBS文件里记得改暗影球的FunctionCode为LowerTargetSpDef1ShadowBall
class Battle::Move::LowerTargetSpDef1ShadowBall < Battle::Move::TargetStatDownMove
def initialize(battle, move)
super
@statDown = [:SPECIAL_DEFENSE, 1]
@calcCategory = 1
end
def pbTarget(user)
if user.effectiveWeather == :ScaryNight
return GameData::Target.get(:AllNearFoes)
end
return super
end
def physicalMove?(thisType = nil); return (@calcCategory == 0); end
def specialMove?(thisType = nil); return (@calcCategory == 1); end
def contactMove?; return physicalMove?; end
def pbOnStartUse(user, targets)
if user.effectiveWeather == :ScaryNight
target = targets[0]
return if !target
max_stage = Battle::Battler::STAT_STAGE_MAXIMUM
stageMul = Battle::Battler::STAT_STAGE_MULTIPLIERS
stageDiv = Battle::Battler::STAT_STAGE_DIVISORS
# Calculate user's effective attacking values
attack_stage = user.stages[:ATTACK] + max_stage
real_attack = (user.attack.to_f * stageMul[attack_stage] / stageDiv[attack_stage]).floor
special_attack_stage = user.stages[:SPECIAL_ATTACK] + max_stage
real_special_attack = (user.spatk.to_f * stageMul[special_attack_stage] / stageDiv[special_attack_stage]).floor
# Calculate target's effective defending values
defense_stage = target.stages[:DEFENSE] + max_stage
real_defense = (target.defense.to_f * stageMul[defense_stage] / stageDiv[defense_stage]).floor
special_defense_stage = target.stages[:SPECIAL_DEFENSE] + max_stage
real_special_defense = (target.spdef.to_f * stageMul[special_defense_stage] / stageDiv[special_defense_stage]).floor
# Perform simple damage calculation
physical_damage = real_attack.to_f / real_defense
special_damage = real_special_attack.to_f / real_special_defense
# Determine move's category
if physical_damage == special_damage
@calcCategory = (@battle.command_phase) ? rand(2) : @battle.pbRandom(2)
else
@calcCategory = (physical_damage > special_damage) ? 0 : 1
end
end
end
end
#2-2.3.3:鬼火可以使火系宝可梦烧伤(√)
#写在第一个Type immunities
when :BURN
if !(user&.effectiveWeather == :ScaryNight && move&.id== :WILLOWISP)
hasImmuneType |= pbHasType?(:FIRE)
#2-3:特性联动
#2-3.0:通用效果(√)
#2-2.0.1:(新增特性)夜行:黑夜下速度翻倍(√)
Battle::AbilityEffects::SpeedCalc.add(:NIGHTWALKER,
proc { |ability, battler, mult|
next mult * 2 if [:FullMoon, :ScaryNight, :Midnight].include?(battler.effectiveWeather)
}
)
#2-2.0.2:(新增特性)潜影:黑夜下闪避增加(√)
Battle::AbilityEffects::AccuracyCalcFromTarget.add(:SHADOWDIVER,
proc { |ability, mods, user, target, move, type|
mods[:evasion_multiplier] *= 1.25 if [:FullMoon, :ScaryNight, :Midnight].include?(target.effectiveWeather)
}
)
#2-2.0.3:(新增特性)趋暗避光:黑夜下除HP外全能力上升20%,晴天和大日照下除HP外全能力下降20%(√)
Battle::AbilityEffects::DamageCalcFromUser.add(:SKOTOTAXIS,
proc { |ability, user, target, move, mults, power, type|
mults[:attack_multiplier] *= 1.2 if move.damagingMove? && [:FullMoon, :ScaryNight, :Midnight].include?(user.effectiveWeather)
mults[:attack_multiplier] *= 0.8 if move.damagingMove? && [:Sun, :HarshSun].include?(user.effectiveWeather)
}
)
Battle::AbilityEffects::DamageCalcFromTarget.add(:SKOTOTAXIS,
proc { |ability, user, target, move, mults, power, type|
mults[:defense_multiplier] *= 1.2 if move.damagingMove? && [:FullMoon, :ScaryNight, :Midnight].include?(target.effectiveWeather)
mults[:defense_multiplier] *= 0.8 if move.damagingMove? && [:Sun, :HarshSun].include?(target.effectiveWeather)
}
)
Battle::AbilityEffects::SpeedCalc.add(:SKOTOTAXIS,
proc { |ability, battler, mult|
next mult * 1.2 if [:FullMoon, :ScaryNight, :Midnight].include?(battler.effectiveWeather)
next mult * 0.8 if [:Sun, :HarshSun].include?(battler.effectiveWeather)
}
)
#2-2.1:满月夜(√)
#2-2.1.1:不眠每回合回血1/8 (√)
Battle::AbilityEffects::EndOfRoundWeather.add(:INSOMNIA,
proc { |ability, weather, battler, battle|
next unless weather == :FullMoon
next if !battler.canHeal?
battle.pbShowAbilitySplash(battler)
battler.pbRecoverHP(battler.totalhp / 8)
if Battle::Scene::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1}的体力回复了!", battler.pbThis))
else
battle.pbDisplay(_INTL("因为{2},{1}回复了体力!", battler.pbThis, battler.abilityName))
end
battle.pbHideAbilitySplash(battler)
}
)
#2-2.1.2:(新增特性)狼性:满月下接触类技能伤害*1.5倍 (√)
Battle::AbilityEffects::DamageCalcFromUser.add(:WOLFSPIRIT,
proc { |ability, user, target, move, mults, power, type|
mults[:power_multiplier] *= 3 / 2.0 if move.contactMove? && user.effectiveWeather == :FullMoon
}
)
#2-2.1.3:(新增特性)闪亮鳞片:满月下使用舞类招式降低对手命中1级 (√)
Battle::AbilityEffects::OnEndOfUsingMove.add(:SHININGSCALE,
proc { |ability, user, targets, move, battle|
if move.danceMove? && user.effectiveWeather == :FullMoon #判断满月且是舞蹈招式
battle.allOtherSideBattlers.each do |b|
if b.pbCanLowerStatStage?(:ACCURACY,b) #检查对向宝可梦是否可以降低命中率
battle.pbShowAbilitySplash(user) #可以则弹出特性条和文案
if Battle::Scene::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1}被反射的月光晃了眼!", b.pbThis))
end
b.pbLowerStatStage(:ACCURACY, 1, b, true, true)
battle.pbHideAbilitySplash(user)
end
end
end
}
)
#2-2.2:子午夜(√)
#2-2.2.1:恶作剧之心可以对恶系生效 (√)
#写在# Dark-type immunity to moves made faster by Prankster
if Settings::MECHANICS_GENERATION >= 7 && user.effects[PBEffects::Prankster] &&
target.pbHasType?(:DARK) && target.opposes?(user) && target.effectiveWeather != :Midnight
PBDebug.log("[Target immune] #{target.pbThis} is Dark-type and immune to Prankster-boosted moves")
@battle.pbDisplay(_INTL("对于{1},好像没有效果……", target.pbThis(true))) if show_message
return false
end
#2-2.2.2:(新增特性)光饵:午夜时每次登场当回合对方的单体招式都会攻击自己 (√)
Battle::AbilityEffects::OnSwitchIn.add(:BRAIT,
proc { |ability, battler, battle, switch_in|
if user.effectiveWeather == :Midnight
battler.effects[PBEffects::FollowMe] = 1
end
}
)
#2-2.2.3:(新增特性)扫把星:午夜下自身处于异常状态时,每回合结束都可能将异常状态传染给其他场上的宝可梦 (√)
Battle::AbilityEffects::EndOfRoundWeather.add(:UNLUCKYBODY,
proc { |ability, weather, battler, battle|
next if weather != :Midnight
next if battle.pbRandom(100) >= 30
can_status = []
battle.allBattlers.each do |b|
next if b.index == battle.index
next if !b.pbCanInflictStatus?(battler.status, battler, false)
can_status.push(b)
end
next if can_status.empty?
battle.pbShowAbilitySplash(battler)
can_status.sample.pbInflictStatus(battler.status, (battler.statusCount >= 1 ) ? 1 : 0, nil, battler)
battle.pbHideAbilitySplash(battler)
}
)
#2-2.3:惊魂夜
#2-2.3.1:胆怯先制度+1,被攻击就会下场 (√)
#写在 battler.effects[PBEffects::Prankster] = false下面
battler.effects[PBEffects::RATTLED] = false
#写在 @effects[PBEffects::Prankster] = false下面
@effects[PBEffects::RATTLED] = false
#写在 module PBEffects的Yawn = 116下面
RATTLED = 117
Battle::AbilityEffects::PriorityChange.add(:RATTLED, #先制度+1
proc { |ability, battler, move, pri|
if battler.effectiveWeather == :ScaryNight
battler.effects[PBEffects::RATTLED] = true
next pri + 1
end
}
)
Battle::AbilityEffects::OnBeingHit.add(:RATTLED,
proc { |ability, user, target, move, battle|
if [:BUG, :DARK, :GHOST].include?(move.calcType)
target.pbRaiseStatStageByAbility(:SPEED, 1, target)
end
if target.effectiveWeather == :ScaryNight
next false if target.effects[PBEffects::SkyDrop] >= 0 ||
target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSkyTargetCannotAct") # Sky Drop
# In wild battles
if battle.wildBattle?
next false if !battle.pbCanRun?(target.index)
battle.pbShowAbilitySplash(target, true)
battle.pbHideAbilitySplash(target)
pbSEPlay("Battle flee")
battle.pbDisplay(_INTL("{1}脱离了战斗!", target.pbThis))
battle.decision = 3 # Escaped
next true
end
# In trainer battles
next false if battle.pbAllFainted?(target.idxOpposingSide)
next false if !battle.pbCanSwitchOut?(target.index) # Battler can't switch out
next false if !battle.pbCanChooseNonActive?(target.index) # No Pokémon can switch in
battle.pbShowAbilitySplash(target, true)
battle.pbHideAbilitySplash(target)
if !Battle::Scene::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1}的{2}发动!", target.pbThis, target.abilityName))
end
battle.pbDisplay(_INTL("{1}要回到{2}的身边了!", target.pbThis, battle.pbGetOwnerName(target.index)))
if battle.endOfRound # Just switch out
battle.scene.pbRecall(target.index) if !target.fainted?
target.pbAbilitiesOnSwitchOut # Inc. primordial weather check
next true
end
newPkmn = battle.pbGetReplacementPokemonIndex(target.index) # Owner chooses
next false if newPkmn < 0 # Shouldn't ever do this
battle.pbRecallAndReplace(target.index, newPkmn)
battle.pbClearChoice(target.index) # Replacement Pokémon does nothing this round
battle.moldBreaker = false if user && target.index == user.index
battle.pbOnBattlerEnteringBattle(target.index)
next true
end
next false
}
)
#2-2.3.2:(新增特性)鬼打墙:惊魂夜中登场造成三回合的踩影和再来一次效果 (√)
#(写在B_I——# Creating a battler——SLOWSTART下面一行)
@effects[PBEffects::SpookyCircle] = 0
#(写在PBEffects)
SpookyCircle = 118 #看你这一段最后一个是几,总之连续的补在最后就行
#(写在battle_battler的def trappedInBattle?上面)
def can_spooky_circle?
@effects[PBEffects::SpookyCircle] != 3
end
def circled?
return false if pbHasType?(:GHOST)
return false if hasActiveAbility?(:SHADOWTAG)
return true @effects[PBEffects::SpookyCircle] > 0
return false
end
#(写在End Of Round end self-inflicted effects on battler)
#鬼打墙结束
if battler.effects[PBEffects::SpookyCircle] > 0
battler.effects[PBEffects::SpookyCircle] -= 1
if battler.effects[PBEffects::SpookyCircle] == 0
pbDisplay(_INTL("{1}不再迷失了!", battler.pbThis))
end
end
#写在# Battler_UseMoveSuccessChecks中 Choice Band/Gorilla Tactics,整段这样改。
@effects[PBEffects::ChoiceBand] = nil if !pbHasMove?(@effects[PBEffects::ChoiceBand])
if @effects[PBEffects::ChoiceBand] && move.id != @effects[PBEffects::ChoiceBand]
choiced_move = GameData::Move.try_get(@effects[PBEffects::ChoiceBand])
if choiced_move
if hasActiveItem?([:CHOICEBAND, :CHOICESPECS, :CHOICESCARF])
if showMessages
msg = _INTL("因为{1}的效果,只能使出{2}!", itemName, choiced_move.name)
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
end
return false
elsif hasActiveAbility?(:GORILLATACTICS)
if showMessages
msg = _INTL("{1}只能使出{2}!", pbThis, choiced_move.name)
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
end
return false
# 鬼打墙
elsif @effects[PBEffects::SpookyCircle] > 0
if showMessages
msg = _INTL("{1}迷失在循环中只能使出{2}!", pbThis, choiced_move.name)
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
end
return false
end
end
end
#写在Battler_UseMove中def pbEndTurn(_choice),整段这样改
def pbEndTurn(_choice)
@lastRoundMoved = @battle.turnCount # Done something this round
if !@effects[PBEffects::ChoiceBand] &&
(hasActiveItem?([:CHOICEBAND, :CHOICESPECS, :CHOICESCARF]) ||
hasActiveAbility?(:GORILLATACTICS) || @effects[PBEffects::SpookyCircle] > 0)
if @lastMoveUsed && pbHasMove?(@lastMoveUsed)
@effects[PBEffects::ChoiceBand] = @lastMoveUsed
elsif @lastRegularMoveUsed && pbHasMove?(@lastRegularMoveUsed)
@effects[PBEffects::ChoiceBand] = @lastRegularMoveUsed
end
end
@effects[PBEffects::BeakBlast] = false
@effects[PBEffects::Charge] = 0 if @effects[PBEffects::Charge] == 1
@effects[PBEffects::GemConsumed] = nil
@effects[PBEffects::ShellTrap] = false
@battle.allBattlers.each { |b| b.pbContinualAbilityChecks } # Trace, end primordial weathers
end
Battle::AbilityEffects::OnSwitchIn.add(:SPOOKYCIRCLE,
proc { |ability, battler, battle, switch_in|
next unless battler.effectiveWeather == :ScaryNight
circled = []
battler.eachOpposing do |b|
next unless b.can_spooky_circle?
b.effects[PBEffects::SpookyCircle] = 3
circled << b
end
next if circled.empty?
battle.pbShowAbilitySplash(battler)
circled.each { |b| battle.pbDisplay(_INTL("{1}迷失在了循环里!", b.pbThis) }
battle.pbHideAbilitySplash(battler)
}
)
#2-2.3.3:(新增特性)装神弄鬼:惊魂夜满HP状态下幽灵系招式会导致对手畏缩 (√)
#写在def pbFlinchChance(user, target)
if user.hasActiveAbility?(:JUMPSCARE, true) && target.effectiveWeather == :ScaryNight && user.moveType == :GHOST && user.hp == user.totalhp
ret = 100
end