Rewrote AI item usage (inc. adding Revives), various fixes/changes to AI, removed Struggle from PBS files, some bug fixes

This commit is contained in:
Maruno17
2023-04-23 17:52:39 +01:00
parent da182bd98a
commit ce549ab62a
34 changed files with 497 additions and 410 deletions

View File

@@ -43,11 +43,10 @@ class Battle::Move
@category = move.category
@accuracy = move.accuracy
@pp = move.pp # Can be changed with Mimic/Transform
@addlEffect = move.effect_chance
@target = move.target
@priority = move.priority
@flags = move.flags.clone
@calcType = nil
@addlEffect = move.effect_chance
@powerBoost = false # For Aerilate, Pixilate, Refrigerate, Galvanize
@snatched = false
end

View File

@@ -285,7 +285,7 @@ class Battle::Move
if (@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) ||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY)
if @battle.pbCheckGlobalAbility(:AURABREAK)
multipliers[:power_multiplier] *= 2 / 3.0
multipliers[:power_multiplier] *= 3 / 4.0
else
multipliers[:power_multiplier] *= 4 / 3.0
end

View File

@@ -36,7 +36,6 @@ class Battle::Move::Confusion < Battle::Move
@priority = 0
@flags = []
@addlEffect = 0
@calcType = nil
@powerBoost = false
@snatched = false
end
@@ -53,19 +52,18 @@ class Battle::Move::Struggle < Battle::Move
def initialize(battle, move)
@battle = battle
@realMove = nil # Not associated with a move
@id = (move) ? move.id : :STRUGGLE
@name = (move) ? move.name : _INTL("Struggle")
@id = :STRUGGLE
@name = _INTL("Struggle")
@function = "Struggle"
@power = 50
@type = nil
@category = 0
@accuracy = 0
@pp = -1
@target = :NearOther
@target = :RandomNearFoe
@priority = 0
@flags = ["Contact", "CanProtect"]
@addlEffect = 0
@calcType = nil
@powerBoost = false
@snatched = false
end

View File

@@ -1372,7 +1372,7 @@ class Battle::Move::LowerPoisonedTargetAtkSpAtkSpd1 < Battle::Move
next if !b.poisoned?
failed = true
(@statDown.length / 2).times do |i|
next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self)
next if !b.pbCanLowerStatStage?(@statDown[i * 2], user, self)
failed = false
break
end

View File

@@ -768,6 +768,7 @@ class Battle::Move::UseLastMoveUsed < Battle::Move
def pbMoveFailed?(user, targets)
if !@copied_move ||
!GameData::Move.exists?(@copied_move) ||
@moveBlacklist.include?(GameData::Move.get(@copied_move).function_code)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -789,6 +790,7 @@ class Battle::Move::UseLastMoveUsedByTarget < Battle::Move
def pbFailsAgainstTarget?(user, target, show_message)
if !target.lastRegularMoveUsed ||
!GameData::Move.exists?(target.lastRegularMoveUsed) ||
!GameData::Move.get(target.lastRegularMoveUsed).has_flag?("CanMirrorMove")
@battle.pbDisplay(_INTL("The mirror move failed!")) if show_message
return true

View File

@@ -606,7 +606,8 @@ class Battle::Move::TargetUsesItsLastUsedMoveAgain < Battle::Move
end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.lastRegularMoveUsed || !target.pbHasMove?(target.lastRegularMoveUsed)
if !target.lastRegularMoveUsed || !target.pbHasMove?(target.lastRegularMoveUsed) ||
!GameData::Move.exists?(target.lastRegularMoveUsed)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
@@ -814,6 +815,7 @@ class Battle::Move::DisableTargetUsingDifferentMove < Battle::Move
return true
end
if !target.lastRegularMoveUsed ||
!GameData::Move.exists?(target.lastRegularMoveUsed) ||
@moveBlacklist.include?(GameData::Move.get(target.lastRegularMoveUsed).function_code)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true