mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Merge branch 'dev' into ui-redesign
This commit is contained in:
@@ -367,14 +367,14 @@ def get_text_colors_for_windowskin(windowskin, color, isDarkSkin)
|
||||
end
|
||||
# Special colour as listed above
|
||||
if isDarkSkin && color != 12 # Dark background, light text
|
||||
if textcolors[(2 * (color - 1))].is_a?(Color)
|
||||
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)])
|
||||
end
|
||||
# Light background, dark text
|
||||
if textcolors[(2 * (color - 1))].is_a?(Color)
|
||||
return textcolors[(2 * (color - 1))], textcolors[2 * (color - 1) + 1]
|
||||
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])
|
||||
end
|
||||
|
||||
@@ -244,7 +244,7 @@ GameData::Evolution.register({
|
||||
:id => :LevelDarkInParty,
|
||||
:parameter => Integer,
|
||||
: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)
|
||||
# Set Pokémon's properties if defined
|
||||
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]
|
||||
if pkmn_data[:moves] && pkmn_data[:moves].length > 0
|
||||
pkmn_data[:moves].each { |move| pkmn.learn_move(move) }
|
||||
@@ -180,6 +181,8 @@ module GameData
|
||||
elsif trainer.default_poke_ball
|
||||
pkmn.poke_ball = trainer.default_poke_ball
|
||||
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
|
||||
end
|
||||
return trainer
|
||||
|
||||
@@ -162,6 +162,9 @@ class Battle
|
||||
if b.abilityActive?
|
||||
pri = Battle::AbilityEffects.triggerPriorityChange(b.ability, b, move, pri)
|
||||
end
|
||||
if b.itemActive?
|
||||
pri = Battle::ItemEffects.triggerPriorityChange(b.item, b, move, pri)
|
||||
end
|
||||
entry[5] = pri
|
||||
@choices[b.index][4] = pri
|
||||
end
|
||||
@@ -199,6 +202,9 @@ class Battle
|
||||
if entry[0].abilityActive?
|
||||
pri = Battle::AbilityEffects.triggerPriorityChange(entry[0].ability, entry[0], move, pri)
|
||||
end
|
||||
if entry[0].itemActive?
|
||||
pri = Battle::ItemEffects.triggerPriorityChange(entry[0].item, entry[0], move, pri)
|
||||
end
|
||||
needRearranging = true if pri != entry[5]
|
||||
entry[5] = pri
|
||||
choice[4] = pri
|
||||
|
||||
@@ -264,10 +264,12 @@ class Battle::Move
|
||||
oldHP += b.damageState.hpLost
|
||||
end
|
||||
effectiveness = 0
|
||||
if Effectiveness.resistant?(b.damageState.typeMod)
|
||||
effectiveness = 1
|
||||
elsif Effectiveness.super_effective?(b.damageState.typeMod)
|
||||
effectiveness = 2
|
||||
if !self.is_a?(Battle::Move::FixedDamageMove)
|
||||
if Effectiveness.resistant?(b.damageState.typeMod)
|
||||
effectiveness = 1
|
||||
elsif Effectiveness.super_effective?(b.damageState.typeMod)
|
||||
effectiveness = 2
|
||||
end
|
||||
end
|
||||
animArray.push([b, oldHP, effectiveness])
|
||||
end
|
||||
|
||||
@@ -71,6 +71,9 @@ class Battle::AI::AIMove
|
||||
ret = Battle::AbilityEffects.triggerPriorityChange(user.ability, user.battler, @move, ret)
|
||||
user.battler.effects[PBEffects::Prankster] = false # Untrigger this
|
||||
end
|
||||
if user.item_active?
|
||||
ret = Battle::ItemEffects.triggerPriorityChange(user.item, user.battler, @move, ret)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ module Battle::ItemEffects
|
||||
# Battler's stat stages
|
||||
StatLossImmunity = ItemHandlerHash.new
|
||||
# Priority and turn order
|
||||
PriorityChange = ItemHandlerHash.new
|
||||
PriorityBracketChange = ItemHandlerHash.new
|
||||
PriorityBracketUse = ItemHandlerHash.new
|
||||
# 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)
|
||||
return trigger(PriorityBracketChange, item, battler, battle, ret: 0)
|
||||
end
|
||||
@@ -647,6 +652,12 @@ Battle::ItemEffects::StatLossImmunity.add(:CLEARAMULET,
|
||||
}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# PriorityChange handlers
|
||||
#===============================================================================
|
||||
|
||||
# There aren't any!
|
||||
|
||||
#===============================================================================
|
||||
# PriorityBracketChange handlers
|
||||
#===============================================================================
|
||||
|
||||
@@ -21,7 +21,7 @@ end
|
||||
def pbResetAllRoamers
|
||||
return if !$PokemonGlobal.roamPokemon
|
||||
$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
|
||||
end
|
||||
end
|
||||
|
||||
@@ -891,7 +891,7 @@ MultipleForms.register(:QUILAVA, {
|
||||
})
|
||||
|
||||
MultipleForms.copy(:QUILAVA,
|
||||
:DEWOTT, :PETILILL, :RUFFLET, :GOOMY, :BERGMITE, :DARTRIX)
|
||||
:DEWOTT, :PETILIL, :RUFFLET, :GOOMY, :BERGMITE, :DARTRIX)
|
||||
|
||||
# Paldean forms.
|
||||
# None!
|
||||
|
||||
@@ -10,7 +10,7 @@ class Trainer
|
||||
|
||||
def inspect
|
||||
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)
|
||||
return str
|
||||
end
|
||||
@@ -56,11 +56,11 @@ class Trainer
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
def pokemon_party
|
||||
return @party.find_all { |p| p && !p.egg? }
|
||||
return @party.find_all { |pkmn| pkmn && !pkmn.egg? }
|
||||
end
|
||||
|
||||
def able_party
|
||||
return @party.find_all { |p| p && !p.egg? && !p.fainted? }
|
||||
return @party.find_all { |pkmn| pkmn && !pkmn.egg? && !pkmn.fainted? }
|
||||
end
|
||||
|
||||
def party_count
|
||||
@@ -69,13 +69,13 @@ class Trainer
|
||||
|
||||
def pokemon_count
|
||||
ret = 0
|
||||
@party.each { |p| ret += 1 if p && !p.egg? }
|
||||
@party.each { |pkmn| ret += 1 if pkmn && !pkmn.egg? }
|
||||
return ret
|
||||
end
|
||||
|
||||
def able_pokemon_count
|
||||
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
|
||||
end
|
||||
|
||||
@@ -105,13 +105,13 @@ class Trainer
|
||||
end
|
||||
|
||||
def last_pokemon
|
||||
p = pokemon_party
|
||||
return (p.length > 0) ? p[p.length - 1] : nil
|
||||
pkmn = pokemon_party
|
||||
return (pkmn.length > 0) ? pkmn[pkmn.length - 1] : nil
|
||||
end
|
||||
|
||||
def last_able_pokemon
|
||||
p = able_party
|
||||
return (p.length > 0) ? p[p.length - 1] : nil
|
||||
pkmn = able_party
|
||||
return (pkmn.length > 0) ? pkmn[pkmn.length - 1] : nil
|
||||
end
|
||||
|
||||
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
|
||||
# party. You may also specify a particular form it should be.
|
||||
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
|
||||
|
||||
# Returns whether there is a fatefully met Pokémon of the given species in the
|
||||
# trainer's party.
|
||||
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
|
||||
|
||||
# Returns whether there is a Pokémon with the given type in the trainer's
|
||||
# party.
|
||||
def has_pokemon_of_type?(type)
|
||||
# party. excluded_pokemon is an array of Pokemon objects to ignore.
|
||||
def has_pokemon_of_type?(type, excluded_pokemon = [])
|
||||
return false if !GameData::Type.exists?(type)
|
||||
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
|
||||
|
||||
# Checks whether any Pokémon in the party knows the given move, and returns
|
||||
|
||||
@@ -527,7 +527,7 @@ def pbTrainerBattleEditor
|
||||
:trainer_type => data[0],
|
||||
:real_name => data[1],
|
||||
:version => data[2],
|
||||
:lose_text => data[3],
|
||||
:real_lose_text => data[3],
|
||||
:pokemon => party,
|
||||
:items => items,
|
||||
:pbs_file_suffix => tr_data.pbs_file_suffix
|
||||
|
||||
Reference in New Issue
Block a user