mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Added battle rule "disablePokeBalls"
This commit is contained in:
@@ -68,6 +68,7 @@ class Battle
|
||||
attr_accessor :controlPlayer # Whether player's Pokémon are AI controlled
|
||||
attr_accessor :expGain # Whether Pokémon can gain Exp/EVs
|
||||
attr_accessor :moneyGain # Whether the player can gain/lose money
|
||||
attr_accessor :disablePokeBalls # Whether Poké Balls cannot be thrown at all
|
||||
attr_accessor :rules
|
||||
attr_accessor :choices # Choices made by each Pokémon this round
|
||||
attr_accessor :megaEvolution # Battle index of each trainer's Pokémon to Mega Evolve
|
||||
@@ -138,6 +139,7 @@ class Battle
|
||||
@controlPlayer = false
|
||||
@expGain = true
|
||||
@moneyGain = true
|
||||
@disablePokeBalls = false
|
||||
@rules = {}
|
||||
@priority = []
|
||||
@priorityTrickRoom = false
|
||||
|
||||
@@ -32,30 +32,28 @@ class Game_Temp
|
||||
when "single", "1v1", "1v2", "2v1", "1v3", "3v1",
|
||||
"double", "2v2", "2v3", "3v2", "triple", "3v3"
|
||||
rules["size"] = rule.to_s.downcase
|
||||
when "canlose" then rules["canLose"] = true
|
||||
when "cannotlose" then rules["canLose"] = false
|
||||
when "canrun" then rules["canRun"] = true
|
||||
when "cannotrun" then rules["canRun"] = false
|
||||
when "roamerflees" then rules["roamerFlees"] = true
|
||||
when "noexp" then rules["expGain"] = false
|
||||
when "nomoney" then rules["moneyGain"] = false
|
||||
when "switchstyle" then rules["switchStyle"] = true
|
||||
when "setstyle" then rules["switchStyle"] = false
|
||||
when "anims" then rules["battleAnims"] = true
|
||||
when "noanims" then rules["battleAnims"] = false
|
||||
when "canlose" then rules["canLose"] = true
|
||||
when "cannotlose" then rules["canLose"] = false
|
||||
when "canrun" then rules["canRun"] = true
|
||||
when "cannotrun" then rules["canRun"] = false
|
||||
when "roamerflees" then rules["roamerFlees"] = true
|
||||
when "noexp" then rules["expGain"] = false
|
||||
when "nomoney" then rules["moneyGain"] = false
|
||||
when "disablepokeballs" then rules["disablePokeBalls"] = true
|
||||
when "switchstyle" then rules["switchStyle"] = true
|
||||
when "setstyle" then rules["switchStyle"] = false
|
||||
when "anims" then rules["battleAnims"] = true
|
||||
when "noanims" then rules["battleAnims"] = false
|
||||
when "terrain"
|
||||
terrain_data = GameData::BattleTerrain.try_get(var)
|
||||
rules["defaultTerrain"] = (terrain_data) ? terrain_data.id : nil
|
||||
rules["defaultTerrain"] = GameData::BattleTerrain.try_get(var)&.id
|
||||
when "weather"
|
||||
weather_data = GameData::BattleWeather.try_get(var)
|
||||
rules["defaultWeather"] = (weather_data) ? weather_data.id : nil
|
||||
rules["defaultWeather"] = GameData::BattleWeather.try_get(var)&.id
|
||||
when "environment", "environ"
|
||||
environment_data = GameData::Environment.try_get(var)
|
||||
rules["environment"] = (environment_data) ? environment_data.id : nil
|
||||
when "backdrop", "battleback" then rules["backdrop"] = var
|
||||
when "base" then rules["base"] = var
|
||||
when "outcome", "outcomevar" then rules["outcomeVar"] = var
|
||||
when "nopartner" then rules["noPartner"] = true
|
||||
rules["environment"] = GameData::Environment.try_get(var)&.id
|
||||
when "backdrop", "battleback" then rules["backdrop"] = var
|
||||
when "base" then rules["base"] = var
|
||||
when "outcome", "outcomevar" then rules["outcomeVar"] = var
|
||||
when "nopartner" then rules["noPartner"] = true
|
||||
else
|
||||
raise _INTL("Battle rule \"{1}\" does not exist.", rule)
|
||||
end
|
||||
@@ -102,6 +100,8 @@ def pbPrepareBattle(battle)
|
||||
battle.expGain = battleRules["expGain"] if !battleRules["expGain"].nil?
|
||||
# Whether the player gains/loses money at the end of the battle (default: true)
|
||||
battle.moneyGain = battleRules["moneyGain"] if !battleRules["moneyGain"].nil?
|
||||
# Whether Poké Balls cannot be thrown at all
|
||||
battle.disablePokeBalls = battleRules["disablePokeBalls"] if !battleRules["disablePokeBalls"].nil?
|
||||
# Whether the player is able to switch when an opponent's Pokémon faints
|
||||
battle.switchStyle = ($PokemonSystem.battlestyle == 0)
|
||||
battle.switchStyle = battleRules["switchStyle"] if !battleRules["switchStyle"].nil?
|
||||
|
||||
@@ -31,6 +31,10 @@ ItemHandlers::CanUseInBattle.addIf(proc { |item| GameData::Item.get(item).is_pok
|
||||
scene.pbDisplay(_INTL("There is no room left in the PC!")) if showMessages
|
||||
next false
|
||||
end
|
||||
if battle.disablePokeBalls
|
||||
scene.pbDisplay(_INTL("You can't throw a Poké Ball!")) if showMessages
|
||||
next false
|
||||
end
|
||||
# NOTE: Using a Poké Ball consumes all your actions for the round. The code
|
||||
# below is one half of making this happen; the other half is in def
|
||||
# pbItemUsesAllActions?.
|
||||
@@ -50,7 +54,7 @@ ItemHandlers::CanUseInBattle.addIf(proc { |item| GameData::Item.get(item).is_pok
|
||||
if battle.pbOpposingBattlerCount == 2
|
||||
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are two Pokémon!")) if showMessages
|
||||
elsif showMessages
|
||||
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are more than one Pokémon!"))
|
||||
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there is more than one Pokémon!"))
|
||||
end
|
||||
next false
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user