diff --git a/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb b/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb index c10c9789d..125fab6ef 100644 --- a/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb +++ b/Data/Scripts/007_Objects and windows/005_SpriteWindow_text.rb @@ -1349,7 +1349,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand @commands[index],self.baseColor,self.shadowColor) else chars=getFormattedText( - self.contents,rect.x,rect.y,rect.width,rect.height, + self.contents,rect.x,rect.y+4,rect.width,rect.height, @commands[index],rect.height,true,true) drawFormattedChars(self.contents,chars) end diff --git a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/001_Challenge_BattleChallenge.rb b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/001_Challenge_BattleChallenge.rb index e1aaab862..d3a5b20d9 100644 --- a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/001_Challenge_BattleChallenge.rb +++ b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/001_Challenge_BattleChallenge.rb @@ -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]), diff --git a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/003_Challenge_ChooseFoes.rb b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/003_Challenge_ChooseFoes.rb index 4639246cb..fa4782f0e 100644 --- a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/003_Challenge_ChooseFoes.rb +++ b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/003_Challenge_ChooseFoes.rb @@ -24,7 +24,7 @@ def pbBattleChallengeTrainer(win_count, bttrainers) [49, 200, 100] # 200-300 - This line is used for all higher win_counts ] slot = nil - table.each { |val| slot = val if val[0] <= win_count && slot[0] < val[0] } + table.each { |val| slot = val if val[0] <= win_count && (!slot || slot[0] < val[0]) } return 0 if !slot # Scale the start point and length based on how many trainers are in bttrainers offset = slot[1] * bttrainers.length / 300 @@ -84,7 +84,7 @@ end #=============================================================================== # Generate a full team's worth of Pokémon which obey the given rules. #=============================================================================== -def pbBattleFactoryPokemon(rules, win_count, swap_count, _rentals) +def pbBattleFactoryPokemon(rules, win_count, swap_count, rentals) btpokemon = pbGetBTPokemon(pbBattleChallenge.currentChallenge) level = rules.ruleset.suggestedLevel pokemonNumbers = [0, 0] # Start and end indices in btpokemon @@ -94,32 +94,33 @@ def pbBattleFactoryPokemon(rules, win_count, swap_count, _rentals) # Choose a range of Pokémon in btpokemon to randomly select from. The higher # the set number, the later the range lies within btpokemon (typically). # This table's start point and end point values are based on a btpokemon size - # of 882. They are scaled based on the actual size of btpokemon. + # of 881. They are scaled based on the actual size of btpokemon. + # Group 1 is 0 - 173. Group 2 is 174 - 371. Group 3 is 372 - 881. if level == GameData::GrowthRate.max_level # Open Level (Level 100) table = [ - [372, 467], - [468, 563], - [564, 659], - [660, 755], - [372, 881], - [372, 881], - [372, 881], - [372, 881] # This line is used for all higher sets + [372, 491], # Group 3 (first quarter) + [492, 610], # Group 3 (second quarter) + [611, 729], # Group 3 (third quarter) + [730, 849], # Group 3 (fourth quarter) + [372, 881], # All of Group 3 + [372, 881], # All of Group 3 + [372, 881], # All of Group 3 + [372, 881] # This line is used for all higher sets (all of Group 3) ] else table = [ - [110, 199], - [162, 266], - [267, 371], - [372, 467], - [468, 563], - [564, 659], - [660, 755], - [372, 849] # This line is used for all higher sets + [ 0, 173], # Group 1 + [174, 272], # Group 2 (first half) + [273, 371], # Group 2 (second half) + [372, 491], # Group 3 (first quarter) + [492, 610], # Group 3 (second quarter) + [611, 729], # Group 3 (third quarter) + [730, 849], # Group 3 (fourth quarter) + [372, 881] # This line is used for all higher sets (all of Group 3) ] end - pokemonNumbers[0] = table[set][0] * btpokemon.length / 882 - pokemonNumbers[1] = table[set][1] * btpokemon.length / 882 + pokemonNumbers[0] = table[set][0] * btpokemon.length / 881 + pokemonNumbers[1] = table[set][1] * btpokemon.length / 881 # Choose two IV values for Pokémon to use (the one for the current set, and # the one for the next set). The iv_threshold below determines which of these # two values a given Pokémon uses. The higher the set number, the higher these @@ -139,16 +140,24 @@ def pbBattleFactoryPokemon(rules, win_count, swap_count, _rentals) ] thresholds.each { |val| iv_threshold = val[1] if swap_count >= val[0] } # Randomly choose Pokémon from the range to fill the party with + old_min = rules.ruleset.minLength + old_max = rules.ruleset.maxLength + if rentals.length == 0 + rules.ruleset.setNumber(6) # Rentals + else + rules.ruleset.setNumber(old_max + rentals.length) # Opponent + end party = [] loop do party.clear - while party.length < Settings::MAX_PARTY_SIZE + while party.length < ((rentals.length == 0) ? 6 : old_max) rnd = pokemonNumbers[0] + rand(pokemonNumbers[1] - pokemonNumbers[0] + 1) rndpoke = btpokemon[rnd] indvalue = (party.length < iv_threshold) ? ivs[0] : ivs[1] party.push(rndpoke.createPokemon(level, indvalue, nil)) end - break if rules.ruleset.isValid?(party) + break if rules.ruleset.isValid?(party.concat(rentals)) end + rules.ruleset.setNumberRange(old_min, old_max) return party end diff --git a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/004_Challenge_Battles.rb b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/004_Challenge_Battles.rb index 68167c9d8..3c54a03ef 100644 --- a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/004_Challenge_Battles.rb +++ b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/004_Challenge_Battles.rb @@ -42,7 +42,7 @@ def pbOrganizedBattleEx(opponent, challengedata, endspeech, endspeechwin) if Input.press?(Input::CTRL) && $DEBUG pbMessage(_INTL("SKIPPING BATTLE...")) pbMessage(_INTL("AFTER WINNING...")) - endspeech.each { |msg| pbMessage(msg || "...") } + pbMessage(endspeech || "...") $PokemonTemp.lastbattle = nil return true end diff --git a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb index ad10ab5a0..7bc490dcb 100644 --- a/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb +++ b/Data/Scripts/018_Alternate battle modes/001_Battle Frontier/005_UI_BattleSwap.rb @@ -1,75 +1,69 @@ class BattleSwapScene def pbStartRentScene(rentals) - # Create sprite hash - @sprites={} - @mode=0 # rental - # Allocate viewport - @rentals=rentals - @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) - @viewport.z=99999 - @sprites["title"]=Window_UnformattedTextPokemon.newWithSize( - _INTL("RENTAL POKéMON"),0,0,Graphics.width,64,@viewport) - @sprites["help"]=Window_UnformattedTextPokemon.newWithSize("", - 0,Graphics.height-64,Graphics.width,64,@viewport) - @sprites["list"]=Window_AdvancedCommandPokemonEx.newWithSize( - [],0,64,Graphics.width,Graphics.height-128,@viewport) - @sprites["msgwindow"]=Window_AdvancedTextPokemon.newWithSize("", - 0,Graphics.height-64,Graphics.height,64,@viewport) - @sprites["msgwindow"].visible=false - addBackgroundPlane(@sprites,"bg","rentbg",@viewport) + @rentals = rentals + @mode = 0 # rental (pick 3 out of 6 initial Pokémon) + @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) + @viewport.z = 99999 + @sprites = {} + addBackgroundPlane(@sprites, "bg", "rentbg", @viewport) + @sprites["title"] = Window_UnformattedTextPokemon.newWithSize( + _INTL("RENTAL POKéMON"), 0, 0, Graphics.width, 64, @viewport) + @sprites["list"] = Window_AdvancedCommandPokemonEx.newWithSize( + [], 0, 64, Graphics.width, Graphics.height - 128 , @viewport) + @sprites["help"] = Window_UnformattedTextPokemon.newWithSize("", + 0, Graphics.height - 64, Graphics.width, 64, @viewport) + @sprites["msgwindow"] = Window_AdvancedTextPokemon.newWithSize("", + 0, Graphics.height - 64, Graphics.height, 64, @viewport) + @sprites["msgwindow"].visible = false pbUpdateChoices([]) pbDeactivateWindows(@sprites) - # Fade in all sprites pbFadeInAndShow(@sprites) { pbUpdate } end - def pbStartSwapScene(currentPokemon,newPokemon) - # Create sprite hash - @sprites={} - @mode=1 # swap - # Allocate viewport - @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) - @viewport.z=99999 - @sprites["title"]=Window_UnformattedTextPokemon.newWithSize( - _INTL("POKéMON SWAP"),0,0,Graphics.width,64,@viewport) - @sprites["help"]=Window_UnformattedTextPokemon.newWithSize( - "",0,Graphics.height-64,Graphics.width,64,@viewport) - @sprites["list"]=Window_AdvancedCommandPokemonEx.newWithSize( - [],0,64,Graphics.width,Graphics.height-128,@viewport) - @sprites["msgwindow"]=Window_AdvancedTextPokemon.newWithSize( - "",0,Graphics.height-64,Graphics.width,64,@viewport) - @sprites["msgwindow"].visible=false - addBackgroundPlane(@sprites,"bg","swapbg",@viewport) - @currentPokemon=currentPokemon - @newPokemon=newPokemon - pbInitSwapScreen() + def pbStartSwapScene(currentPokemon, newPokemon) + @currentPokemon = currentPokemon + @newPokemon = newPokemon + @mode = 1 # swap (pick 1 out of 3 opponent's Pokémon to take) + @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) + @viewport.z = 99999 + @sprites = {} + addBackgroundPlane(@sprites, "bg", "swapbg", @viewport) + @sprites["title"] = Window_UnformattedTextPokemon.newWithSize( + _INTL("POKéMON SWAP"), 0, 0, Graphics.width, 64, @viewport) + @sprites["list"] = Window_AdvancedCommandPokemonEx.newWithSize( + [], 0, 64, Graphics.width, Graphics.height - 128, @viewport) + @sprites["help"] = Window_UnformattedTextPokemon.newWithSize( + "", 0, Graphics.height - 64, Graphics.width, 64, @viewport) + @sprites["msgwindow"] = Window_AdvancedTextPokemon.newWithSize( + "", 0, Graphics.height - 64, Graphics.width, 64, @viewport) + @sprites["msgwindow"].visible = false + pbInitSwapScreen pbDeactivateWindows(@sprites) - # Fade in all sprites pbFadeInAndShow(@sprites) { pbUpdate } end def pbInitSwapScreen - commands=pbGetCommands(@currentPokemon,[]) + commands = pbGetCommands(@currentPokemon, []) commands.push(_INTL("CANCEL")) - @sprites["help"].text=_INTL("Select Pokémon to swap.") - @sprites["list"].commands=commands - @sprites["list"].index=0 - @mode=1 + @sprites["help"].text = _INTL("Select Pokémon to swap.") + @sprites["list"].commands = commands + @sprites["list"].index = 0 + @mode = 1 end # End the scene here def pbEndScene - pbFadeOutAndHide(@sprites) { pbUpdate } # Fade out all sprites - pbDisposeSpriteHash(@sprites) # Dispose all sprites - @viewport.dispose # Dispose the viewport + pbFadeOutAndHide(@sprites) { pbUpdate } + pbDisposeSpriteHash(@sprites) + @viewport.dispose end def pbShowCommands(commands) - UIHelper.pbShowCommands(@sprites["msgwindow"],nil,commands) { pbUpdate } + UIHelper.pbShowCommands(@sprites["msgwindow"], nil, commands) { pbUpdate } end def pbConfirm(message) - UIHelper.pbConfirm(@sprites["msgwindow"],message) { pbUpdate } + UIHelper.pbConfirm(@sprites["msgwindow"], message) { pbUpdate } end def pbGetCommands(list, choices) @@ -77,9 +71,8 @@ class BattleSwapScene for i in 0...list.length pkmn = list[i] category = pkmn.species_data.category - selected = shadowctagFromColor(Color.new(232, 0, 0)) cmd = _INTL("{1} - {2} Pokémon", pkmn.speciesName, category) - cmd = selected + cmd if choices.include?(i) + cmd = "" + cmd if choices.include?(i) # Red text commands.push(cmd) end return commands @@ -87,19 +80,18 @@ class BattleSwapScene # Processes the scene def pbChoosePokemon(canCancel) - pbActivateWindow(@sprites,"list") { + pbActivateWindow(@sprites, "list") { loop do Graphics.update Input.update pbUpdate if Input.trigger?(Input::BACK) && canCancel return -1 - end - if Input.trigger?(Input::USE) - index=@sprites["list"].index - if index==@sprites["list"].commands.length-1 && canCancel + elsif Input.trigger?(Input::USE) + index = @sprites["list"].index + if index == @sprites["list"].commands.length - 1 && canCancel return -1 - elsif index==@sprites["list"].commands.length-2 && canCancel && @mode==2 + elsif index == @sprites["list"].commands.length - 2 && canCancel && @mode == 2 return -2 else return index @@ -110,44 +102,42 @@ class BattleSwapScene end def pbUpdateChoices(choices) - commands=pbGetCommands(@rentals,choices) - @choices=choices - if choices.length==0 - @sprites["help"].text=_INTL("Choose the first Pokémon.") - elsif choices.length==1 - @sprites["help"].text=_INTL("Choose the second Pokémon.") + commands = pbGetCommands(@rentals, choices) + @choices = choices + if choices.length == 0 + @sprites["help"].text = _INTL("Choose the first Pokémon.") + elsif choices.length == 1 + @sprites["help"].text = _INTL("Choose the second Pokémon.") else - @sprites["help"].text=_INTL("Choose the third Pokémon.") + @sprites["help"].text = _INTL("Choose the third Pokémon.") end - @sprites["list"].commands=commands + @sprites["list"].commands = commands end def pbSwapChosen(_pkmnindex) - commands=pbGetCommands(@newPokemon,[]) + commands=pbGetCommands(@newPokemon, []) commands.push(_INTL("PKMN FOR SWAP")) commands.push(_INTL("CANCEL")) - @sprites["help"].text=_INTL("Select Pokémon to accept.") - @sprites["list"].commands=commands - @sprites["list"].index=0 - @mode=2 + @sprites["help"].text = _INTL("Select Pokémon to accept.") + @sprites["list"].commands = commands + @sprites["list"].index = 0 + @mode = 2 end def pbSwapCanceled pbInitSwapScreen end - def pbSummary(list,index) - visibleSprites=pbFadeOutAndHide(@sprites) { pbUpdate } - scene=PokemonSummary_Scene.new - screen=PokemonSummaryScreen.new(scene) - @sprites["list"].index=screen.pbStartScreen(list,index) - pbFadeInAndShow(@sprites,visibleSprites) { pbUpdate } + def pbSummary(list, index) + visibleSprites = pbFadeOutAndHide(@sprites) { pbUpdate } + scene = PokemonSummary_Scene.new + screen = PokemonSummaryScreen.new(scene) + @sprites["list"].index = screen.pbStartScreen(list, index) + pbFadeInAndShow(@sprites, visibleSprites) { pbUpdate } end - # Update the scene here, this is called once each frame def pbUpdate pbUpdateSpriteHash(@sprites) - # Add other things that should be updated end end @@ -160,30 +150,30 @@ class BattleSwapScreen def pbStartRent(rentals) @scene.pbStartRentScene(rentals) - chosen=[] + chosen = [] loop do - index=@scene.pbChoosePokemon(false) - commands=[] + index = @scene.pbChoosePokemon(false) + commands = [] commands.push(_INTL("SUMMARY")) - if chosen.any? { |item| item==index } + if chosen.include?(index) commands.push(_INTL("DESELECT")) else commands.push(_INTL("RENT")) end commands.push(_INTL("OTHERS")) - command=@scene.pbShowCommands(commands) - if command==0 - @scene.pbSummary(rentals,index) - elsif command==1 - if chosen.any? { |item| item==index } + command = @scene.pbShowCommands(commands) + if command == 0 + @scene.pbSummary(rentals, index) + elsif command == 1 + if chosen.include?(index) chosen.delete(index) @scene.pbUpdateChoices(chosen.clone) else chosen.push(index) @scene.pbUpdateChoices(chosen.clone) - if chosen.length==3 + if chosen.length == 3 if @scene.pbConfirm(_INTL("Are these three Pokémon OK?")) - retval=[] + retval = [] chosen.each { |i| retval.push(rentals[i]) } @scene.pbEndScene return retval @@ -197,30 +187,30 @@ class BattleSwapScreen end end - def pbStartSwap(currentPokemon,newPokemon) - @scene.pbStartSwapScene(currentPokemon,newPokemon) + def pbStartSwap(currentPokemon, newPokemon) + @scene.pbStartSwapScene(currentPokemon, newPokemon) loop do - pkmn=@scene.pbChoosePokemon(true) - if pkmn>=0 - commands=[_INTL("SUMMARY"),_INTL("SWAP"),_INTL("RECHOOSE")] - command=@scene.pbShowCommands(commands) - if command==0 - @scene.pbSummary(currentPokemon,pkmn) - elsif command==1 + pkmn = @scene.pbChoosePokemon(true) + if pkmn >= 0 + commands = [_INTL("SUMMARY"), _INTL("SWAP"), _INTL("RECHOOSE")] + command = @scene.pbShowCommands(commands) + if command == 0 + @scene.pbSummary(currentPokemon, pkmn) + elsif command == 1 @scene.pbSwapChosen(pkmn) - yourPkmn=pkmn + yourPkmn = pkmn loop do - pkmn=@scene.pbChoosePokemon(true) - if pkmn>=0 + pkmn = @scene.pbChoosePokemon(true) + if pkmn >= 0 if @scene.pbConfirm(_INTL("Accept this Pokémon?")) @scene.pbEndScene - currentPokemon[yourPkmn]=newPokemon[pkmn] + currentPokemon[yourPkmn] = newPokemon[pkmn] return true end - elsif pkmn==-2 + elsif pkmn == -2 @scene.pbSwapCanceled - break # Back to first screen - elsif pkmn==-1 + break # Back to first screen + elsif pkmn == -1 if @scene.pbConfirm(_INTL("Quit swapping?")) @scene.pbEndScene return false diff --git a/Data/Scripts/018_Alternate battle modes/002_Battle Frontier rules/002_Challenge_Rulesets.rb b/Data/Scripts/018_Alternate battle modes/002_Battle Frontier rules/002_Challenge_Rulesets.rb index 4babeffa7..defb575ac 100644 --- a/Data/Scripts/018_Alternate battle modes/002_Battle Frontier rules/002_Challenge_Rulesets.rb +++ b/Data/Scripts/018_Alternate battle modes/002_Battle Frontier rules/002_Challenge_Rulesets.rb @@ -29,7 +29,7 @@ class PokemonRuleSet end def maxLength - return (@number < 0) ? 6 : @number + return (@number < 0) ? Settings::MAX_PARTY_SIZE : @number end alias number maxLength @@ -38,7 +38,7 @@ class PokemonRuleSet end def maxTeamLength - return [6, self.maxLength].max + return [Settings::MAX_PARTY_SIZE, self.maxLength].max end # Returns the length of a valid subset of a Pokemon team. @@ -68,7 +68,7 @@ class PokemonRuleSet def setNumberRange(minValue, maxValue) @minLength = [1, minValue].max - @number = [maxValue, 6].min + @number = [1, maxValue].max return self end @@ -139,10 +139,11 @@ class PokemonRuleSet return false end - # Returns true if the team's length is greater or equal to the suggested number - # and is 6 or less, the team as a whole meets the requirements of any team - # rules, and at least one subset of the team meets the requirements of any - # subset rules. Each Pokemon in the team must be valid. + # Returns true if the team's length is greater or equal to the suggested + # number and is Settings::MAX_PARTY_SIZE or less, the team as a whole meets + # the requirements of any team rules, and at least one subset of the team + # meets the requirements of any subset rules. Each Pokemon in the team must be + # valid. def canRegisterTeam?(team) return false if !team || team.length < self.minTeamLength return false if team.length > self.maxTeamLength @@ -168,9 +169,9 @@ class PokemonRuleSet return true end - # Returns true if the team's length is greater or equal to the suggested number - # and at least one subset of the team meets the requirements of any team rules - # and subset rules. Not all Pokemon in the team have to be valid. + # Returns true if the team's length is greater or equal to the suggested + # number and at least one subset of the team meets the requirements of any + # team rules and subset rules. Not all Pokemon in the team have to be valid. def hasValidTeam?(team) return false if !team || team.length < self.minTeamLength teamNumber = [self.maxLength, team.length].min @@ -201,9 +202,9 @@ class PokemonRuleSet for pkmn in team next if isPokemonValid?(pkmn) if pkmn - error.push(_INTL("This team is not allowed.", pkmn.name)) if error - else error.push(_INTL("{1} is not allowed.", pkmn.name)) if error + else + error.push(_INTL("This team is not allowed.")) if error end return false end @@ -230,8 +231,8 @@ class StandardRules < PokemonRuleSet def initialize(number, level = nil) super(number) addPokemonRule(StandardRestriction.new) - addPokemonRule(SpeciesClause.new) - addPokemonRule(ItemClause.new) + addTeamRule(SpeciesClause.new) + addTeamRule(ItemClause.new) addPokemonRule(MaximumLevelRestriction.new(level)) if level end end @@ -277,8 +278,8 @@ class FancyCup < PokemonRuleSet addPokemonRule(HeightRestriction.new(2)) addPokemonRule(WeightRestriction.new(20)) addPokemonRule(BabyRestriction.new) - addPokemonRule(SpeciesClause.new) - addPokemonRule(ItemClause.new) + addTeamRule(SpeciesClause.new) + addTeamRule(ItemClause.new) end def name @@ -295,8 +296,8 @@ class LittleCup < PokemonRuleSet addPokemonRule(StandardRestriction.new) addPokemonRule(MaximumLevelRestriction.new(5)) addPokemonRule(BabyRestriction.new) - addPokemonRule(SpeciesClause.new) - addPokemonRule(ItemClause.new) + addTeamRule(SpeciesClause.new) + addTeamRule(ItemClause.new) end def name @@ -314,8 +315,8 @@ class LightCup < PokemonRuleSet addPokemonRule(MaximumLevelRestriction.new(50)) addPokemonRule(WeightRestriction.new(99)) addPokemonRule(BabyRestriction.new) - addPokemonRule(SpeciesClause.new) - addPokemonRule(ItemClause.new) + addTeamRule(SpeciesClause.new) + addTeamRule(ItemClause.new) end def name