mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Now loads language files on startup if Settings::LANGUAGES has exactly 1 defined language, fixed instant text speed after a wait in a message, added battle rule "cannotSwitch"
This commit is contained in:
@@ -28,8 +28,8 @@ module Game
|
|||||||
# Set resize factor
|
# Set resize factor
|
||||||
pbSetResizeFactor([$PokemonSystem.screensize, 4].min)
|
pbSetResizeFactor([$PokemonSystem.screensize, 4].min)
|
||||||
# Set language (and choose language if there is no save file)
|
# Set language (and choose language if there is no save file)
|
||||||
if Settings::LANGUAGES.length >= 2
|
if !Settings::LANGUAGES.empty?
|
||||||
$PokemonSystem.language = pbChooseLanguage if save_data.empty?
|
$PokemonSystem.language = pbChooseLanguage if save_data.empty? && Settings::LANGUAGES.length >= 2
|
||||||
MessageTypes.load_message_files(Settings::LANGUAGES[$PokemonSystem.language][1])
|
MessageTypes.load_message_files(Settings::LANGUAGES[$PokemonSystem.language][1])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -588,6 +588,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
|||||||
if System.uptime - @wait_timer_start >= @waitcount
|
if System.uptime - @wait_timer_start >= @waitcount
|
||||||
@wait_timer_start = nil
|
@wait_timer_start = nil
|
||||||
@waitcount = 0
|
@waitcount = 0
|
||||||
|
@display_last_updated = nil
|
||||||
end
|
end
|
||||||
return if @wait_timer_start
|
return if @wait_timer_start
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class Battle
|
|||||||
attr_accessor :debug # Debug flag
|
attr_accessor :debug # Debug flag
|
||||||
attr_accessor :canRun # True if player can run from battle
|
attr_accessor :canRun # True if player can run from battle
|
||||||
attr_accessor :canLose # True if player won't black out if they lose
|
attr_accessor :canLose # True if player won't black out if they lose
|
||||||
|
attr_accessor :canSwitch # True if player is allowed to switch Pokémon
|
||||||
attr_accessor :switchStyle # Switch/Set "battle style" option
|
attr_accessor :switchStyle # Switch/Set "battle style" option
|
||||||
attr_accessor :showAnims # "Battle Effects" option
|
attr_accessor :showAnims # "Battle Effects" option
|
||||||
attr_accessor :controlPlayer # Whether player's Pokémon are AI controlled
|
attr_accessor :controlPlayer # Whether player's Pokémon are AI controlled
|
||||||
@@ -131,6 +132,7 @@ class Battle
|
|||||||
@debug = false
|
@debug = false
|
||||||
@canRun = true
|
@canRun = true
|
||||||
@canLose = false
|
@canLose = false
|
||||||
|
@canSwitch = true
|
||||||
@switchStyle = true
|
@switchStyle = true
|
||||||
@showAnims = true
|
@showAnims = true
|
||||||
@controlPlayer = false
|
@controlPlayer = false
|
||||||
|
|||||||
@@ -165,7 +165,8 @@ class Battle::Scene
|
|||||||
cmdBoxes = -1
|
cmdBoxes = -1
|
||||||
cmdSummary = -1
|
cmdSummary = -1
|
||||||
commands = []
|
commands = []
|
||||||
commands[cmdSwitch = commands.length] = _INTL("Switch In") if mode == 0 && modParty[idxParty].able?
|
commands[cmdSwitch = commands.length] = _INTL("Switch In") if mode == 0 && modParty[idxParty].able? &&
|
||||||
|
(@battle.canSwitch || !canCancel)
|
||||||
commands[cmdBoxes = commands.length] = _INTL("Send to Boxes") if mode == 1
|
commands[cmdBoxes = commands.length] = _INTL("Send to Boxes") if mode == 1
|
||||||
commands[cmdSummary = commands.length] = _INTL("Summary")
|
commands[cmdSummary = commands.length] = _INTL("Summary")
|
||||||
commands[commands.length] = _INTL("Cancel")
|
commands[commands.length] = _INTL("Cancel")
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
class Battle::AI
|
class Battle::AI
|
||||||
# Called by the AI's def pbDefaultChooseEnemyCommand, and by def pbChooseMove
|
# Called by the AI's def pbDefaultChooseEnemyCommand, and by def pbChooseMove
|
||||||
# if the only moves known are bad ones (the latter forces a switch). Also
|
# if the only moves known are bad ones (the latter forces a switch if
|
||||||
# aliased by the Battle Palace and Battle Arena.
|
# possible). Also aliased by the Battle Palace and Battle Arena.
|
||||||
def pbChooseToSwitchOut(force_switch = false)
|
def pbChooseToSwitchOut(terrible_moves = false)
|
||||||
|
return false if !@battle.canSwitch # Battle rule
|
||||||
return false if @user.wild?
|
return false if @user.wild?
|
||||||
return false if !@battle.pbCanSwitchOut?(@user.index)
|
return false if !@battle.pbCanSwitchOut?(@user.index)
|
||||||
# Don't switch if all foes are unable to do anything, e.g. resting after
|
# Don't switch if all foes are unable to do anything, e.g. resting after
|
||||||
@@ -20,7 +21,7 @@ class Battle::AI
|
|||||||
return false if !foe_can_act
|
return false if !foe_can_act
|
||||||
end
|
end
|
||||||
# Various calculations to decide whether to switch
|
# Various calculations to decide whether to switch
|
||||||
if force_switch
|
if terrible_moves
|
||||||
PBDebug.log_ai("#{@user.name} is being forced to switch out")
|
PBDebug.log_ai("#{@user.name} is being forced to switch out")
|
||||||
else
|
else
|
||||||
return false if !@trainer.has_skill_flag?("ConsiderSwitching")
|
return false if !@trainer.has_skill_flag?("ConsiderSwitching")
|
||||||
@@ -33,7 +34,7 @@ class Battle::AI
|
|||||||
return false if !should_switch
|
return false if !should_switch
|
||||||
end
|
end
|
||||||
# Want to switch; find the best replacement Pokémon
|
# Want to switch; find the best replacement Pokémon
|
||||||
idxParty = choose_best_replacement_pokemon(@user.index, force_switch)
|
idxParty = choose_best_replacement_pokemon(@user.index, terrible_moves)
|
||||||
if idxParty < 0 # No good replacement Pokémon found
|
if idxParty < 0 # No good replacement Pokémon found
|
||||||
PBDebug.log(" => no good replacement Pokémon, will not switch after all")
|
PBDebug.log(" => no good replacement Pokémon, will not switch after all")
|
||||||
return false
|
return false
|
||||||
@@ -66,14 +67,14 @@ class Battle::AI
|
|||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
def choose_best_replacement_pokemon(idxBattler, mandatory = false)
|
def choose_best_replacement_pokemon(idxBattler, terrible_moves = false)
|
||||||
# Get all possible replacement Pokémon
|
# Get all possible replacement Pokémon
|
||||||
party = @battle.pbParty(idxBattler)
|
party = @battle.pbParty(idxBattler)
|
||||||
idxPartyStart, idxPartyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
idxPartyStart, idxPartyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||||
reserves = []
|
reserves = []
|
||||||
party.each_with_index do |_pkmn, i|
|
party.each_with_index do |_pkmn, i|
|
||||||
next if !@battle.pbCanSwitchIn?(idxBattler, i)
|
next if !@battle.pbCanSwitchIn?(idxBattler, i)
|
||||||
if !mandatory # Not mandatory means choosing an action for the round
|
if !terrible_moves # Not terrible_moves means choosing an action for the round
|
||||||
ally_will_switch_with_i = false
|
ally_will_switch_with_i = false
|
||||||
@battle.allSameSideBattlers(idxBattler).each do |b|
|
@battle.allSameSideBattlers(idxBattler).each do |b|
|
||||||
next if @battle.choices[b.index][0] != :SwitchOut || @battle.choices[b.index][1] != i
|
next if @battle.choices[b.index][0] != :SwitchOut || @battle.choices[b.index][1] != i
|
||||||
@@ -84,7 +85,7 @@ class Battle::AI
|
|||||||
end
|
end
|
||||||
# Ignore ace if possible
|
# Ignore ace if possible
|
||||||
if @trainer.has_skill_flag?("ReserveLastPokemon") && i == idxPartyEnd - 1
|
if @trainer.has_skill_flag?("ReserveLastPokemon") && i == idxPartyEnd - 1
|
||||||
next if !mandatory || reserves.length > 0
|
next if !terrible_moves || reserves.length > 0
|
||||||
end
|
end
|
||||||
reserves.push([i, 100])
|
reserves.push([i, 100])
|
||||||
break if @trainer.has_skill_flag?("UsePokemonInOrder") && reserves.length > 0
|
break if @trainer.has_skill_flag?("UsePokemonInOrder") && reserves.length > 0
|
||||||
@@ -96,7 +97,7 @@ class Battle::AI
|
|||||||
end
|
end
|
||||||
reserves.sort! { |a, b| b[1] <=> a[1] } # Sort from highest to lowest rated
|
reserves.sort! { |a, b| b[1] <=> a[1] } # Sort from highest to lowest rated
|
||||||
# Don't bother choosing to switch if all replacements are poorly rated
|
# Don't bother choosing to switch if all replacements are poorly rated
|
||||||
if @trainer.high_skill? && !mandatory
|
if @trainer.high_skill? && !terrible_moves
|
||||||
return -1 if reserves[0][1] < 100 # If best replacement rated at <100, don't switch
|
return -1 if reserves[0][1] < 100 # If best replacement rated at <100, don't switch
|
||||||
end
|
end
|
||||||
# Return the party index of the best rated replacement Pokémon
|
# Return the party index of the best rated replacement Pokémon
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ class Game_Temp
|
|||||||
when "canrun" then rules["canRun"] = true
|
when "canrun" then rules["canRun"] = true
|
||||||
when "cannotrun" then rules["canRun"] = false
|
when "cannotrun" then rules["canRun"] = false
|
||||||
when "roamerflees" then rules["roamerFlees"] = true
|
when "roamerflees" then rules["roamerFlees"] = true
|
||||||
|
when "canswitch" then rules["canSwitch"] = true
|
||||||
|
when "cannotswitch" then rules["canSwitch"] = false
|
||||||
when "noexp" then rules["expGain"] = false
|
when "noexp" then rules["expGain"] = false
|
||||||
when "nomoney" then rules["moneyGain"] = false
|
when "nomoney" then rules["moneyGain"] = false
|
||||||
when "disablepokeballs" then rules["disablePokeBalls"] = true
|
when "disablepokeballs" then rules["disablePokeBalls"] = true
|
||||||
@@ -211,6 +213,8 @@ module BattleCreationHelperMethods
|
|||||||
battle.canLose = battleRules["canLose"] if !battleRules["canLose"].nil?
|
battle.canLose = battleRules["canLose"] if !battleRules["canLose"].nil?
|
||||||
# Whether the player can choose to run from the battle (default: true)
|
# Whether the player can choose to run from the battle (default: true)
|
||||||
battle.canRun = battleRules["canRun"] if !battleRules["canRun"].nil?
|
battle.canRun = battleRules["canRun"] if !battleRules["canRun"].nil?
|
||||||
|
# Whether the player can manually choose to switch out Pokémon (default: true)
|
||||||
|
battle.canSwitch = battleRules["canSwitch"] if !battleRules["canSwitch"].nil?
|
||||||
# Whether wild Pokémon always try to run from battle (default: nil)
|
# Whether wild Pokémon always try to run from battle (default: nil)
|
||||||
battle.rules["alwaysflee"] = battleRules["roamerFlees"]
|
battle.rules["alwaysflee"] = battleRules["roamerFlees"]
|
||||||
# Whether Pokémon gain Exp/EVs from defeating/catching a Pokémon (default: true)
|
# Whether Pokémon gain Exp/EVs from defeating/catching a Pokémon (default: true)
|
||||||
|
|||||||
Reference in New Issue
Block a user