mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 22:24:58 +00:00
Pokémon sent into battle now default to the Fight option, fixed bugs in Instruct, fixed some AI bugs, fixed parameter mixup for def pbMoveCanTarget?, renamed function to function_code everywhere, fixed black party Pokémon icons in storage, added some more AI testing code
This commit is contained in:
@@ -3,7 +3,7 @@ class Battle::Move
|
||||
attr_reader :realMove
|
||||
attr_accessor :id
|
||||
attr_reader :name
|
||||
attr_reader :function
|
||||
attr_reader :function_code
|
||||
attr_reader :power
|
||||
attr_reader :type
|
||||
attr_reader :category
|
||||
@@ -32,23 +32,23 @@ class Battle::Move
|
||||
# Creating a move
|
||||
#=============================================================================
|
||||
def initialize(battle, move)
|
||||
@battle = battle
|
||||
@realMove = move
|
||||
@id = move.id
|
||||
@name = move.name # Get the move's name
|
||||
@battle = battle
|
||||
@realMove = move
|
||||
@id = move.id
|
||||
@name = move.name # Get the move's name
|
||||
# Get data on the move
|
||||
@function = move.function_code
|
||||
@power = move.power
|
||||
@type = move.type
|
||||
@category = move.category
|
||||
@accuracy = move.accuracy
|
||||
@pp = move.pp # Can be changed with Mimic/Transform
|
||||
@target = move.target
|
||||
@priority = move.priority
|
||||
@flags = move.flags.clone
|
||||
@addlEffect = move.effect_chance
|
||||
@powerBoost = false # For Aerilate, Pixilate, Refrigerate, Galvanize
|
||||
@snatched = false
|
||||
@function_code = move.function_code
|
||||
@power = move.power
|
||||
@type = move.type
|
||||
@category = move.category
|
||||
@accuracy = move.accuracy
|
||||
@pp = move.pp # Can be changed with Mimic/Transform
|
||||
@target = move.target
|
||||
@priority = move.priority
|
||||
@flags = move.flags.clone
|
||||
@addlEffect = move.effect_chance
|
||||
@powerBoost = false # For Aerilate, Pixilate, Refrigerate, Galvanize
|
||||
@snatched = false
|
||||
end
|
||||
|
||||
# This is the code actually used to generate a Battle::Move object. The
|
||||
@@ -154,7 +154,7 @@ class Battle::Move
|
||||
end
|
||||
|
||||
def display_type(battler)
|
||||
case @function
|
||||
case @function_code
|
||||
when "TypeDependsOnUserMorpekoFormRaiseUserSpeed1"
|
||||
if battler.isSpecies?(:MORPEKO) || battler.effects[PBEffects::TransformSpecies] == :MORPEKO
|
||||
return pbBaseType(battler)
|
||||
@@ -172,7 +172,7 @@ class Battle::Move
|
||||
|
||||
def display_damage(battler)
|
||||
=begin
|
||||
case @function
|
||||
case @function_code
|
||||
when "TypeAndPowerDependOnUserBerry"
|
||||
return pbNaturalGiftBaseDamage(battler.item_id)
|
||||
when "TypeAndPowerDependOnWeather", "TypeAndPowerDependOnTerrain",
|
||||
@@ -187,7 +187,7 @@ class Battle::Move
|
||||
|
||||
def display_category(battler)
|
||||
=begin
|
||||
case @function
|
||||
case @function_code
|
||||
when "CategoryDependsOnHigherDamageIgnoreTargetAbility"
|
||||
pbOnStartUse(user, nil)
|
||||
return @calcCategory
|
||||
|
||||
@@ -373,7 +373,7 @@ class Battle::Move
|
||||
# regardless of its calculated type. Hence the following two lines of
|
||||
# code.
|
||||
moveType = nil
|
||||
moveType = :NORMAL if @function == "TypeDependsOnUserIVs" # Hidden Power
|
||||
moveType = :NORMAL if @function_code == "TypeDependsOnUserIVs" # Hidden Power
|
||||
if !target.damageState.substitute
|
||||
if physicalMove?(moveType)
|
||||
target.effects[PBEffects::Counter] = damage
|
||||
|
||||
@@ -416,7 +416,7 @@ class Battle::Move
|
||||
multipliers[:final_damage_multiplier] *= 1.5
|
||||
end
|
||||
when :Sandstorm
|
||||
if target.pbHasType?(:ROCK) && specialMove? && @function != "UseTargetDefenseInsteadOfTargetSpDef"
|
||||
if target.pbHasType?(:ROCK) && specialMove? && @function_code != "UseTargetDefenseInsteadOfTargetSpDef"
|
||||
multipliers[:defense_multiplier] *= 1.5
|
||||
end
|
||||
when :ShadowSky
|
||||
@@ -489,7 +489,7 @@ class Battle::Move
|
||||
def pbAdditionalEffectChance(user, target, effectChance = 0)
|
||||
return 0 if target.hasActiveAbility?(:SHIELDDUST) && !@battle.moldBreaker
|
||||
ret = (effectChance > 0) ? effectChance : @addlEffect
|
||||
if (Settings::MECHANICS_GENERATION >= 6 || @function != "EffectDependsOnEnvironment") &&
|
||||
if (Settings::MECHANICS_GENERATION >= 6 || @function_code != "EffectDependsOnEnvironment") &&
|
||||
(user.hasActiveAbility?(:SERENEGRACE) || user.pbOwnSide.effects[PBEffects::Rainbow] > 0)
|
||||
ret *= 2
|
||||
end
|
||||
|
||||
@@ -22,22 +22,22 @@ end
|
||||
#===============================================================================
|
||||
class Battle::Move::Confusion < Battle::Move
|
||||
def initialize(battle, move)
|
||||
@battle = battle
|
||||
@realMove = move
|
||||
@id = :CONFUSEDAMAGE
|
||||
@name = ""
|
||||
@function = "None"
|
||||
@power = 40
|
||||
@type = nil
|
||||
@category = 0
|
||||
@accuracy = 100
|
||||
@pp = -1
|
||||
@target = :User
|
||||
@priority = 0
|
||||
@flags = []
|
||||
@addlEffect = 0
|
||||
@powerBoost = false
|
||||
@snatched = false
|
||||
@battle = battle
|
||||
@realMove = move
|
||||
@id = :CONFUSEDAMAGE
|
||||
@name = ""
|
||||
@function_code = "None"
|
||||
@power = 40
|
||||
@type = nil
|
||||
@category = 0
|
||||
@accuracy = 100
|
||||
@pp = -1
|
||||
@target = :User
|
||||
@priority = 0
|
||||
@flags = []
|
||||
@addlEffect = 0
|
||||
@powerBoost = false
|
||||
@snatched = false
|
||||
end
|
||||
|
||||
def physicalMove?(thisType = nil); return true; end
|
||||
@@ -50,22 +50,22 @@ end
|
||||
#===============================================================================
|
||||
class Battle::Move::Struggle < Battle::Move
|
||||
def initialize(battle, move)
|
||||
@battle = battle
|
||||
@realMove = nil # Not associated with a move
|
||||
@id = :STRUGGLE
|
||||
@name = _INTL("Struggle")
|
||||
@function = "Struggle"
|
||||
@power = 50
|
||||
@type = nil
|
||||
@category = 0
|
||||
@accuracy = 0
|
||||
@pp = -1
|
||||
@target = :RandomNearFoe
|
||||
@priority = 0
|
||||
@flags = ["Contact", "CanProtect"]
|
||||
@addlEffect = 0
|
||||
@powerBoost = false
|
||||
@snatched = false
|
||||
@battle = battle
|
||||
@realMove = nil # Not associated with a move
|
||||
@id = :STRUGGLE
|
||||
@name = _INTL("Struggle")
|
||||
@function_code = "Struggle"
|
||||
@power = 50
|
||||
@type = nil
|
||||
@category = 0
|
||||
@accuracy = 0
|
||||
@pp = -1
|
||||
@target = :RandomNearFoe
|
||||
@priority = 0
|
||||
@flags = ["Contact", "CanProtect"]
|
||||
@addlEffect = 0
|
||||
@powerBoost = false
|
||||
@snatched = false
|
||||
end
|
||||
|
||||
def physicalMove?(thisType = nil); return true; end
|
||||
@@ -339,7 +339,7 @@ class Battle::Move::TwoTurnMove < Battle::Move
|
||||
"TwoTurnAttackInvulnerableUnderwater",
|
||||
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
|
||||
"TwoTurnAttackInvulnerableRemoveProtections",
|
||||
"TwoTurnAttackInvulnerableInSkyTargetCannotAct"].include?(@function)
|
||||
"TwoTurnAttackInvulnerableInSkyTargetCannotAct"].include?(@function_code)
|
||||
@battle.pbCommonAnimation("UseItem", user)
|
||||
end
|
||||
@battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!", user.pbThis))
|
||||
@@ -549,7 +549,7 @@ class Battle::Move::PledgeMove < Battle::Move
|
||||
move = @battle.choices[b.index][2]
|
||||
next if !move
|
||||
@combos.each do |i|
|
||||
next if i[0] != move.function
|
||||
next if i[0] != move.function_code
|
||||
@pledgeSetup = true
|
||||
@pledgeOtherUser = b
|
||||
break
|
||||
@@ -584,7 +584,7 @@ class Battle::Move::PledgeMove < Battle::Move
|
||||
return if !@pledgeSetup
|
||||
@battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",
|
||||
user.pbThis, @pledgeOtherUser.pbThis(true)))
|
||||
@pledgeOtherUser.effects[PBEffects::FirstPledge] = @function
|
||||
@pledgeOtherUser.effects[PBEffects::FirstPledge] = @function_code
|
||||
@pledgeOtherUser.effects[PBEffects::MoveNext] = true
|
||||
user.lastMoveFailed = true # Treated as a failure for Stomping Tantrum
|
||||
end
|
||||
|
||||
@@ -198,7 +198,7 @@ class Battle::Move::FailsIfTargetActed < Battle::Move
|
||||
end
|
||||
oppMove = @battle.choices[target.index][2]
|
||||
if !oppMove ||
|
||||
(oppMove.function != "UseMoveTargetIsAboutToUse" &&
|
||||
(oppMove.function_code != "UseMoveTargetIsAboutToUse" &&
|
||||
(target.movedThisRound? || oppMove.statusMove?))
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
|
||||
@@ -343,13 +343,20 @@ end
|
||||
# stage. On the second turn, does damage. (Meteor Beam)
|
||||
#===============================================================================
|
||||
class Battle::Move::TwoTurnAttackChargeRaiseUserSpAtk1 < Battle::Move::TwoTurnMove
|
||||
attr_reader :statUp
|
||||
|
||||
def initialize(battle, move)
|
||||
super
|
||||
@statUp = [:SPECIAL_ATTACK, 1]
|
||||
end
|
||||
|
||||
def pbChargingTurnMessage(user, targets)
|
||||
@battle.pbDisplay(_INTL("{1} is overflowing with space power!", user.pbThis))
|
||||
end
|
||||
|
||||
def pbChargingTurnEffect(user, target)
|
||||
if user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user, self)
|
||||
user.pbRaiseStatStage(:SPECIAL_ATTACK, 1, user)
|
||||
if user.pbCanRaiseStatStage?(@statUp[0], user, self)
|
||||
user.pbRaiseStatStage(@statUp[0], @statUp[1], user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -812,6 +812,8 @@ end
|
||||
# (Me First)
|
||||
#===============================================================================
|
||||
class Battle::Move::UseMoveTargetIsAboutToUse < Battle::Move
|
||||
attr_reader :moveBlacklist
|
||||
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
def callsAnotherMove?; return true; end
|
||||
|
||||
@@ -836,7 +838,7 @@ class Battle::Move::UseMoveTargetIsAboutToUse < Battle::Move
|
||||
def pbFailsAgainstTarget?(user, target, show_message)
|
||||
return true if pbMoveFailedTargetAlreadyMoved?(target, show_message)
|
||||
oppMove = @battle.choices[target.index][2]
|
||||
if !oppMove || oppMove.statusMove? || @moveBlacklist.include?(oppMove.function)
|
||||
if !oppMove || oppMove.statusMove? || @moveBlacklist.include?(oppMove.function_code)
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
@@ -919,6 +921,8 @@ end
|
||||
# Uses a random move that exists. (Metronome)
|
||||
#===============================================================================
|
||||
class Battle::Move::UseRandomMove < Battle::Move
|
||||
attr_reader :moveBlacklist
|
||||
|
||||
def callsAnotherMove?; return true; end
|
||||
|
||||
def initialize(battle, move)
|
||||
@@ -1179,7 +1183,7 @@ class Battle::Move::UseRandomUserMoveIfAsleep < Battle::Move
|
||||
def pbMoveFailed?(user, targets)
|
||||
@sleepTalkMoves = []
|
||||
user.eachMoveWithIndex do |m, i|
|
||||
next if @moveBlacklist.include?(m.function)
|
||||
next if @moveBlacklist.include?(m.function_code)
|
||||
next if !@battle.pbCanChooseMove?(user.index, i, false, true)
|
||||
@sleepTalkMoves.push(i)
|
||||
end
|
||||
|
||||
@@ -477,7 +477,7 @@ class Battle::Move::UsedAfterAllyRoundWithDoublePower < Battle::Move
|
||||
user.pbOwnSide.effects[PBEffects::Round] = true
|
||||
user.allAllies.each do |b|
|
||||
next if @battle.choices[b.index][0] != :UseMove || b.movedThisRound?
|
||||
next if @battle.choices[b.index][2].function != @function
|
||||
next if @battle.choices[b.index][2].function_code != @function_code
|
||||
b.effects[PBEffects::MoveNext] = true
|
||||
b.effects[PBEffects::Quash] = 0
|
||||
break
|
||||
@@ -620,9 +620,9 @@ class Battle::Move::TargetUsesItsLastUsedMoveAgain < Battle::Move
|
||||
return true
|
||||
end
|
||||
targetMove = @battle.choices[target.index][2]
|
||||
if targetMove && (targetMove.function == "FailsIfUserDamagedThisTurn" || # Focus Punch
|
||||
targetMove.function == "UsedAfterUserTakesPhysicalDamage" || # Shell Trap
|
||||
targetMove.function == "BurnAttackerBeforeUserActs") # Beak Blast
|
||||
if targetMove && (targetMove.function_code == "FailsIfUserDamagedThisTurn" || # Focus Punch
|
||||
targetMove.function_code == "UsedAfterUserTakesPhysicalDamage" || # Shell Trap
|
||||
targetMove.function_code == "BurnAttackerBeforeUserActs") # Beak Blast
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user