mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Some bug fixes, added PriorityChange item handler
This commit is contained in:
@@ -369,9 +369,15 @@ def get_text_colors_for_windowskin(windowskin, color, isDarkSkin)
|
|||||||
end
|
end
|
||||||
# Special colour as listed above
|
# Special colour as listed above
|
||||||
if isDarkSkin && color != 12 # Dark background, light text
|
if isDarkSkin && color != 12 # Dark background, light text
|
||||||
|
if textcolors[2 * (color - 1)].is_a?(Color)
|
||||||
|
return textcolors[(2 * (color - 1)) + 1], textcolors[2 * (color - 1)]
|
||||||
|
end
|
||||||
return Color.new(*textcolors[(2 * (color - 1)) + 1]), Color.new(*textcolors[2 * (color - 1)])
|
return Color.new(*textcolors[(2 * (color - 1)) + 1]), Color.new(*textcolors[2 * (color - 1)])
|
||||||
end
|
end
|
||||||
# Light background, dark text
|
# Light background, dark text
|
||||||
|
if textcolors[2 * (color - 1)].is_a?(Color)
|
||||||
|
return textcolors[2 * (color - 1)], textcolors[2 * (color - 1) + 1]
|
||||||
|
end
|
||||||
return Color.new(*textcolors[2 * (color - 1)]), Color.new(*textcolors[(2 * (color - 1)) + 1])
|
return Color.new(*textcolors[2 * (color - 1)]), Color.new(*textcolors[(2 * (color - 1)) + 1])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ GameData::Evolution.register({
|
|||||||
:id => :LevelDarkInParty,
|
:id => :LevelDarkInParty,
|
||||||
:parameter => Integer,
|
:parameter => Integer,
|
||||||
:level_up_proc => proc { |pkmn, parameter|
|
:level_up_proc => proc { |pkmn, parameter|
|
||||||
next pkmn.level >= parameter && $player.has_pokemon_of_type?(:DARK)
|
next pkmn.level >= parameter && $player.has_pokemon_of_type?(:DARK, [pkmn])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ module GameData
|
|||||||
trainer.party.push(pkmn)
|
trainer.party.push(pkmn)
|
||||||
# Set Pokémon's properties if defined
|
# Set Pokémon's properties if defined
|
||||||
pkmn.form_simple = pkmn_data[:form] if pkmn_data[:form]
|
pkmn.form_simple = pkmn_data[:form] if pkmn_data[:form]
|
||||||
|
pkmn.time_form_set = pbGetTimeNow.to_i # To allow Furfrou/Hoopa alternate forms
|
||||||
pkmn.item = pkmn_data[:item]
|
pkmn.item = pkmn_data[:item]
|
||||||
if pkmn_data[:moves] && pkmn_data[:moves].length > 0
|
if pkmn_data[:moves] && pkmn_data[:moves].length > 0
|
||||||
pkmn_data[:moves].each { |move| pkmn.learn_move(move) }
|
pkmn_data[:moves].each { |move| pkmn.learn_move(move) }
|
||||||
@@ -180,6 +181,8 @@ module GameData
|
|||||||
elsif trainer.default_poke_ball
|
elsif trainer.default_poke_ball
|
||||||
pkmn.poke_ball = trainer.default_poke_ball
|
pkmn.poke_ball = trainer.default_poke_ball
|
||||||
end
|
end
|
||||||
|
pkmn.form # Called just to recalculate it in case a defined property has changed it, e.g. gender for Espurr
|
||||||
|
pkmn.reset_moves if !pkmn_data[:moves] || pkmn_data[:moves].empty? # In case form changed
|
||||||
pkmn.calc_stats
|
pkmn.calc_stats
|
||||||
end
|
end
|
||||||
return trainer
|
return trainer
|
||||||
|
|||||||
@@ -162,6 +162,9 @@ class Battle
|
|||||||
if b.abilityActive?
|
if b.abilityActive?
|
||||||
pri = Battle::AbilityEffects.triggerPriorityChange(b.ability, b, move, pri)
|
pri = Battle::AbilityEffects.triggerPriorityChange(b.ability, b, move, pri)
|
||||||
end
|
end
|
||||||
|
if b.itemActive?
|
||||||
|
pri = Battle::ItemEffects.triggerPriorityChange(b.item, b, move, pri)
|
||||||
|
end
|
||||||
entry[5] = pri
|
entry[5] = pri
|
||||||
@choices[b.index][4] = pri
|
@choices[b.index][4] = pri
|
||||||
end
|
end
|
||||||
@@ -199,6 +202,9 @@ class Battle
|
|||||||
if entry[0].abilityActive?
|
if entry[0].abilityActive?
|
||||||
pri = Battle::AbilityEffects.triggerPriorityChange(entry[0].ability, entry[0], move, pri)
|
pri = Battle::AbilityEffects.triggerPriorityChange(entry[0].ability, entry[0], move, pri)
|
||||||
end
|
end
|
||||||
|
if entry[0].itemActive?
|
||||||
|
pri = Battle::ItemEffects.triggerPriorityChange(entry[0].item, entry[0], move, pri)
|
||||||
|
end
|
||||||
needRearranging = true if pri != entry[5]
|
needRearranging = true if pri != entry[5]
|
||||||
entry[5] = pri
|
entry[5] = pri
|
||||||
choice[4] = pri
|
choice[4] = pri
|
||||||
|
|||||||
@@ -266,10 +266,12 @@ class Battle::Move
|
|||||||
oldHP += b.damageState.hpLost
|
oldHP += b.damageState.hpLost
|
||||||
end
|
end
|
||||||
effectiveness = 0
|
effectiveness = 0
|
||||||
if Effectiveness.resistant?(b.damageState.typeMod)
|
if !self.is_a?(Battle::Move::FixedDamageMove)
|
||||||
effectiveness = 1
|
if Effectiveness.resistant?(b.damageState.typeMod)
|
||||||
elsif Effectiveness.super_effective?(b.damageState.typeMod)
|
effectiveness = 1
|
||||||
effectiveness = 2
|
elsif Effectiveness.super_effective?(b.damageState.typeMod)
|
||||||
|
effectiveness = 2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
animArray.push([b, oldHP, effectiveness])
|
animArray.push([b, oldHP, effectiveness])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ class Battle::AI::AIMove
|
|||||||
ret = Battle::AbilityEffects.triggerPriorityChange(user.ability, user.battler, @move, ret)
|
ret = Battle::AbilityEffects.triggerPriorityChange(user.ability, user.battler, @move, ret)
|
||||||
user.battler.effects[PBEffects::Prankster] = false # Untrigger this
|
user.battler.effects[PBEffects::Prankster] = false # Untrigger this
|
||||||
end
|
end
|
||||||
|
if user.item_active?
|
||||||
|
ret = Battle::ItemEffects.triggerPriorityChange(user.item, user.battler, @move, ret)
|
||||||
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ module Battle::ItemEffects
|
|||||||
# Battler's stat stages
|
# Battler's stat stages
|
||||||
StatLossImmunity = ItemHandlerHash.new
|
StatLossImmunity = ItemHandlerHash.new
|
||||||
# Priority and turn order
|
# Priority and turn order
|
||||||
|
PriorityChange = ItemHandlerHash.new
|
||||||
PriorityBracketChange = ItemHandlerHash.new
|
PriorityBracketChange = ItemHandlerHash.new
|
||||||
PriorityBracketUse = ItemHandlerHash.new
|
PriorityBracketUse = ItemHandlerHash.new
|
||||||
# Move usage failures
|
# Move usage failures
|
||||||
@@ -91,6 +92,10 @@ module Battle::ItemEffects
|
|||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def self.triggerPriorityChange(item, battler, move, priority)
|
||||||
|
return trigger(PriorityChange, item, battler, move, priority, ret: priority)
|
||||||
|
end
|
||||||
|
|
||||||
def self.triggerPriorityBracketChange(item, battler, battle)
|
def self.triggerPriorityBracketChange(item, battler, battle)
|
||||||
return trigger(PriorityBracketChange, item, battler, battle, ret: 0)
|
return trigger(PriorityBracketChange, item, battler, battle, ret: 0)
|
||||||
end
|
end
|
||||||
@@ -647,6 +652,12 @@ Battle::ItemEffects::StatLossImmunity.add(:CLEARAMULET,
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# PriorityChange handlers
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
# There aren't any!
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# PriorityBracketChange handlers
|
# PriorityBracketChange handlers
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ end
|
|||||||
def pbResetAllRoamers
|
def pbResetAllRoamers
|
||||||
return if !$PokemonGlobal.roamPokemon
|
return if !$PokemonGlobal.roamPokemon
|
||||||
$PokemonGlobal.roamPokemon.length.times do |i|
|
$PokemonGlobal.roamPokemon.length.times do |i|
|
||||||
next if $PokemonGlobal.roamPokemon[i] != true || !$PokemonGlobal.roamPokemonCaught[i]
|
next if $PokemonGlobal.roamPokemon[i] != true || $PokemonGlobal.roamPokemonCaught[i]
|
||||||
$PokemonGlobal.roamPokemon[i] = nil
|
$PokemonGlobal.roamPokemon[i] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -891,7 +891,7 @@ MultipleForms.register(:QUILAVA, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
MultipleForms.copy(:QUILAVA,
|
MultipleForms.copy(:QUILAVA,
|
||||||
:DEWOTT, :PETILILL, :RUFFLET, :GOOMY, :BERGMITE, :DARTRIX)
|
:DEWOTT, :PETILIL, :RUFFLET, :GOOMY, :BERGMITE, :DARTRIX)
|
||||||
|
|
||||||
# Paldean forms
|
# Paldean forms
|
||||||
# None!
|
# None!
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Trainer
|
|||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
str = super.chop
|
str = super.chop
|
||||||
party_str = @party.map { |p| p.species_data.species }.inspect
|
party_str = @party.map { |pkmn| pkmn.species_data.species }.inspect
|
||||||
str << sprintf(" %s @party=%s>", self.full_name, party_str)
|
str << sprintf(" %s @party=%s>", self.full_name, party_str)
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
@@ -56,11 +56,11 @@ class Trainer
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
def pokemon_party
|
def pokemon_party
|
||||||
return @party.find_all { |p| p && !p.egg? }
|
return @party.find_all { |pkmn| pkmn && !pkmn.egg? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def able_party
|
def able_party
|
||||||
return @party.find_all { |p| p && !p.egg? && !p.fainted? }
|
return @party.find_all { |pkmn| pkmn && !pkmn.egg? && !pkmn.fainted? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def party_count
|
def party_count
|
||||||
@@ -69,13 +69,13 @@ class Trainer
|
|||||||
|
|
||||||
def pokemon_count
|
def pokemon_count
|
||||||
ret = 0
|
ret = 0
|
||||||
@party.each { |p| ret += 1 if p && !p.egg? }
|
@party.each { |pkmn| ret += 1 if pkmn && !pkmn.egg? }
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def able_pokemon_count
|
def able_pokemon_count
|
||||||
ret = 0
|
ret = 0
|
||||||
@party.each { |p| ret += 1 if p && !p.egg? && !p.fainted? }
|
@party.each { |pkmn| ret += 1 if pkmn && !pkmn.egg? && !pkmn.fainted? }
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -105,13 +105,13 @@ class Trainer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def last_pokemon
|
def last_pokemon
|
||||||
p = pokemon_party
|
pkmn = pokemon_party
|
||||||
return (p.length > 0) ? p[p.length - 1] : nil
|
return (pkmn.length > 0) ? pkmn[pkmn.length - 1] : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def last_able_pokemon
|
def last_able_pokemon
|
||||||
p = able_party
|
pkmn = able_party
|
||||||
return (p.length > 0) ? p[p.length - 1] : nil
|
return (pkmn.length > 0) ? pkmn[pkmn.length - 1] : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_pokemon_at_index(index)
|
def remove_pokemon_at_index(index)
|
||||||
@@ -136,21 +136,21 @@ class Trainer
|
|||||||
# Returns true if there is a Pokémon of the given species in the trainer's
|
# Returns true if there is a Pokémon of the given species in the trainer's
|
||||||
# party. You may also specify a particular form it should be.
|
# party. You may also specify a particular form it should be.
|
||||||
def has_species?(species, form = -1)
|
def has_species?(species, form = -1)
|
||||||
return pokemon_party.any? { |p| p&.isSpecies?(species) && (form < 0 || p.form == form) }
|
return pokemon_party.any? { |pkmn| pkmn&.isSpecies?(species) && (form < 0 || pkmn.form == form) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether there is a fatefully met Pokémon of the given species in the
|
# Returns whether there is a fatefully met Pokémon of the given species in the
|
||||||
# trainer's party.
|
# trainer's party.
|
||||||
def has_fateful_species?(species)
|
def has_fateful_species?(species)
|
||||||
return pokemon_party.any? { |p| p&.isSpecies?(species) && p.obtain_method == 4 }
|
return pokemon_party.any? { |pkmn| pkmn&.isSpecies?(species) && pkmn.obtain_method == 4 }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether there is a Pokémon with the given type in the trainer's
|
# Returns whether there is a Pokémon with the given type in the trainer's
|
||||||
# party.
|
# party. excluded_pokemon is an array of Pokemon objects to ignore.
|
||||||
def has_pokemon_of_type?(type)
|
def has_pokemon_of_type?(type, excluded_pokemon = [])
|
||||||
return false if !GameData::Type.exists?(type)
|
return false if !GameData::Type.exists?(type)
|
||||||
type = GameData::Type.get(type).id
|
type = GameData::Type.get(type).id
|
||||||
return pokemon_party.any? { |p| p&.hasType?(type) }
|
return pokemon_party.any? { |pkmn| pkmn&.hasType?(type) && !excluded_pokemon.include?(pkmn) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checks whether any Pokémon in the party knows the given move, and returns
|
# Checks whether any Pokémon in the party knows the given move, and returns
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ def pbTrainerBattleEditor
|
|||||||
:trainer_type => data[0],
|
:trainer_type => data[0],
|
||||||
:real_name => data[1],
|
:real_name => data[1],
|
||||||
:version => data[2],
|
:version => data[2],
|
||||||
:lose_text => data[3],
|
:real_lose_text => data[3],
|
||||||
:pokemon => party,
|
:pokemon => party,
|
||||||
:items => items,
|
:items => items,
|
||||||
:pbs_file_suffix => tr_data.pbs_file_suffix
|
:pbs_file_suffix => tr_data.pbs_file_suffix
|
||||||
|
|||||||
Reference in New Issue
Block a user