Added class GameData::Status

This commit is contained in:
Maruno17
2021-02-15 23:20:51 +00:00
parent 8b5b9d5fc4
commit 6a8e4fcfa5
49 changed files with 468 additions and 430 deletions

View File

@@ -96,7 +96,7 @@ class PokeBattle_AI
}
losthp = battler.totalhp - battler.hp
preferFullRestore = (battler.hp <= battler.totalhp * 2 / 3 &&
(battler.status != PBStatuses::NONE || battler.effects[PBEffects::Confusion] > 0))
(battler.status != :NONE || battler.effects[PBEffects::Confusion] > 0))
# Find all usable items
usableHPItems = []
usableStatusItems = []
@@ -115,7 +115,7 @@ class PokeBattle_AI
end
end
# Log Full Restores (HP healer and status curer)
if losthp > 0 || battler.status != PBStatuses::NONE
if losthp > 0 || battler.status != :NONE
if fullRestoreItems.include?(i)
usableHPItems.push([i, (preferFullRestore) ? 3 : 7, 999])
usableStatusItems.push([i, (preferFullRestore) ? 3 : 9])

View File

@@ -44,7 +44,7 @@ class PokeBattle_AI
end
# Pokémon will faint because of bad poisoning at the end of this round, but
# would survive at least one more round if it were regular poisoning instead
if battler.status==PBStatuses::POISON && battler.statusCount>0 &&
if battler.status == :POISON && battler.statusCount > 0 &&
skill>=PBTrainerAI.highSkill
toxicHP = battler.totalhp/16
nextToxicHP = toxicHP*(battler.effects[PBEffects::Toxic]+1)

View File

@@ -199,7 +199,7 @@ class PokeBattle_AI
end
end
# If user is asleep, prefer moves that are usable while asleep
if user.status==PBStatuses::SLEEP && !move.usableWhenAsleep?
if user.status == :SLEEP && !move.usableWhenAsleep?
user.eachMove do |m|
next unless m.usableWhenAsleep?
score -= 60
@@ -207,7 +207,7 @@ class PokeBattle_AI
end
end
# If user is frozen, prefer a move that can thaw the user
if user.status==PBStatuses::FROZEN
if user.status == :FROZEN
if move.thawsUser?
score += 40
else
@@ -219,7 +219,7 @@ class PokeBattle_AI
end
end
# If target is frozen, don't prefer moves that could thaw them
if target.status==PBStatuses::FROZEN
if target.status == :FROZEN
user.eachMove do |m|
next if m.thawsUser?
score -= 60

View File

@@ -180,11 +180,11 @@ class PokeBattle_AI
end
#---------------------------------------------------------------------------
when "017"
score += 30 if target.status==PBStatuses::NONE
score += 30 if target.status == :NONE
#---------------------------------------------------------------------------
when "018"
case user.status
when PBStatuses::POISON
when :POISON
score += 40
if skill>=PBTrainerAI.mediumSkill
if user.hp<user.totalhp/8
@@ -194,7 +194,7 @@ class PokeBattle_AI
score += 60
end
end
when PBStatuses::BURN, PBStatuses::PARALYSIS
when :BURN, :PARALYSIS
score += 40
else
score -= 90
@@ -203,7 +203,7 @@ class PokeBattle_AI
when "019"
statuses = 0
@battle.pbParty(user.index).each do |pkmn|
statuses += 1 if pkmn && pkmn.status!=PBStatuses::NONE
statuses += 1 if pkmn && pkmn.status != :NONE
end
if statuses==0
score -= 80
@@ -214,14 +214,14 @@ class PokeBattle_AI
when "01A"
if user.pbOwnSide.effects[PBEffects::Safeguard]>0
score -= 80
elsif user.status!=0
elsif user.status != :NONE
score -= 40
else
score += 30
end
#---------------------------------------------------------------------------
when "01B"
if user.status==PBStatuses::NONE
if user.status == :NONE
score -= 90
else
score += 40
@@ -1567,11 +1567,11 @@ class PokeBattle_AI
when "07B"
#---------------------------------------------------------------------------
when "07C"
score -= 20 if target.status==PBStatuses::PARALYSIS # Will cure status
score -= 20 if target.status == :PARALYSIS # Will cure status
#---------------------------------------------------------------------------
when "07D"
score -= 20 if target.status==PBStatuses::SLEEP && # Will cure status
target.statusCount>1
score -= 20 if target.status == :SLEEP && # Will cure status
target.statusCount > 1
#---------------------------------------------------------------------------
when "07E"
#---------------------------------------------------------------------------
@@ -1870,7 +1870,7 @@ class PokeBattle_AI
else
score += 70
score -= user.hp*140/user.totalhp
score += 30 if user.status!=0
score += 30 if user.status != :NONE
end
#---------------------------------------------------------------------------
when "0DA"
@@ -2811,13 +2811,13 @@ class PokeBattle_AI
#---------------------------------------------------------------------------
when "15A"
if target.opposes?(user)
score -= 40 if target.status==PBStatuses::BURN
score -= 40 if target.status == :BURN
else
score += 40 if target.status==PBStatuses::BURN
score += 40 if target.status == :BURN
end
#---------------------------------------------------------------------------
when "15B"
if target.status==PBStatuses::NONE
if target.status == :NONE
score -= 90
elsif user.hp==user.totalhp && target.opposes?(user)
score -= 90

View File

@@ -215,7 +215,7 @@ class PokeBattle_AI
when "0C1" # Beat Up
mult = 0
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,_i|
mult += 1 if pkmn && pkmn.able? && pkmn.status==PBStatuses::NONE
mult += 1 if pkmn && pkmn.able? && pkmn.status == :NONE
end
baseDmg *= mult
when "0C4" # Solar Beam
@@ -472,7 +472,7 @@ class PokeBattle_AI
end
# Burn
if skill>=PBTrainerAI.highSkill
if user.status==PBStatuses::BURN && move.physicalMove?(type) &&
if user.status == :BURN && move.physicalMove?(type) &&
!user.hasActiveAbility?(:GUTS) &&
!(Settings::MECHANICS_GENERATION >= 6 && move.function == "07E") # Facade
multipliers[:final_damage_multiplier] /= 2