mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-11 23:24:59 +00:00
Made the Battle Factory work
This commit is contained in:
@@ -19,18 +19,20 @@ class BattleChallenge
|
||||
@id = id
|
||||
@numRounds = numrounds
|
||||
@rules = rules
|
||||
register(id, id[/double/], 3,
|
||||
id[/^factory/] ? BattleFactoryID : BattleTowerID,
|
||||
id[/open$/] ? 1 : 0)
|
||||
pbWriteCup(id, rules)
|
||||
end
|
||||
|
||||
def register(id, doublebattle, numrounds, numPokemon, battletype, mode = 1)
|
||||
def register(id, doublebattle, numPokemon, battletype, mode = 1)
|
||||
ensureType(id)
|
||||
if battletype == BattleFactoryID
|
||||
@bc.setExtraData(BattleFactoryData.new(@bc))
|
||||
numPokemon = 3
|
||||
battletype = BattleTowerID
|
||||
end
|
||||
@numRounds = numrounds
|
||||
@rules = modeToRules(doublebattle, numPokemon, battletype, mode)
|
||||
@rules = modeToRules(doublebattle, numPokemon, battletype, mode) if !@rules
|
||||
end
|
||||
|
||||
def rules
|
||||
@@ -371,7 +373,7 @@ class BattleFactoryData
|
||||
def pbPrepareRentals
|
||||
@rentals = pbBattleFactoryPokemon(pbBattleChallenge.rules, @bcdata.wins, @bcdata.swaps, [])
|
||||
@trainerid = @bcdata.nextTrainer
|
||||
bttrainers = pbGetBTTrainers(@bcdata.currentChallenge)
|
||||
bttrainers = pbGetBTTrainers(pbBattleChallenge.currentChallenge)
|
||||
trainerdata = bttrainers[@trainerid]
|
||||
@opponent = NPCTrainer.new(
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames, trainerdata[1]),
|
||||
@@ -386,19 +388,19 @@ class BattleFactoryData
|
||||
screen = BattleSwapScreen.new(scene)
|
||||
@rentals = screen.pbStartRent(@rentals)
|
||||
@bcdata.pbAddSwap
|
||||
pbBattleChallenge.setParty(@rentals)
|
||||
@bcdata.setParty(@rentals)
|
||||
}
|
||||
end
|
||||
|
||||
def pbPrepareSwaps
|
||||
@oldopponent = @opponent.party
|
||||
trainerid = @bcdata.nextTrainer
|
||||
bttrainers = pbGetBTTrainers(@bcdata.currentChallenge)
|
||||
bttrainers = pbGetBTTrainers(pbBattleChallenge.currentChallenge)
|
||||
trainerdata = bttrainers[trainerid]
|
||||
@opponent = NPCTrainer.new(
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames, trainerdata[1]),
|
||||
trainerdata[0])
|
||||
opponentPkmn = pbBattleFactoryPokemon(challenge.rules, @bcdata.wins, @bcdata.swaps,
|
||||
opponentPkmn = pbBattleFactoryPokemon(pbBattleChallenge.rules, @bcdata.wins, @bcdata.swaps,
|
||||
[].concat(@rentals).concat(@oldopponent))
|
||||
@opponent.party = opponentPkmn.shuffle[0, 3]
|
||||
end
|
||||
@@ -416,7 +418,7 @@ class BattleFactoryData
|
||||
end
|
||||
|
||||
def pbBattle(challenge)
|
||||
bttrainers = pbGetBTTrainers(@bcdata.currentChallenge)
|
||||
bttrainers = pbGetBTTrainers(pbBattleChallenge.currentChallenge)
|
||||
trainerdata = bttrainers[@trainerid]
|
||||
return pbOrganizedBattleEx(@opponent, challenge.rules,
|
||||
pbGetMessageFromHash(MessageTypes::EndSpeechLose, trainerdata[4]),
|
||||
|
||||
Reference in New Issue
Block a user