diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 200a044610..ea7ef493c5 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2610,8 +2610,7 @@ BattleScript_EffectPsychicTerrain: printfromtable gTerrainStringIds waitmessage B_WAIT_TIME_LONG playanimation BS_ATTACKER, B_ANIM_RESTORE_BG - call BattleScript_ActivateTerrainAbilities - call BattleScript_TerrainSeedLoop + call BattleScript_ActivateTerrainEffects goto BattleScript_MoveEnd BattleScript_EffectTopsyTurvy: @@ -6867,7 +6866,7 @@ BattleScript_OverworldTerrain:: printfromtable gTerrainStringIds waitmessage B_WAIT_TIME_LONG playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG - call BattleScript_TerrainSeedLoop + call BattleScript_ActivateTerrainEffects end3 BattleScript_SideStatusWoreOff:: @@ -7346,8 +7345,7 @@ BattleScript_SeedSowerActivates:: printstring STRINGID_TERRAINBECOMESGRASSY waitmessage B_WAIT_TIME_LONG playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG - call BattleScript_ActivateTerrainAbilities - call BattleScript_TerrainSeedLoop + call BattleScript_ActivateTerrainEffects return BattleScript_AngerShellActivates:: @@ -8828,18 +8826,19 @@ BattleScript_SnowWarningActivates:: call BattleScript_WeatherFormChanges end3 -BattleScript_TerrainSeedLoop: +BattleScript_ActivateTerrainEffects: savetarget setbyte gBattlerTarget, 0 -BattleScript_TerrainSeedLoopIter: +BattleScript_ActivateTerrainSeed: copybyte sBATTLER, gBattlerTarget - doterrainseed BS_TARGET, BattleScript_TerrainSeedLoop_NextBattler + doterrainseed BS_TARGET, BattleScript_ActivateTerrainAbility removeitem BS_TARGET -BattleScript_TerrainSeedLoop_NextBattler: +BattleScript_ActivateTerrainAbility: + activateterrainchangeabilities BS_TARGET +BattleScript_ActivateTerrainEffects_Increment: addbyte gBattlerTarget, 0x1 - jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TerrainSeedLoopIter + jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_ActivateTerrainSeed restoretarget - call BattleScript_ActivateSwitchInAbilities return BattleScript_ActivateSwitchInAbilities: @@ -8853,25 +8852,13 @@ BattleScript_ActivateSwitchInAbilities_Increment: copybyte gBattlerAttacker, sBATTLER return -BattleScript_ActivateTerrainAbilities: - copybyte sBATTLER, gBattlerAttacker - setbyte gBattlerAttacker, 0 -BattleScript_ActivateTerrainAbilities_Loop: - activateterrainchangeabilities BS_ATTACKER -BattleScript_ActivateTerrainAbilities_Increment: - addbyte gBattlerAttacker, 1 - jumpifbytenotequal gBattlerAttacker, gBattlersCount, BattleScript_ActivateTerrainAbilities_Loop - copybyte gBattlerAttacker, sBATTLER - return - BattleScript_ElectricSurgeActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp printstring STRINGID_TERRAINBECOMESELECTRIC waitmessage B_WAIT_TIME_LONG playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG - call BattleScript_ActivateTerrainAbilities - call BattleScript_TerrainSeedLoop + call BattleScript_ActivateTerrainEffects end3 BattleScript_MistySurgeActivates:: @@ -8880,8 +8867,7 @@ BattleScript_MistySurgeActivates:: printstring STRINGID_TERRAINBECOMESMISTY waitmessage B_WAIT_TIME_LONG playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG - call BattleScript_ActivateTerrainAbilities - call BattleScript_TerrainSeedLoop + call BattleScript_ActivateTerrainEffects end3 BattleScript_GrassySurgeActivates:: @@ -8890,8 +8876,7 @@ BattleScript_GrassySurgeActivates:: printstring STRINGID_TERRAINBECOMESGRASSY waitmessage B_WAIT_TIME_LONG playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG - call BattleScript_ActivateTerrainAbilities - call BattleScript_TerrainSeedLoop + call BattleScript_ActivateTerrainEffects end3 BattleScript_PsychicSurgeActivates:: @@ -8900,8 +8885,7 @@ BattleScript_PsychicSurgeActivates:: printstring STRINGID_TERRAINBECOMESPSYCHIC waitmessage B_WAIT_TIME_LONG playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG - call BattleScript_ActivateTerrainAbilities - call BattleScript_TerrainSeedLoop + call BattleScript_ActivateTerrainEffects end3 BattleScript_HurtTarget_NoString: @@ -10184,7 +10168,6 @@ BattleScript_EffectHitSetRemoveTerrain: setterrain BattleScript_TryFaint playanimation BS_ATTACKER, B_ANIM_RESTORE_BG printfromtable gTerrainStringIds - call BattleScript_ActivateTerrainAbilities BattleScript_TryFaint: tryfaintmon BS_TARGET goto BattleScript_MoveEnd diff --git a/graphics/items/icon_palettes/black_augurite.pal b/graphics/items/icon_palettes/black_augurite.pal new file mode 100644 index 0000000000..0d67abee39 --- /dev/null +++ b/graphics/items/icon_palettes/black_augurite.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +120 192 168 +0 0 0 +111 108 124 +58 48 49 +206 206 214 +151 149 160 +142 93 117 +89 62 76 +255 255 255 +111 109 124 +194 192 202 +88 62 76 +80 74 88 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/linking_cord.pal b/graphics/items/icon_palettes/linking_cord.pal new file mode 100644 index 0000000000..8be2b522f7 --- /dev/null +++ b/graphics/items/icon_palettes/linking_cord.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +128 192 168 +87 87 88 +155 158 156 +117 114 116 +0 0 0 +36 37 42 +62 66 68 +56 57 61 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icon_palettes/peat_block.pal b/graphics/items/icon_palettes/peat_block.pal new file mode 100644 index 0000000000..8d4b5e3b6f --- /dev/null +++ b/graphics/items/icon_palettes/peat_block.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +128 198 168 +32 32 32 +230 217 213 +199 189 184 +156 135 143 +102 83 83 +143 118 130 +65 56 56 +179 162 151 +117 100 100 +210 183 192 +180 158 167 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icons/black_augurite.png b/graphics/items/icons/black_augurite.png new file mode 100644 index 0000000000..8be2bc188c Binary files /dev/null and b/graphics/items/icons/black_augurite.png differ diff --git a/graphics/items/icons/linking_cord.png b/graphics/items/icons/linking_cord.png new file mode 100644 index 0000000000..a3f92da04b Binary files /dev/null and b/graphics/items/icons/linking_cord.png differ diff --git a/graphics/items/icons/peat_block.png b/graphics/items/icons/peat_block.png new file mode 100644 index 0000000000..9c10659875 Binary files /dev/null and b/graphics/items/icons/peat_block.png differ diff --git a/graphics/pokemon/absol/icon.png b/graphics/pokemon/absol/icon.png index 681d98d1d9..d58d208a7b 100644 Binary files a/graphics/pokemon/absol/icon.png and b/graphics/pokemon/absol/icon.png differ diff --git a/graphics/pokemon/accelgor/icon.png b/graphics/pokemon/accelgor/icon.png index d8538bec1d..5d971a97b2 100644 Binary files a/graphics/pokemon/accelgor/icon.png and b/graphics/pokemon/accelgor/icon.png differ diff --git a/graphics/pokemon/aerodactyl/icon.png b/graphics/pokemon/aerodactyl/icon.png index e354dbb0dc..58c96d57c7 100644 Binary files a/graphics/pokemon/aerodactyl/icon.png and b/graphics/pokemon/aerodactyl/icon.png differ diff --git a/graphics/pokemon/aggron/icon.png b/graphics/pokemon/aggron/icon.png index 5410a384f6..3eaa060542 100644 Binary files a/graphics/pokemon/aggron/icon.png and b/graphics/pokemon/aggron/icon.png differ diff --git a/graphics/pokemon/aipom/icon.png b/graphics/pokemon/aipom/icon.png index 43822f0980..294ab74eb4 100644 Binary files a/graphics/pokemon/aipom/icon.png and b/graphics/pokemon/aipom/icon.png differ diff --git a/graphics/pokemon/alakazam/icon.png b/graphics/pokemon/alakazam/icon.png index 6d136899d9..e823e94cd3 100644 Binary files a/graphics/pokemon/alakazam/icon.png and b/graphics/pokemon/alakazam/icon.png differ diff --git a/graphics/pokemon/altaria/icon.png b/graphics/pokemon/altaria/icon.png index f1d2698a2a..8c9bf81982 100644 Binary files a/graphics/pokemon/altaria/icon.png and b/graphics/pokemon/altaria/icon.png differ diff --git a/graphics/pokemon/amoonguss/icon.png b/graphics/pokemon/amoonguss/icon.png index a0762f49c3..baf2422074 100644 Binary files a/graphics/pokemon/amoonguss/icon.png and b/graphics/pokemon/amoonguss/icon.png differ diff --git a/graphics/pokemon/arceus/icon.png b/graphics/pokemon/arceus/icon.png index 155bfc35bd..6141c35e8c 100644 Binary files a/graphics/pokemon/arceus/icon.png and b/graphics/pokemon/arceus/icon.png differ diff --git a/graphics/pokemon/ariados/icon.png b/graphics/pokemon/ariados/icon.png index c6ff8c5f85..e6206a3cb5 100644 Binary files a/graphics/pokemon/ariados/icon.png and b/graphics/pokemon/ariados/icon.png differ diff --git a/graphics/pokemon/armaldo/icon.png b/graphics/pokemon/armaldo/icon.png index 5dba6557df..1277dbbbe0 100644 Binary files a/graphics/pokemon/armaldo/icon.png and b/graphics/pokemon/armaldo/icon.png differ diff --git a/graphics/pokemon/articuno/icon.png b/graphics/pokemon/articuno/icon.png index 79685a2d12..c500449634 100644 Binary files a/graphics/pokemon/articuno/icon.png and b/graphics/pokemon/articuno/icon.png differ diff --git a/graphics/pokemon/azelf/icon.png b/graphics/pokemon/azelf/icon.png index c8d0af3d9f..816b6f5cc7 100644 Binary files a/graphics/pokemon/azelf/icon.png and b/graphics/pokemon/azelf/icon.png differ diff --git a/graphics/pokemon/azumarill/icon.png b/graphics/pokemon/azumarill/icon.png index cc79407be8..8d1a626760 100644 Binary files a/graphics/pokemon/azumarill/icon.png and b/graphics/pokemon/azumarill/icon.png differ diff --git a/graphics/pokemon/beartic/icon.png b/graphics/pokemon/beartic/icon.png index c4ed605a0e..991f9f265d 100644 Binary files a/graphics/pokemon/beartic/icon.png and b/graphics/pokemon/beartic/icon.png differ diff --git a/graphics/pokemon/beldum/icon.png b/graphics/pokemon/beldum/icon.png index 8cac3cf714..af22605458 100644 Binary files a/graphics/pokemon/beldum/icon.png and b/graphics/pokemon/beldum/icon.png differ diff --git a/graphics/pokemon/bellsprout/icon.png b/graphics/pokemon/bellsprout/icon.png index 59ae8d037e..ff6ca2c337 100644 Binary files a/graphics/pokemon/bellsprout/icon.png and b/graphics/pokemon/bellsprout/icon.png differ diff --git a/graphics/pokemon/butterfree/icon.png b/graphics/pokemon/butterfree/icon.png index 2ea823cf4a..827ceee0d6 100644 Binary files a/graphics/pokemon/butterfree/icon.png and b/graphics/pokemon/butterfree/icon.png differ diff --git a/graphics/pokemon/cacturne/icon.png b/graphics/pokemon/cacturne/icon.png index fd1bb1d5fe..8dd74b291d 100644 Binary files a/graphics/pokemon/cacturne/icon.png and b/graphics/pokemon/cacturne/icon.png differ diff --git a/graphics/pokemon/castform/icon.png b/graphics/pokemon/castform/icon.png index 6f4a5a18a2..5e3c092919 100644 Binary files a/graphics/pokemon/castform/icon.png and b/graphics/pokemon/castform/icon.png differ diff --git a/graphics/pokemon/chatot/icon.png b/graphics/pokemon/chatot/icon.png index ee4eab2a1e..9a8777c7ad 100644 Binary files a/graphics/pokemon/chatot/icon.png and b/graphics/pokemon/chatot/icon.png differ diff --git a/graphics/pokemon/cherrim/icon.png b/graphics/pokemon/cherrim/icon.png index 145074d7a3..6915d775b4 100644 Binary files a/graphics/pokemon/cherrim/icon.png and b/graphics/pokemon/cherrim/icon.png differ diff --git a/graphics/pokemon/chikorita/icon.png b/graphics/pokemon/chikorita/icon.png index ef2975dc4f..ed1eac67f8 100644 Binary files a/graphics/pokemon/chikorita/icon.png and b/graphics/pokemon/chikorita/icon.png differ diff --git a/graphics/pokemon/chimecho/icon.png b/graphics/pokemon/chimecho/icon.png index f5480bc356..d4d6b64485 100644 Binary files a/graphics/pokemon/chimecho/icon.png and b/graphics/pokemon/chimecho/icon.png differ diff --git a/graphics/pokemon/cloyster/icon.png b/graphics/pokemon/cloyster/icon.png index a60befbbf1..9f50ad4dd9 100644 Binary files a/graphics/pokemon/cloyster/icon.png and b/graphics/pokemon/cloyster/icon.png differ diff --git a/graphics/pokemon/cobalion/icon.png b/graphics/pokemon/cobalion/icon.png index 376226b242..5dcdd6cb0e 100644 Binary files a/graphics/pokemon/cobalion/icon.png and b/graphics/pokemon/cobalion/icon.png differ diff --git a/graphics/pokemon/cofagrigus/icon.png b/graphics/pokemon/cofagrigus/icon.png index 19476138c1..1ae2b66099 100644 Binary files a/graphics/pokemon/cofagrigus/icon.png and b/graphics/pokemon/cofagrigus/icon.png differ diff --git a/graphics/pokemon/combusken/icon.png b/graphics/pokemon/combusken/icon.png index d7b1f8412b..231252ccb5 100644 Binary files a/graphics/pokemon/combusken/icon.png and b/graphics/pokemon/combusken/icon.png differ diff --git a/graphics/pokemon/corsola/icon.png b/graphics/pokemon/corsola/icon.png index 9fb51a0b14..e5ebe6c08d 100644 Binary files a/graphics/pokemon/corsola/icon.png and b/graphics/pokemon/corsola/icon.png differ diff --git a/graphics/pokemon/cresselia/icon.png b/graphics/pokemon/cresselia/icon.png index 76b9b36390..8189ad7d16 100644 Binary files a/graphics/pokemon/cresselia/icon.png and b/graphics/pokemon/cresselia/icon.png differ diff --git a/graphics/pokemon/crobat/icon.png b/graphics/pokemon/crobat/icon.png index 5a3257411d..2d42fa21b6 100644 Binary files a/graphics/pokemon/crobat/icon.png and b/graphics/pokemon/crobat/icon.png differ diff --git a/graphics/pokemon/crustle/icon.png b/graphics/pokemon/crustle/icon.png index e6a99fe634..5b70147792 100644 Binary files a/graphics/pokemon/crustle/icon.png and b/graphics/pokemon/crustle/icon.png differ diff --git a/graphics/pokemon/darkrai/icon.png b/graphics/pokemon/darkrai/icon.png index 71d92afdc2..c31c365bdb 100644 Binary files a/graphics/pokemon/darkrai/icon.png and b/graphics/pokemon/darkrai/icon.png differ diff --git a/graphics/pokemon/deino/icon.png b/graphics/pokemon/deino/icon.png index 60822658b5..0b5ec01ce0 100644 Binary files a/graphics/pokemon/deino/icon.png and b/graphics/pokemon/deino/icon.png differ diff --git a/graphics/pokemon/dialga/icon.png b/graphics/pokemon/dialga/icon.png index 83db2e521d..232b9bf945 100644 Binary files a/graphics/pokemon/dialga/icon.png and b/graphics/pokemon/dialga/icon.png differ diff --git a/graphics/pokemon/dodrio/icon.png b/graphics/pokemon/dodrio/icon.png index bd1692b133..19d1644a3c 100644 Binary files a/graphics/pokemon/dodrio/icon.png and b/graphics/pokemon/dodrio/icon.png differ diff --git a/graphics/pokemon/donphan/icon.png b/graphics/pokemon/donphan/icon.png index ce67839107..32368b808d 100644 Binary files a/graphics/pokemon/donphan/icon.png and b/graphics/pokemon/donphan/icon.png differ diff --git a/graphics/pokemon/dragonite/icon.png b/graphics/pokemon/dragonite/icon.png index 11fb866c39..12c2c141d6 100644 Binary files a/graphics/pokemon/dragonite/icon.png and b/graphics/pokemon/dragonite/icon.png differ diff --git a/graphics/pokemon/drifblim/icon.png b/graphics/pokemon/drifblim/icon.png index bfa106e872..df7c888d5f 100644 Binary files a/graphics/pokemon/drifblim/icon.png and b/graphics/pokemon/drifblim/icon.png differ diff --git a/graphics/pokemon/duosion/icon.png b/graphics/pokemon/duosion/icon.png index 90064f3be0..9385bf6140 100644 Binary files a/graphics/pokemon/duosion/icon.png and b/graphics/pokemon/duosion/icon.png differ diff --git a/graphics/pokemon/dwebble/icon.png b/graphics/pokemon/dwebble/icon.png index 32a23fd05a..4b356d5aaa 100644 Binary files a/graphics/pokemon/dwebble/icon.png and b/graphics/pokemon/dwebble/icon.png differ diff --git a/graphics/pokemon/emboar/icon.png b/graphics/pokemon/emboar/icon.png index 8d6f99628e..d79f6f004b 100644 Binary files a/graphics/pokemon/emboar/icon.png and b/graphics/pokemon/emboar/icon.png differ diff --git a/graphics/pokemon/empoleon/icon.png b/graphics/pokemon/empoleon/icon.png index f4bbc4fd48..1e6e305828 100644 Binary files a/graphics/pokemon/empoleon/icon.png and b/graphics/pokemon/empoleon/icon.png differ diff --git a/graphics/pokemon/entei/icon.png b/graphics/pokemon/entei/icon.png index b7707797f0..eeb80f4604 100644 Binary files a/graphics/pokemon/entei/icon.png and b/graphics/pokemon/entei/icon.png differ diff --git a/graphics/pokemon/escavalier/icon.png b/graphics/pokemon/escavalier/icon.png index 32c3988341..94f646ecf7 100644 Binary files a/graphics/pokemon/escavalier/icon.png and b/graphics/pokemon/escavalier/icon.png differ diff --git a/graphics/pokemon/espeon/icon.png b/graphics/pokemon/espeon/icon.png index 86a4606c96..ebb9fd328b 100644 Binary files a/graphics/pokemon/espeon/icon.png and b/graphics/pokemon/espeon/icon.png differ diff --git a/graphics/pokemon/exeggutor/icon.png b/graphics/pokemon/exeggutor/icon.png index 1812258413..007641b095 100644 Binary files a/graphics/pokemon/exeggutor/icon.png and b/graphics/pokemon/exeggutor/icon.png differ diff --git a/graphics/pokemon/exploud/icon.png b/graphics/pokemon/exploud/icon.png index f803aecaba..3cb142dde2 100644 Binary files a/graphics/pokemon/exploud/icon.png and b/graphics/pokemon/exploud/icon.png differ diff --git a/graphics/pokemon/feraligatr/icon.png b/graphics/pokemon/feraligatr/icon.png index 2fe3556a84..74aca6aea4 100644 Binary files a/graphics/pokemon/feraligatr/icon.png and b/graphics/pokemon/feraligatr/icon.png differ diff --git a/graphics/pokemon/flygon/icon.png b/graphics/pokemon/flygon/icon.png index 10788b2253..f0c4e165ad 100644 Binary files a/graphics/pokemon/flygon/icon.png and b/graphics/pokemon/flygon/icon.png differ diff --git a/graphics/pokemon/foongus/icon.png b/graphics/pokemon/foongus/icon.png index f6e6171a46..c6e4ab426b 100644 Binary files a/graphics/pokemon/foongus/icon.png and b/graphics/pokemon/foongus/icon.png differ diff --git a/graphics/pokemon/froslass/icon.png b/graphics/pokemon/froslass/icon.png index dfaec88ceb..2869fb8de1 100644 Binary files a/graphics/pokemon/froslass/icon.png and b/graphics/pokemon/froslass/icon.png differ diff --git a/graphics/pokemon/gallade/icon.png b/graphics/pokemon/gallade/icon.png index a31e02fbbb..fce5123d9b 100644 Binary files a/graphics/pokemon/gallade/icon.png and b/graphics/pokemon/gallade/icon.png differ diff --git a/graphics/pokemon/gastly/icon.png b/graphics/pokemon/gastly/icon.png index 7a28a0575e..a5dc4527d6 100644 Binary files a/graphics/pokemon/gastly/icon.png and b/graphics/pokemon/gastly/icon.png differ diff --git a/graphics/pokemon/genesect/icon.png b/graphics/pokemon/genesect/icon.png index 6ab5e6f035..a448db6033 100644 Binary files a/graphics/pokemon/genesect/icon.png and b/graphics/pokemon/genesect/icon.png differ diff --git a/graphics/pokemon/giratina/icon.png b/graphics/pokemon/giratina/icon.png index 7a6ba19e98..235ea4721e 100644 Binary files a/graphics/pokemon/giratina/icon.png and b/graphics/pokemon/giratina/icon.png differ diff --git a/graphics/pokemon/gliscor/icon.png b/graphics/pokemon/gliscor/icon.png index deddd792df..74f4126d98 100644 Binary files a/graphics/pokemon/gliscor/icon.png and b/graphics/pokemon/gliscor/icon.png differ diff --git a/graphics/pokemon/golett/icon.png b/graphics/pokemon/golett/icon.png index 20dd1f45ab..a351317489 100644 Binary files a/graphics/pokemon/golett/icon.png and b/graphics/pokemon/golett/icon.png differ diff --git a/graphics/pokemon/gothita/icon.png b/graphics/pokemon/gothita/icon.png index 19da4895ba..8d280f5174 100644 Binary files a/graphics/pokemon/gothita/icon.png and b/graphics/pokemon/gothita/icon.png differ diff --git a/graphics/pokemon/gothorita/icon.png b/graphics/pokemon/gothorita/icon.png index d48dfbc966..9036dc6fc5 100644 Binary files a/graphics/pokemon/gothorita/icon.png and b/graphics/pokemon/gothorita/icon.png differ diff --git a/graphics/pokemon/groudon/icon.png b/graphics/pokemon/groudon/icon.png index 1c237537b6..69326145ca 100644 Binary files a/graphics/pokemon/groudon/icon.png and b/graphics/pokemon/groudon/icon.png differ diff --git a/graphics/pokemon/gurdurr/icon.png b/graphics/pokemon/gurdurr/icon.png index 5808e6c6a7..b445d735c2 100644 Binary files a/graphics/pokemon/gurdurr/icon.png and b/graphics/pokemon/gurdurr/icon.png differ diff --git a/graphics/pokemon/gyarados/icon.png b/graphics/pokemon/gyarados/icon.png index 889943b04f..41ccb5aee2 100644 Binary files a/graphics/pokemon/gyarados/icon.png and b/graphics/pokemon/gyarados/icon.png differ diff --git a/graphics/pokemon/haunter/icon.png b/graphics/pokemon/haunter/icon.png index 6de8948505..ea52910dd7 100644 Binary files a/graphics/pokemon/haunter/icon.png and b/graphics/pokemon/haunter/icon.png differ diff --git a/graphics/pokemon/hitmontop/icon.png b/graphics/pokemon/hitmontop/icon.png index a2af3bd248..7f8d63f915 100644 Binary files a/graphics/pokemon/hitmontop/icon.png and b/graphics/pokemon/hitmontop/icon.png differ diff --git a/graphics/pokemon/ho_oh/icon.png b/graphics/pokemon/ho_oh/icon.png index 7a7ce8af61..315683cc5e 100644 Binary files a/graphics/pokemon/ho_oh/icon.png and b/graphics/pokemon/ho_oh/icon.png differ diff --git a/graphics/pokemon/hoppip/icon.png b/graphics/pokemon/hoppip/icon.png index 8a9b708343..ba010a3653 100644 Binary files a/graphics/pokemon/hoppip/icon.png and b/graphics/pokemon/hoppip/icon.png differ diff --git a/graphics/pokemon/huntail/icon.png b/graphics/pokemon/huntail/icon.png index 0aa9a4055f..42a800657e 100644 Binary files a/graphics/pokemon/huntail/icon.png and b/graphics/pokemon/huntail/icon.png differ diff --git a/graphics/pokemon/hydreigon/icon.png b/graphics/pokemon/hydreigon/icon.png index 50e9b60a95..540b136372 100644 Binary files a/graphics/pokemon/hydreigon/icon.png and b/graphics/pokemon/hydreigon/icon.png differ diff --git a/graphics/pokemon/hypno/icon.png b/graphics/pokemon/hypno/icon.png index d9e0d83341..647e829d3f 100644 Binary files a/graphics/pokemon/hypno/icon.png and b/graphics/pokemon/hypno/icon.png differ diff --git a/graphics/pokemon/infernape/icon.png b/graphics/pokemon/infernape/icon.png index 6c16698646..8eb9e955c6 100644 Binary files a/graphics/pokemon/infernape/icon.png and b/graphics/pokemon/infernape/icon.png differ diff --git a/graphics/pokemon/karrablast/icon.png b/graphics/pokemon/karrablast/icon.png index f155236f28..9db6f2f4d3 100644 Binary files a/graphics/pokemon/karrablast/icon.png and b/graphics/pokemon/karrablast/icon.png differ diff --git a/graphics/pokemon/keldeo/icon.png b/graphics/pokemon/keldeo/icon.png index 4d8c580f22..a7b3f96ab5 100644 Binary files a/graphics/pokemon/keldeo/icon.png and b/graphics/pokemon/keldeo/icon.png differ diff --git a/graphics/pokemon/kingdra/icon.png b/graphics/pokemon/kingdra/icon.png index 02fdc71252..0873dedb4f 100644 Binary files a/graphics/pokemon/kingdra/icon.png and b/graphics/pokemon/kingdra/icon.png differ diff --git a/graphics/pokemon/kingler/icon.png b/graphics/pokemon/kingler/icon.png index 34a7299060..3f9d0b8b78 100644 Binary files a/graphics/pokemon/kingler/icon.png and b/graphics/pokemon/kingler/icon.png differ diff --git a/graphics/pokemon/koffing/icon.png b/graphics/pokemon/koffing/icon.png index dbd1d77c8c..0c5b361502 100644 Binary files a/graphics/pokemon/koffing/icon.png and b/graphics/pokemon/koffing/icon.png differ diff --git a/graphics/pokemon/krabby/icon.png b/graphics/pokemon/krabby/icon.png index 46eff557d9..8cedc348d0 100644 Binary files a/graphics/pokemon/krabby/icon.png and b/graphics/pokemon/krabby/icon.png differ diff --git a/graphics/pokemon/kyurem/icon.png b/graphics/pokemon/kyurem/icon.png index 6e7f6c7842..9883000b01 100644 Binary files a/graphics/pokemon/kyurem/icon.png and b/graphics/pokemon/kyurem/icon.png differ diff --git a/graphics/pokemon/lairon/icon.png b/graphics/pokemon/lairon/icon.png index 24bea9dfdc..27cb6edaa3 100644 Binary files a/graphics/pokemon/lairon/icon.png and b/graphics/pokemon/lairon/icon.png differ diff --git a/graphics/pokemon/landorus/icon.png b/graphics/pokemon/landorus/icon.png index b86a7cf7a8..4b2ec8d4f7 100644 Binary files a/graphics/pokemon/landorus/icon.png and b/graphics/pokemon/landorus/icon.png differ diff --git a/graphics/pokemon/larvesta/icon.png b/graphics/pokemon/larvesta/icon.png index 1a710b2522..8050f8bfdf 100644 Binary files a/graphics/pokemon/larvesta/icon.png and b/graphics/pokemon/larvesta/icon.png differ diff --git a/graphics/pokemon/latias/icon.png b/graphics/pokemon/latias/icon.png index d67b91b858..9c79f1e187 100644 Binary files a/graphics/pokemon/latias/icon.png and b/graphics/pokemon/latias/icon.png differ diff --git a/graphics/pokemon/latios/icon.png b/graphics/pokemon/latios/icon.png index 95590eb52d..d63fb4710e 100644 Binary files a/graphics/pokemon/latios/icon.png and b/graphics/pokemon/latios/icon.png differ diff --git a/graphics/pokemon/leafeon/icon.png b/graphics/pokemon/leafeon/icon.png index dd446932be..2aabf80257 100644 Binary files a/graphics/pokemon/leafeon/icon.png and b/graphics/pokemon/leafeon/icon.png differ diff --git a/graphics/pokemon/lileep/icon.png b/graphics/pokemon/lileep/icon.png index 0f3132ed43..034453bf99 100644 Binary files a/graphics/pokemon/lileep/icon.png and b/graphics/pokemon/lileep/icon.png differ diff --git a/graphics/pokemon/lugia/icon.png b/graphics/pokemon/lugia/icon.png index 17a3aaf746..fda93844ee 100644 Binary files a/graphics/pokemon/lugia/icon.png and b/graphics/pokemon/lugia/icon.png differ diff --git a/graphics/pokemon/luxray/icon.png b/graphics/pokemon/luxray/icon.png index 20d02d897a..9514dbc9b2 100644 Binary files a/graphics/pokemon/luxray/icon.png and b/graphics/pokemon/luxray/icon.png differ diff --git a/graphics/pokemon/magnemite/icon.png b/graphics/pokemon/magnemite/icon.png index ffefd1a45b..95b81cae03 100644 Binary files a/graphics/pokemon/magnemite/icon.png and b/graphics/pokemon/magnemite/icon.png differ diff --git a/graphics/pokemon/magneton/icon.png b/graphics/pokemon/magneton/icon.png index 733049b1d6..bde234ea11 100644 Binary files a/graphics/pokemon/magneton/icon.png and b/graphics/pokemon/magneton/icon.png differ diff --git a/graphics/pokemon/manaphy/icon.png b/graphics/pokemon/manaphy/icon.png index 4c491d4865..97dbb79c00 100644 Binary files a/graphics/pokemon/manaphy/icon.png and b/graphics/pokemon/manaphy/icon.png differ diff --git a/graphics/pokemon/manectric/icon.png b/graphics/pokemon/manectric/icon.png index 5379bbafa1..5d7f3e9508 100644 Binary files a/graphics/pokemon/manectric/icon.png and b/graphics/pokemon/manectric/icon.png differ diff --git a/graphics/pokemon/marowak/icon.png b/graphics/pokemon/marowak/icon.png index a973897056..af56d377c5 100644 Binary files a/graphics/pokemon/marowak/icon.png and b/graphics/pokemon/marowak/icon.png differ diff --git a/graphics/pokemon/mawile/icon.png b/graphics/pokemon/mawile/icon.png index ea60047c8a..f6605a6470 100644 Binary files a/graphics/pokemon/mawile/icon.png and b/graphics/pokemon/mawile/icon.png differ diff --git a/graphics/pokemon/medicham/icon.png b/graphics/pokemon/medicham/icon.png index 9e4bbc27cd..7988392838 100644 Binary files a/graphics/pokemon/medicham/icon.png and b/graphics/pokemon/medicham/icon.png differ diff --git a/graphics/pokemon/meganium/icon.png b/graphics/pokemon/meganium/icon.png index e05a33daf8..d7d390fe9c 100644 Binary files a/graphics/pokemon/meganium/icon.png and b/graphics/pokemon/meganium/icon.png differ diff --git a/graphics/pokemon/meloetta/icon.png b/graphics/pokemon/meloetta/icon.png index 376f3953a2..f640f80999 100644 Binary files a/graphics/pokemon/meloetta/icon.png and b/graphics/pokemon/meloetta/icon.png differ diff --git a/graphics/pokemon/meowth/icon.png b/graphics/pokemon/meowth/icon.png index b0a11aaddb..b721e3440e 100644 Binary files a/graphics/pokemon/meowth/icon.png and b/graphics/pokemon/meowth/icon.png differ diff --git a/graphics/pokemon/mesprit/icon.png b/graphics/pokemon/mesprit/icon.png index 86368bae24..2e5343d285 100644 Binary files a/graphics/pokemon/mesprit/icon.png and b/graphics/pokemon/mesprit/icon.png differ diff --git a/graphics/pokemon/metang/icon.png b/graphics/pokemon/metang/icon.png index 3916b65310..8d27afff4f 100644 Binary files a/graphics/pokemon/metang/icon.png and b/graphics/pokemon/metang/icon.png differ diff --git a/graphics/pokemon/mew/icon.png b/graphics/pokemon/mew/icon.png index 6e7175f437..d4b6ec9a72 100644 Binary files a/graphics/pokemon/mew/icon.png and b/graphics/pokemon/mew/icon.png differ diff --git a/graphics/pokemon/mewtwo/icon.png b/graphics/pokemon/mewtwo/icon.png index 8463a04ddc..b0dc901658 100644 Binary files a/graphics/pokemon/mewtwo/icon.png and b/graphics/pokemon/mewtwo/icon.png differ diff --git a/graphics/pokemon/mienfoo/icon.png b/graphics/pokemon/mienfoo/icon.png index b0a6ecf41f..e5c5367eef 100644 Binary files a/graphics/pokemon/mienfoo/icon.png and b/graphics/pokemon/mienfoo/icon.png differ diff --git a/graphics/pokemon/mienshao/icon.png b/graphics/pokemon/mienshao/icon.png index d73849304a..ff001b212f 100644 Binary files a/graphics/pokemon/mienshao/icon.png and b/graphics/pokemon/mienshao/icon.png differ diff --git a/graphics/pokemon/milotic/icon.png b/graphics/pokemon/milotic/icon.png index 5caf28bad0..f67de29314 100644 Binary files a/graphics/pokemon/milotic/icon.png and b/graphics/pokemon/milotic/icon.png differ diff --git a/graphics/pokemon/minccino/icon.png b/graphics/pokemon/minccino/icon.png index 27dd5405de..fbddf0e08a 100644 Binary files a/graphics/pokemon/minccino/icon.png and b/graphics/pokemon/minccino/icon.png differ diff --git a/graphics/pokemon/mismagius/icon.png b/graphics/pokemon/mismagius/icon.png index ad707f8cdd..07e075c1e8 100644 Binary files a/graphics/pokemon/mismagius/icon.png and b/graphics/pokemon/mismagius/icon.png differ diff --git a/graphics/pokemon/moltres/icon.png b/graphics/pokemon/moltres/icon.png index 99affaa0b2..70de854506 100644 Binary files a/graphics/pokemon/moltres/icon.png and b/graphics/pokemon/moltres/icon.png differ diff --git a/graphics/pokemon/monferno/icon.png b/graphics/pokemon/monferno/icon.png index 8a01ec5155..9fbfd12558 100644 Binary files a/graphics/pokemon/monferno/icon.png and b/graphics/pokemon/monferno/icon.png differ diff --git a/graphics/pokemon/mothim/icon.png b/graphics/pokemon/mothim/icon.png index ce6f8f0f6f..3312458681 100644 Binary files a/graphics/pokemon/mothim/icon.png and b/graphics/pokemon/mothim/icon.png differ diff --git a/graphics/pokemon/muk/icon.png b/graphics/pokemon/muk/icon.png index f56a9b367d..3168d1be46 100644 Binary files a/graphics/pokemon/muk/icon.png and b/graphics/pokemon/muk/icon.png differ diff --git a/graphics/pokemon/munna/icon.png b/graphics/pokemon/munna/icon.png index c7b2a7b04d..c97d44e6d6 100644 Binary files a/graphics/pokemon/munna/icon.png and b/graphics/pokemon/munna/icon.png differ diff --git a/graphics/pokemon/musharna/icon.png b/graphics/pokemon/musharna/icon.png index 4dfba9d127..c51d8ade64 100644 Binary files a/graphics/pokemon/musharna/icon.png and b/graphics/pokemon/musharna/icon.png differ diff --git a/graphics/pokemon/nidoking/icon.png b/graphics/pokemon/nidoking/icon.png index 377cb6672e..93d0b5f80e 100644 Binary files a/graphics/pokemon/nidoking/icon.png and b/graphics/pokemon/nidoking/icon.png differ diff --git a/graphics/pokemon/oddish/icon.png b/graphics/pokemon/oddish/icon.png index 32515b89f9..bef94316f2 100644 Binary files a/graphics/pokemon/oddish/icon.png and b/graphics/pokemon/oddish/icon.png differ diff --git a/graphics/pokemon/onix/icon.png b/graphics/pokemon/onix/icon.png index 947ead4ee2..b4de2a1cd2 100644 Binary files a/graphics/pokemon/onix/icon.png and b/graphics/pokemon/onix/icon.png differ diff --git a/graphics/pokemon/palkia/icon.png b/graphics/pokemon/palkia/icon.png index d84e9b8c3e..1476f20af5 100644 Binary files a/graphics/pokemon/palkia/icon.png and b/graphics/pokemon/palkia/icon.png differ diff --git a/graphics/pokemon/paras/icon.png b/graphics/pokemon/paras/icon.png index 26d937231f..6bc817d0be 100644 Binary files a/graphics/pokemon/paras/icon.png and b/graphics/pokemon/paras/icon.png differ diff --git a/graphics/pokemon/parasect/icon.png b/graphics/pokemon/parasect/icon.png index c6aaff12d7..27b8e09893 100644 Binary files a/graphics/pokemon/parasect/icon.png and b/graphics/pokemon/parasect/icon.png differ diff --git a/graphics/pokemon/pelipper/icon.png b/graphics/pokemon/pelipper/icon.png index 43ae7c2760..49debae717 100644 Binary files a/graphics/pokemon/pelipper/icon.png and b/graphics/pokemon/pelipper/icon.png differ diff --git a/graphics/pokemon/phione/icon.png b/graphics/pokemon/phione/icon.png index 1bfec4bbdd..c24a936ffc 100644 Binary files a/graphics/pokemon/phione/icon.png and b/graphics/pokemon/phione/icon.png differ diff --git a/graphics/pokemon/pichu/icon.png b/graphics/pokemon/pichu/icon.png index 5e3de4b990..d29fa7fb4a 100644 Binary files a/graphics/pokemon/pichu/icon.png and b/graphics/pokemon/pichu/icon.png differ diff --git a/graphics/pokemon/pignite/icon.png b/graphics/pokemon/pignite/icon.png index 78b1a8d72d..1190d639af 100644 Binary files a/graphics/pokemon/pignite/icon.png and b/graphics/pokemon/pignite/icon.png differ diff --git a/graphics/pokemon/politoed/icon.png b/graphics/pokemon/politoed/icon.png index 8ea308aa35..ffc6a38a48 100644 Binary files a/graphics/pokemon/politoed/icon.png and b/graphics/pokemon/politoed/icon.png differ diff --git a/graphics/pokemon/probopass/icon.png b/graphics/pokemon/probopass/icon.png index fe2df5f2e9..dbbe9c16a3 100644 Binary files a/graphics/pokemon/probopass/icon.png and b/graphics/pokemon/probopass/icon.png differ diff --git a/graphics/pokemon/raikou/icon.png b/graphics/pokemon/raikou/icon.png index fb0d48a5fd..77cc29d7e9 100644 Binary files a/graphics/pokemon/raikou/icon.png and b/graphics/pokemon/raikou/icon.png differ diff --git a/graphics/pokemon/rapidash/icon.png b/graphics/pokemon/rapidash/icon.png index 92dae70a64..a15a0a18a2 100644 Binary files a/graphics/pokemon/rapidash/icon.png and b/graphics/pokemon/rapidash/icon.png differ diff --git a/graphics/pokemon/reshiram/icon.png b/graphics/pokemon/reshiram/icon.png index 721b3a70fe..9bd6457f3e 100644 Binary files a/graphics/pokemon/reshiram/icon.png and b/graphics/pokemon/reshiram/icon.png differ diff --git a/graphics/pokemon/rotom/icon.png b/graphics/pokemon/rotom/icon.png index 354b6fd3dc..e2ecc8b804 100644 Binary files a/graphics/pokemon/rotom/icon.png and b/graphics/pokemon/rotom/icon.png differ diff --git a/graphics/pokemon/rufflet/icon.png b/graphics/pokemon/rufflet/icon.png index 331e60465a..f9129355a3 100644 Binary files a/graphics/pokemon/rufflet/icon.png and b/graphics/pokemon/rufflet/icon.png differ diff --git a/graphics/pokemon/salamence/icon.png b/graphics/pokemon/salamence/icon.png index 16cdf981f4..74b4ae776a 100644 Binary files a/graphics/pokemon/salamence/icon.png and b/graphics/pokemon/salamence/icon.png differ diff --git a/graphics/pokemon/sandslash/icon.png b/graphics/pokemon/sandslash/icon.png index a1d72a1ba7..18970df155 100644 Binary files a/graphics/pokemon/sandslash/icon.png and b/graphics/pokemon/sandslash/icon.png differ diff --git a/graphics/pokemon/scraggy/icon.png b/graphics/pokemon/scraggy/icon.png index e63301f36b..f1baf8d078 100644 Binary files a/graphics/pokemon/scraggy/icon.png and b/graphics/pokemon/scraggy/icon.png differ diff --git a/graphics/pokemon/sentret/icon.png b/graphics/pokemon/sentret/icon.png index 9a8040833b..e95d75ccd4 100644 Binary files a/graphics/pokemon/sentret/icon.png and b/graphics/pokemon/sentret/icon.png differ diff --git a/graphics/pokemon/seviper/icon.png b/graphics/pokemon/seviper/icon.png index 192e40a167..f6beb9f856 100644 Binary files a/graphics/pokemon/seviper/icon.png and b/graphics/pokemon/seviper/icon.png differ diff --git a/graphics/pokemon/sewaddle/icon.png b/graphics/pokemon/sewaddle/icon.png index 755c745d72..ae517307b4 100644 Binary files a/graphics/pokemon/sewaddle/icon.png and b/graphics/pokemon/sewaddle/icon.png differ diff --git a/graphics/pokemon/sharpedo/icon.png b/graphics/pokemon/sharpedo/icon.png index 2782511a3a..87a1c7e409 100644 Binary files a/graphics/pokemon/sharpedo/icon.png and b/graphics/pokemon/sharpedo/icon.png differ diff --git a/graphics/pokemon/shellder/icon.png b/graphics/pokemon/shellder/icon.png index 8d74f82624..8ffeb3edfa 100644 Binary files a/graphics/pokemon/shellder/icon.png and b/graphics/pokemon/shellder/icon.png differ diff --git a/graphics/pokemon/shiftry/icon.png b/graphics/pokemon/shiftry/icon.png index 14b4bdab6a..3d2be13a68 100644 Binary files a/graphics/pokemon/shiftry/icon.png and b/graphics/pokemon/shiftry/icon.png differ diff --git a/graphics/pokemon/sigilyph/icon.png b/graphics/pokemon/sigilyph/icon.png index c599ce22a2..afaf880d54 100644 Binary files a/graphics/pokemon/sigilyph/icon.png and b/graphics/pokemon/sigilyph/icon.png differ diff --git a/graphics/pokemon/slakoth/icon.png b/graphics/pokemon/slakoth/icon.png index 3b408571f1..e11811efe1 100644 Binary files a/graphics/pokemon/slakoth/icon.png and b/graphics/pokemon/slakoth/icon.png differ diff --git a/graphics/pokemon/slowking/icon.png b/graphics/pokemon/slowking/icon.png index c4d5bdbe7a..8527e8982d 100644 Binary files a/graphics/pokemon/slowking/icon.png and b/graphics/pokemon/slowking/icon.png differ diff --git a/graphics/pokemon/snorlax/icon.png b/graphics/pokemon/snorlax/icon.png index efb140e863..36aeeabee2 100644 Binary files a/graphics/pokemon/snorlax/icon.png and b/graphics/pokemon/snorlax/icon.png differ diff --git a/graphics/pokemon/solrock/icon.png b/graphics/pokemon/solrock/icon.png index 4a0410cb55..07a416c283 100644 Binary files a/graphics/pokemon/solrock/icon.png and b/graphics/pokemon/solrock/icon.png differ diff --git a/graphics/pokemon/staraptor/icon.png b/graphics/pokemon/staraptor/icon.png index 1116f07df0..ecad4e21bf 100644 Binary files a/graphics/pokemon/staraptor/icon.png and b/graphics/pokemon/staraptor/icon.png differ diff --git a/graphics/pokemon/staravia/icon.png b/graphics/pokemon/staravia/icon.png index 468f38dd2f..8fcb75d879 100644 Binary files a/graphics/pokemon/staravia/icon.png and b/graphics/pokemon/staravia/icon.png differ diff --git a/graphics/pokemon/steelix/icon.png b/graphics/pokemon/steelix/icon.png index 2cceec69a9..defe78d7d6 100644 Binary files a/graphics/pokemon/steelix/icon.png and b/graphics/pokemon/steelix/icon.png differ diff --git a/graphics/pokemon/suicune/icon.png b/graphics/pokemon/suicune/icon.png index 48a3d97fb4..fbaff5a8cd 100644 Binary files a/graphics/pokemon/suicune/icon.png and b/graphics/pokemon/suicune/icon.png differ diff --git a/graphics/pokemon/swablu/icon.png b/graphics/pokemon/swablu/icon.png index c1aa25e996..46be1f4033 100644 Binary files a/graphics/pokemon/swablu/icon.png and b/graphics/pokemon/swablu/icon.png differ diff --git a/graphics/pokemon/swalot/icon.png b/graphics/pokemon/swalot/icon.png index 3611b27fee..09f7162d2a 100644 Binary files a/graphics/pokemon/swalot/icon.png and b/graphics/pokemon/swalot/icon.png differ diff --git a/graphics/pokemon/tauros/icon.png b/graphics/pokemon/tauros/icon.png index 08975b0bce..de4bdd330d 100644 Binary files a/graphics/pokemon/tauros/icon.png and b/graphics/pokemon/tauros/icon.png differ diff --git a/graphics/pokemon/tentacool/icon.png b/graphics/pokemon/tentacool/icon.png index 5870f50b8e..64a9ef3645 100644 Binary files a/graphics/pokemon/tentacool/icon.png and b/graphics/pokemon/tentacool/icon.png differ diff --git a/graphics/pokemon/tentacruel/icon.png b/graphics/pokemon/tentacruel/icon.png index 60bfe216d0..e6a797e529 100644 Binary files a/graphics/pokemon/tentacruel/icon.png and b/graphics/pokemon/tentacruel/icon.png differ diff --git a/graphics/pokemon/thundurus/icon.png b/graphics/pokemon/thundurus/icon.png index 9295bb7526..9b11665116 100644 Binary files a/graphics/pokemon/thundurus/icon.png and b/graphics/pokemon/thundurus/icon.png differ diff --git a/graphics/pokemon/tirtouga/icon.png b/graphics/pokemon/tirtouga/icon.png index feb79c7d2f..dfb2983764 100644 Binary files a/graphics/pokemon/tirtouga/icon.png and b/graphics/pokemon/tirtouga/icon.png differ diff --git a/graphics/pokemon/tornadus/icon.png b/graphics/pokemon/tornadus/icon.png index a95eccdb30..271e4c6b69 100644 Binary files a/graphics/pokemon/tornadus/icon.png and b/graphics/pokemon/tornadus/icon.png differ diff --git a/graphics/pokemon/tropius/icon.png b/graphics/pokemon/tropius/icon.png index 647767ca3d..9e7b61b531 100644 Binary files a/graphics/pokemon/tropius/icon.png and b/graphics/pokemon/tropius/icon.png differ diff --git a/graphics/pokemon/trubbish/icon.png b/graphics/pokemon/trubbish/icon.png index cbf0483f66..b7fa282cd8 100644 Binary files a/graphics/pokemon/trubbish/icon.png and b/graphics/pokemon/trubbish/icon.png differ diff --git a/graphics/pokemon/typhlosion/icon.png b/graphics/pokemon/typhlosion/icon.png index b69680648c..e5e5ea51c1 100644 Binary files a/graphics/pokemon/typhlosion/icon.png and b/graphics/pokemon/typhlosion/icon.png differ diff --git a/graphics/pokemon/tyranitar/icon.png b/graphics/pokemon/tyranitar/icon.png index 3ab06613c9..b692b99769 100644 Binary files a/graphics/pokemon/tyranitar/icon.png and b/graphics/pokemon/tyranitar/icon.png differ diff --git a/graphics/pokemon/vanilluxe/icon.png b/graphics/pokemon/vanilluxe/icon.png index a7814563b4..c2f85c1e31 100644 Binary files a/graphics/pokemon/vanilluxe/icon.png and b/graphics/pokemon/vanilluxe/icon.png differ diff --git a/graphics/pokemon/venusaur/icon.png b/graphics/pokemon/venusaur/icon.png index c841ddde4f..ce3b2290ac 100644 Binary files a/graphics/pokemon/venusaur/icon.png and b/graphics/pokemon/venusaur/icon.png differ diff --git a/graphics/pokemon/victini/icon.png b/graphics/pokemon/victini/icon.png index dfbab1baaf..686f4a499f 100644 Binary files a/graphics/pokemon/victini/icon.png and b/graphics/pokemon/victini/icon.png differ diff --git a/graphics/pokemon/vileplume/icon.png b/graphics/pokemon/vileplume/icon.png index a3cb2b0b59..3dcf11ce39 100644 Binary files a/graphics/pokemon/vileplume/icon.png and b/graphics/pokemon/vileplume/icon.png differ diff --git a/graphics/pokemon/virizion/icon.png b/graphics/pokemon/virizion/icon.png index 4f7390e1f0..68c0abd730 100644 Binary files a/graphics/pokemon/virizion/icon.png and b/graphics/pokemon/virizion/icon.png differ diff --git a/graphics/pokemon/volcarona/icon.png b/graphics/pokemon/volcarona/icon.png index c518ab0b4b..a37d965d98 100644 Binary files a/graphics/pokemon/volcarona/icon.png and b/graphics/pokemon/volcarona/icon.png differ diff --git a/graphics/pokemon/voltorb/icon.png b/graphics/pokemon/voltorb/icon.png index 551dbf281c..f0113355b0 100644 Binary files a/graphics/pokemon/voltorb/icon.png and b/graphics/pokemon/voltorb/icon.png differ diff --git a/graphics/pokemon/wailord/icon.png b/graphics/pokemon/wailord/icon.png index a6a6ff135c..de5a2c7078 100644 Binary files a/graphics/pokemon/wailord/icon.png and b/graphics/pokemon/wailord/icon.png differ diff --git a/graphics/pokemon/watchog/icon.png b/graphics/pokemon/watchog/icon.png index 9ea2f13308..4051ebde8b 100644 Binary files a/graphics/pokemon/watchog/icon.png and b/graphics/pokemon/watchog/icon.png differ diff --git a/graphics/pokemon/weezing/icon.png b/graphics/pokemon/weezing/icon.png index c393384988..5c2421a2a9 100644 Binary files a/graphics/pokemon/weezing/icon.png and b/graphics/pokemon/weezing/icon.png differ diff --git a/graphics/pokemon/woobat/icon.png b/graphics/pokemon/woobat/icon.png index 354353e885..c3640d5ad0 100644 Binary files a/graphics/pokemon/woobat/icon.png and b/graphics/pokemon/woobat/icon.png differ diff --git a/graphics/pokemon/wormadam/icon.png b/graphics/pokemon/wormadam/icon.png index eb622fca23..866acd17ba 100644 Binary files a/graphics/pokemon/wormadam/icon.png and b/graphics/pokemon/wormadam/icon.png differ diff --git a/graphics/pokemon/wormadam/sandy_cloak/icon.png b/graphics/pokemon/wormadam/sandy_cloak/icon.png index 2c165141be..a45417a616 100644 Binary files a/graphics/pokemon/wormadam/sandy_cloak/icon.png and b/graphics/pokemon/wormadam/sandy_cloak/icon.png differ diff --git a/graphics/pokemon/wormadam/trash_cloak/icon.png b/graphics/pokemon/wormadam/trash_cloak/icon.png index f971e3fb59..6834629e9a 100644 Binary files a/graphics/pokemon/wormadam/trash_cloak/icon.png and b/graphics/pokemon/wormadam/trash_cloak/icon.png differ diff --git a/graphics/pokemon/wynaut/icon.png b/graphics/pokemon/wynaut/icon.png index 042c182352..c3f81995e6 100644 Binary files a/graphics/pokemon/wynaut/icon.png and b/graphics/pokemon/wynaut/icon.png differ diff --git a/graphics/pokemon/zangoose/icon.png b/graphics/pokemon/zangoose/icon.png index 83a9ce97fd..80f3b7c450 100644 Binary files a/graphics/pokemon/zangoose/icon.png and b/graphics/pokemon/zangoose/icon.png differ diff --git a/graphics/pokemon/zekrom/icon.png b/graphics/pokemon/zekrom/icon.png index 33115bae9d..c4380ec69a 100644 Binary files a/graphics/pokemon/zekrom/icon.png and b/graphics/pokemon/zekrom/icon.png differ diff --git a/graphics/pokemon/zoroark/icon.png b/graphics/pokemon/zoroark/icon.png index 08d5206f3b..338a576a4a 100644 Binary files a/graphics/pokemon/zoroark/icon.png and b/graphics/pokemon/zoroark/icon.png differ diff --git a/graphics/pokemon/zweilous/icon.png b/graphics/pokemon/zweilous/icon.png index 7baef54fb0..1c0a166af9 100644 Binary files a/graphics/pokemon/zweilous/icon.png and b/graphics/pokemon/zweilous/icon.png differ diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index 95f6619c5e..68c0dbd993 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -145,6 +145,7 @@ bool32 AnyPartyMemberStatused(u8 battlerId, bool32 checkSoundproof); u32 ShouldTryToFlinch(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u16 move); bool32 ShouldTrap(u8 battlerAtk, u8 battlerDef, u16 move); bool32 IsWakeupTurn(u8 battler); +bool32 AI_IsBattlerAsleepOrComatose(u8 battlerId); // partner logic u16 GetAllyChosenMove(u8 battlerId); diff --git a/include/battle_interface.h b/include/battle_interface.h index e0f30b3097..e2937748a4 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -81,7 +81,6 @@ u8 CreateSafariPlayerHealthboxSprites(void); void SetBattleBarStruct(u8 battler, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue); void SetHealthboxSpriteInvisible(u8 healthboxSpriteId); void SetHealthboxSpriteVisible(u8 healthboxSpriteId); -void DestoryHealthboxSprite(u8 healthboxSpriteId); void DummyBattleInterfaceFunc(u8 healthboxSpriteId, bool8 isDoubleBattleBankOnly); void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHpBoxes); void InitBattlerHealthboxCoords(u8 battler); diff --git a/include/battle_main.h b/include/battle_main.h index 8d1aad454e..4f20e4c17a 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -70,6 +70,8 @@ void SpecialStatusesClear(void); void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk); bool32 IsWildMonSmart(void); u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer *trainer, bool32 firstTrainer, u32 battleTypeFlags); +void ModifyPersonalityForNature(u32 *personality, u32 newNature); +u32 GeneratePersonalityForGender(u32 gender, u32 species); extern struct MultiPartnerMenuPokemon gMultiPartnerParty[MULTI_PARTY_SIZE]; diff --git a/include/config/battle.h b/include/config/battle.h index 4a3d6382fb..24f4ad4f15 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -183,6 +183,7 @@ // Other settings #define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. +#define B_DOUBLE_WILD_REQUIRE_2_MONS FALSE // If set to TRUE, Wild Double Battles will default to Single Battles when the player only has 1 usuable Pokémon, ignoring B_DOUBLE_WILD_CHANCE and B_FLAG_FORCE_DOUBLE_WILD. #define B_MULTI_BATTLE_WHITEOUT GEN_LATEST // In Gen4+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. #define B_EVOLUTION_AFTER_WHITEOUT GEN_LATEST // In Gen6+, Pokemon that qualify for evolution after battle will evolve even if the player loses. #define B_WILD_NATURAL_ENEMIES TRUE // If set to TRUE, certain wild mon species will attack other species when partnered in double wild battles (eg. Zangoose vs Seviper) diff --git a/include/config/overworld.h b/include/config/overworld.h index 7831858d27..f62588b5fd 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -4,6 +4,9 @@ // Movement config #define OW_RUNNING_INDOORS GEN_LATEST // In Gen4+, players are allowed to run indoors. +// Other settings +#define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all. + // Overworld flags // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. // Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature. diff --git a/include/constants/items.h b/include/constants/items.h index 2d186601b6..2b6ba5c8f2 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -969,7 +969,11 @@ #define ITEM_GRISEOUS_CORE 793 #define ITEM_LUSTROUS_GLOBE 794 -#define ITEMS_COUNT 795 +#define ITEM_BLACK_AUGURITE 795 +#define ITEM_LINKING_CORD 796 +#define ITEM_PEAT_BLOCK 797 + +#define ITEMS_COUNT 798 #define ITEM_FIELD_ARROW ITEMS_COUNT // A special item id associated with "Cancel"/"Exit" etc. in a list of items or decorations diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 0a9b6d1536..cf6cc8751b 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -310,6 +310,7 @@ #define EVO_SCRIPT_TRIGGER_DMG 36 // Pokémon has specified HP below max, then player interacts trigger #define EVO_DARK_SCROLL 37 // interacts with Scroll of Darkness #define EVO_WATER_SCROLL 38 // interacts with Scroll of Waters +#define EVO_ITEM_NIGHT 39 // specified item is used on Pokémon at night #define EVOS_PER_MON 10 diff --git a/include/graphics.h b/include/graphics.h index 7cf9030349..76f6e5d7cf 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -7997,6 +7997,12 @@ extern const u32 gItemIcon_RibbonSweet[]; extern const u32 gItemIconPalette_RibbonSweet[]; extern const u32 gItemIcon_Everstone[]; extern const u32 gItemIconPalette_Everstone[]; +extern const u32 gItemIcon_BlackAugurite[]; +extern const u32 gItemIconPalette_BlackAugurite[]; +extern const u32 gItemIcon_LinkingCord[]; +extern const u32 gItemIconPalette_LinkingCord[]; +extern const u32 gItemIcon_PeatBlock[]; +extern const u32 gItemIconPalette_PeatBlock[]; // Nectars extern const u32 gItemIcon_RedNectar[]; extern const u32 gItemIconPalette_RedNectar[]; diff --git a/include/random.h b/include/random.h index 60c718348c..e7c2a3e284 100644 --- a/include/random.h +++ b/include/random.h @@ -29,7 +29,12 @@ void SeedRng2(u16 seed); * * RandomTag identifies the purpose of the value. * - * RandomUniform(tag, lo, hi) returns a number from lo to hi inclusive. + * RandomUniform(tag, lo, hi) returns a number from lo to hi inclusive + * with uniform probability. + * + * RandomElement(tag, array) returns an element in array with uniform + * probability. The array must be known at compile-time (e.g. a global + * const array). * * RandomPercentage(tag, t) returns FALSE with probability (1-t)/100, * and TRUE with probability t/100. @@ -47,6 +52,7 @@ enum RandomTag RNG_CRITICAL_HIT, RNG_CUTE_CHARM, RNG_DAMAGE_MODIFIER, + RNG_DIRE_CLAW, RNG_FLAME_BODY, RNG_FORCE_RANDOM_SWITCH, RNG_FROZEN, @@ -60,6 +66,7 @@ enum RandomTag RNG_SPEED_TIE, RNG_STATIC, RNG_STENCH, + RNG_TRI_ATTACK, }; #define RandomWeighted(tag, ...) \ @@ -73,14 +80,34 @@ enum RandomTag #define RandomPercentage(tag, t) \ ({ \ - const u8 weights[] = { 100 - t, t }; \ - RandomWeightedArray(tag, 100, ARRAY_COUNT(weights), weights); \ + u32 r; \ + if (t <= 0) \ + { \ + r = FALSE; \ + } \ + else if (t >= 100) \ + { \ + r = TRUE; \ + } \ + else \ + { \ + const u8 weights[] = { 100 - t, t }; \ + r = RandomWeightedArray(tag, 100, ARRAY_COUNT(weights), weights); \ + } \ + r; \ + }) + +#define RandomElement(tag, array) \ + ({ \ + *(typeof((array)[0]) *)RandomElementArray(tag, array, sizeof((array)[0]), ARRAY_COUNT(array)); \ }) u32 RandomUniform(enum RandomTag, u32 lo, u32 hi); u32 RandomWeightedArray(enum RandomTag, u32 sum, u32 n, const u8 *weights); +const void *RandomElementArray(enum RandomTag, const void *array, size_t size, size_t count); u32 RandomUniformDefault(enum RandomTag, u32 lo, u32 hi); u32 RandomWeightedArrayDefault(enum RandomTag, u32 sum, u32 n, const u8 *weights); +const void *RandomElementArrayDefault(enum RandomTag, const void *array, size_t size, size_t count); #endif // GUARD_RANDOM_H diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 6e308003ad..95e85ab894 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -987,7 +987,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) } break; case EFFECT_DREAM_EATER: - if (!(gBattleMons[battlerDef].status1 & STATUS1_SLEEP) || AI_DATA->abilities[battlerDef] == ABILITY_COMATOSE) + if (!AI_IsBattlerAsleepOrComatose(battlerDef)) score -= 8; else if (effectiveness == AI_EFFECTIVENESS_x0) score -= 10; @@ -1466,7 +1466,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_SNORE: case EFFECT_SLEEP_TALK: - if (IsWakeupTurn(battlerAtk) || (!(gBattleMons[battlerAtk].status1 & STATUS1_SLEEP) || AI_DATA->abilities[battlerAtk] != ABILITY_COMATOSE)) + if (IsWakeupTurn(battlerAtk) || !AI_IsBattlerAsleepOrComatose(battlerAtk)) score -= 10; // if mon will wake up, is not asleep, or is not comatose break; case EFFECT_MEAN_LOOK: @@ -1476,7 +1476,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_NIGHTMARE: if (gBattleMons[battlerDef].status2 & STATUS2_NIGHTMARE) score -= 10; - else if (!(gBattleMons[battlerDef].status1 & STATUS1_SLEEP) || AI_DATA->abilities[battlerDef] == ABILITY_COMATOSE) + else if (!AI_IsBattlerAsleepOrComatose(battlerDef)) score -= 8; else if (DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) score -= 10; @@ -3793,7 +3793,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_NIGHTMARE: if (AI_DATA->abilities[battlerDef] != ABILITY_MAGIC_GUARD && !(gBattleMons[battlerDef].status2 & STATUS2_NIGHTMARE) - && (AI_DATA->abilities[battlerDef] == ABILITY_COMATOSE || gBattleMons[battlerDef].status1 & STATUS1_SLEEP)) + && AI_IsBattlerAsleepOrComatose(battlerDef)) { score += 5; if (IsBattlerTrapped(battlerDef, TRUE)) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 3160dfa3f5..22c7bb633c 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -3757,3 +3757,8 @@ bool32 ShouldUseZMove(u8 battlerAtk, u8 battlerDef, u16 chosenMove) return FALSE; } + +bool32 AI_IsBattlerAsleepOrComatose(u8 battlerId) +{ + return (gBattleMons[battlerId].status1 & STATUS1_SLEEP) || AI_DATA->abilities[battlerId] == ABILITY_COMATOSE; +} diff --git a/src/battle_interface.c b/src/battle_interface.c index 35c0e60c63..7f7e1d20f0 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -186,7 +186,6 @@ static void MegaIndicator_SetVisibilities(u32 healthboxId, bool32 invisible); static void MegaIndicator_UpdateLevel(u32 healthboxId, u32 level); static void MegaIndicator_CreateSprites(u32 battlerId, u32 healthboxSpriteId); static void MegaIndicator_UpdateOamPriorities(u32 healthboxId, u32 oamPriority); -static void MegaIndicator_DestroySprites(u32 healthboxSpriteId); static void SpriteCb_MegaIndicator(struct Sprite *); static u8 GetStatusIconForBattlerId(u8, u8); @@ -884,14 +883,6 @@ static void UpdateSpritePos(u8 spriteId, s16 x, s16 y) gSprites[spriteId].y = y; } -void DestoryHealthboxSprite(u8 healthboxSpriteId) -{ - MegaIndicator_DestroySprites(healthboxSpriteId); - DestroySprite(&gSprites[gSprites[healthboxSpriteId].oam.affineParam]); - DestroySprite(&gSprites[gSprites[healthboxSpriteId].hMain_HealthBarSpriteId]); - DestroySprite(&gSprites[healthboxSpriteId]); -} - void DummyBattleInterfaceFunc(u8 healthboxSpriteId, bool8 isDoubleBattleBattlerOnly) { @@ -1540,6 +1531,9 @@ void MegaIndicator_SetVisibilities(u32 healthboxId, bool32 invisible) u8 *spriteIds = MegaIndicator_GetSpriteIds(healthboxId); u32 battlerId = gSprites[healthboxId].hMain_Battler; + if (GetSafariZoneFlag()) + return; + for (i = 0; i < INDICATOR_COUNT; i++) { if (invisible == TRUE) @@ -1599,15 +1593,6 @@ static void MegaIndicator_CreateSprites(u32 battlerId, u32 healthboxSpriteId) } } -static void MegaIndicator_DestroySprites(u32 healthboxSpriteId) -{ - u32 i; - u8 *spriteIds = MegaIndicator_GetSpriteIds(healthboxSpriteId); - - for (i = 0; i < INDICATOR_COUNT; i++) - DestroySprite(&gSprites[spriteIds[i]]); -} - static void SpriteCb_MegaIndicator(struct Sprite *sprite) { u32 battlerId = sprite->tBattler; diff --git a/src/battle_main.c b/src/battle_main.c index 8175528525..b80042ee9c 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -120,8 +120,7 @@ static void SpriteCB_UnusedBattleInit_Main(struct Sprite *sprite); static void TrySpecialEvolution(void); static u32 Crc32B (const u8 *data, u32 size); static u32 GeneratePartyHash(const struct Trainer *trainer, u32 i); -static void ModifyPersonalityForNature(u32 *personality, u32 newNature); -static u32 GeneratePersonalityForGender(u32 gender, u32 species); +static void CustomTrainerPartyAssignMoves(struct Pokemon *mon, const struct TrainerMonCustomized *partyEntry); EWRAM_DATA u16 gBattle_BG0_X = 0; EWRAM_DATA u16 gBattle_BG0_Y = 0; @@ -1925,7 +1924,7 @@ static u32 GeneratePartyHash(const struct Trainer *trainer, u32 i) return Crc32B(buffer, n); } -static void ModifyPersonalityForNature(u32 *personality, u32 newNature) +void ModifyPersonalityForNature(u32 *personality, u32 newNature) { u32 nature = GetNatureFromPersonality(*personality); s32 diff = abs(nature - newNature); @@ -1938,7 +1937,7 @@ static void ModifyPersonalityForNature(u32 *personality, u32 newNature) *personality -= (diff * sign); } -static u32 GeneratePersonalityForGender(u32 gender, u32 species) +u32 GeneratePersonalityForGender(u32 gender, u32 species) { const struct SpeciesInfo *speciesInfo = &gSpeciesInfo[species]; if (gender == MON_MALE) @@ -1947,6 +1946,29 @@ static u32 GeneratePersonalityForGender(u32 gender, u32 species) return speciesInfo->genderRatio / 2; } +static void CustomTrainerPartyAssignMoves(struct Pokemon *mon, const struct TrainerMonCustomized *partyEntry) +{ + bool32 noMoveSet = TRUE; + u32 j; + + for (j = 0; j < MAX_MON_MOVES; ++j) + { + if (partyEntry->moves[j] != MOVE_NONE) + noMoveSet = FALSE; + } + if (noMoveSet) + { + // TODO: Figure out a default strategy when moves are not set, to generate a good moveset + return; + } + + for (j = 0; j < MAX_MON_MOVES; ++j) + { + SetMonData(mon, MON_DATA_MOVE1 + j, &partyEntry->moves[j]); + SetMonData(mon, MON_DATA_PP1 + j, &gBattleMoves[partyEntry->moves[j]].pp); + } +} + u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer *trainer, bool32 firstTrainer, u32 battleTypeFlags) { u32 personalityValue; @@ -2049,12 +2071,7 @@ u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer CreateMon(&party[i], partyData[i].species, partyData[i].lvl, 0, TRUE, personalityValue, otIdType, fixedOtId); SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem); - // TODO: Figure out a default strategy when moves are not set, to generate a good moveset - for (j = 0; j < MAX_MON_MOVES; ++j) - { - SetMonData(&party[i], MON_DATA_MOVE1 + j, &partyData[i].moves[j]); - SetMonData(&party[i], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp); - } + CustomTrainerPartyAssignMoves(&party[i], &partyData[i]); SetMonData(&party[i], MON_DATA_IVS, &(partyData[i].iv)); if (partyData[i].ev != NULL) { @@ -2111,7 +2128,13 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir return 0; retVal = CreateNPCTrainerPartyFromTrainer(party, &gTrainers[trainerNum], firstTrainer, gBattleTypeFlags); - gBattleTypeFlags |= gTrainers[trainerNum].doubleBattle; + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & (BATTLE_TYPE_FRONTIER + | BATTLE_TYPE_EREADER_TRAINER + | BATTLE_TYPE_TRAINER_HILL))) + { + gBattleTypeFlags |= gTrainers[trainerNum].doubleBattle; + } + return retVal; } void VBlankCB_Battle(void) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 22c20c698b..bba3bdd29e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3318,7 +3318,8 @@ void SetMoveEffect(bool32 primary, u32 certain) } else { - gBattleScripting.moveEffect = Random() % 3 + 3; + static const u8 sTriAttackEffects[] = { MOVE_EFFECT_BURN, MOVE_EFFECT_FREEZE, MOVE_EFFECT_PARALYSIS }; + gBattleScripting.moveEffect = RandomElement(RNG_TRI_ATTACK, sTriAttackEffects); SetMoveEffect(FALSE, 0); } break; @@ -3779,7 +3780,7 @@ void SetMoveEffect(bool32 primary, u32 certain) if (!gBattleMons[gEffectBattler].status1) { static const u8 sDireClawEffects[] = { MOVE_EFFECT_POISON, MOVE_EFFECT_PARALYSIS, MOVE_EFFECT_SLEEP }; - gBattleScripting.moveEffect = sDireClawEffects[Random() % ARRAY_COUNT(sDireClawEffects)]; + gBattleScripting.moveEffect = RandomElement(RNG_DIRE_CLAW, sDireClawEffects); SetMoveEffect(TRUE, 0); } break; diff --git a/src/battle_tower.c b/src/battle_tower.c index a4758b9304..4e16467f04 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -3103,25 +3103,38 @@ static void FillPartnerParty(u16 trainerId) case F_TRAINER_PARTY_EVERYTHING_CUSTOMIZED: { const struct TrainerMonCustomized *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party.EverythingCustomized; + u32 otIdType = OT_ID_RANDOM_NO_SHINY; - CreateMon(&gPlayerParty[i], partyData[i].species, partyData[i].lvl, 0, TRUE, j, TRUE, otID); - SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem); + if (partyData[i].gender == TRAINER_MON_MALE) + j = (j & 0xFFFFFF00) | GeneratePersonalityForGender(MON_MALE, partyData[i].species); + else if (partyData[i].gender == TRAINER_MON_FEMALE) + j = (j & 0xFFFFFF00) | GeneratePersonalityForGender(MON_FEMALE, partyData[i].species); + if (partyData[i].nature != 0) + ModifyPersonalityForNature(&j, partyData[i].nature - 1); + if (partyData[i].isShiny) + { + otIdType = OT_ID_PRESET; + otID = HIHALF(j) ^ LOHALF(j); + } + + CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, 0, TRUE, j, otIdType, otID); + SetMonData(&gPlayerParty[i + 3], MON_DATA_HELD_ITEM, &partyData[i].heldItem); // TODO: Figure out a default strategy when moves are not set, to generate a good moveset for (j = 0; j < MAX_MON_MOVES; ++j) { - SetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + j, &partyData[i].moves[j]); - SetMonData(&gPlayerParty[i], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp); + SetMonData(&gPlayerParty[i+3], MON_DATA_MOVE1 + j, &partyData[i].moves[j]); + SetMonData(&gPlayerParty[i+3], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp); } - SetMonData(&gPlayerParty[i], MON_DATA_IVS, &(partyData[i].iv)); + SetMonData(&gPlayerParty[i+3], MON_DATA_IVS, &(partyData[i].iv)); if (partyData[i].ev != NULL) { - SetMonData(&gPlayerParty[i], MON_DATA_HP_EV, &(partyData[i].ev[0])); - SetMonData(&gPlayerParty[i], MON_DATA_ATK_EV, &(partyData[i].ev[1])); - SetMonData(&gPlayerParty[i], MON_DATA_DEF_EV, &(partyData[i].ev[2])); - SetMonData(&gPlayerParty[i], MON_DATA_SPATK_EV, &(partyData[i].ev[3])); - SetMonData(&gPlayerParty[i], MON_DATA_SPDEF_EV, &(partyData[i].ev[4])); - SetMonData(&gPlayerParty[i], MON_DATA_SPEED_EV, &(partyData[i].ev[5])); + SetMonData(&gPlayerParty[i+3], MON_DATA_HP_EV, &(partyData[i].ev[0])); + SetMonData(&gPlayerParty[i+3], MON_DATA_ATK_EV, &(partyData[i].ev[1])); + SetMonData(&gPlayerParty[i+3], MON_DATA_DEF_EV, &(partyData[i].ev[2])); + SetMonData(&gPlayerParty[i+3], MON_DATA_SPATK_EV, &(partyData[i].ev[3])); + SetMonData(&gPlayerParty[i+3], MON_DATA_SPDEF_EV, &(partyData[i].ev[4])); + SetMonData(&gPlayerParty[i+3], MON_DATA_SPEED_EV, &(partyData[i].ev[5])); } if (partyData[i].ability != ABILITY_NONE) { @@ -3133,19 +3146,19 @@ static void FillPartnerParty(u16 trainerId) break; } if (j < maxAbilities) - SetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM, &j); + SetMonData(&gPlayerParty[i+3], MON_DATA_ABILITY_NUM, &j); } - SetMonData(&gPlayerParty[i], MON_DATA_FRIENDSHIP, &(partyData[i].friendship)); + SetMonData(&gPlayerParty[i+3], MON_DATA_FRIENDSHIP, &(partyData[i].friendship)); if (partyData[i].ball != ITEM_NONE) { ball = partyData[i].ball; - SetMonData(&gPlayerParty[i], MON_DATA_POKEBALL, &ball); + SetMonData(&gPlayerParty[i+3], MON_DATA_POKEBALL, &ball); } if (partyData[i].nickname != NULL) { - SetMonData(&gPlayerParty[i], MON_DATA_NICKNAME, partyData[i].nickname); + SetMonData(&gPlayerParty[i+3], MON_DATA_NICKNAME, partyData[i].nickname); } - CalculateMonStats(&gPlayerParty[i]); + CalculateMonStats(&gPlayerParty[i+3]); } } diff --git a/src/battle_util.c b/src/battle_util.c index dea28b5d83..46b2de4421 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8609,7 +8609,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower *= 2; break; case EFFECT_PURSUIT: - if (gActionsByTurnOrder[GetBattlerTurnOrderNum(gBattlerTarget)] == B_ACTION_SWITCH) + if (gActionsByTurnOrder[GetBattlerTurnOrderNum(battlerDef)] == B_ACTION_SWITCH) basePower *= 2; break; case EFFECT_NATURAL_GIFT: @@ -8743,12 +8743,12 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) #if B_HIDDEN_POWER_DMG < GEN_6 u8 powerBits; - powerBits = ((gBattleMons[gBattlerAttacker].hpIV & 2) >> 1) - | ((gBattleMons[gBattlerAttacker].attackIV & 2) << 0) - | ((gBattleMons[gBattlerAttacker].defenseIV & 2) << 1) - | ((gBattleMons[gBattlerAttacker].speedIV & 2) << 2) - | ((gBattleMons[gBattlerAttacker].spAttackIV & 2) << 3) - | ((gBattleMons[gBattlerAttacker].spDefenseIV & 2) << 4); + powerBits = ((gBattleMons[battlerAtk].hpIV & 2) >> 1) + | ((gBattleMons[battlerAtk].attackIV & 2) << 0) + | ((gBattleMons[battlerAtk].defenseIV & 2) << 1) + | ((gBattleMons[battlerAtk].speedIV & 2) << 2) + | ((gBattleMons[battlerAtk].spAttackIV & 2) << 3) + | ((gBattleMons[battlerAtk].spDefenseIV & 2) << 4); basePower = (40 * powerBits) / 63 + 30; #endif @@ -8760,15 +8760,15 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) break; case EFFECT_TERRAIN_PULSE: if ((gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) - && IsBattlerGrounded(gBattlerAttacker)) + && IsBattlerGrounded(battlerAtk)) basePower *= 2; break; case EFFECT_EXPANDING_FORCE: - if (IsBattlerTerrainAffected(gBattlerAttacker, STATUS_FIELD_PSYCHIC_TERRAIN)) + if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_PSYCHIC_TERRAIN)) MulModifier(&basePower, UQ_4_12(1.5)); break; case EFFECT_RISING_VOLTAGE: - if (IsBattlerTerrainAffected(gBattlerTarget, STATUS_FIELD_ELECTRIC_TERRAIN)) + if (IsBattlerTerrainAffected(battlerDef, STATUS_FIELD_ELECTRIC_TERRAIN)) basePower *= 2; break; case EFFECT_BEAT_UP: @@ -8777,7 +8777,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) #endif break; case EFFECT_PSYBLADE: - if (IsBattlerTerrainAffected(gBattlerAttacker, STATUS_FIELD_ELECTRIC_TERRAIN)) + if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_ELECTRIC_TERRAIN)) MulModifier(&basePower, UQ_4_12(1.5)); break; } @@ -9619,7 +9619,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move || (gSideStatuses[defSide] & SIDE_STATUS_AURORA_VEIL)) && abilityAtk != ABILITY_INFILTRATOR && !(isCrit) - && !gProtectStructs[gBattlerAttacker].confusionSelfDmg) + && !gProtectStructs[battlerAtk].confusionSelfDmg) { if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) MulModifier(&finalModifier, UQ_4_12(0.66)); @@ -9628,7 +9628,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move } // Parental Bond Second Strike - if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_2ND_HIT) + if (gSpecialStatuses[battlerAtk].parentalBondState == PARENTAL_BOND_2ND_HIT) { if (B_PARENTAL_BOND_DMG < GEN_7) MulModifier(&finalModifier, UQ_4_12(0.5)); diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 64ce246862..3dc21a5382 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -7884,7 +7884,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .accuracy = 100, .pp = 5, .secondaryEffectChance = 10, - .target = MOVE_TARGET_BOTH, + .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, diff --git a/src/data/graphics/items.h b/src/data/graphics/items.h index ce4ecf6082..1e60357b3e 100644 --- a/src/data/graphics/items.h +++ b/src/data/graphics/items.h @@ -645,6 +645,15 @@ const u32 gItemIconPalette_RibbonSweet[] = INCBIN_U32("graphics/items/icon_palet const u32 gItemIcon_Everstone[] = INCBIN_U32("graphics/items/icons/everstone.4bpp.lz"); const u32 gItemIconPalette_Everstone[] = INCBIN_U32("graphics/items/icon_palettes/everstone.gbapal.lz"); +const u32 gItemIcon_BlackAugurite[] = INCBIN_U32("graphics/items/icons/black_augurite.4bpp.lz"); +const u32 gItemIconPalette_BlackAugurite[] = INCBIN_U32("graphics/items/icon_palettes/black_augurite.gbapal.lz"); + +const u32 gItemIcon_LinkingCord[] = INCBIN_U32("graphics/items/icons/linking_cord.4bpp.lz"); +const u32 gItemIconPalette_LinkingCord[] = INCBIN_U32("graphics/items/icon_palettes/linking_cord.gbapal.lz"); + +const u32 gItemIcon_PeatBlock[] = INCBIN_U32("graphics/items/icons/peat_block.4bpp.lz"); +const u32 gItemIconPalette_PeatBlock[] = INCBIN_U32("graphics/items/icon_palettes/peat_block.gbapal.lz"); + // Nectars const u32 gItemIcon_RedNectar[] = INCBIN_U32("graphics/items/icons/red_nectar.4bpp.lz"); diff --git a/src/data/item_icon_table.h b/src/data/item_icon_table.h index 9e4b567775..f220bd819c 100644 --- a/src/data/item_icon_table.h +++ b/src/data/item_icon_table.h @@ -840,6 +840,9 @@ const u32 *const gItemIconTable[ITEMS_COUNT + 1][2] = [ITEM_ADAMANT_CRYSTAL] = {gItemIcon_AdamantCrystal, gItemIconPalette_AdamantCrystal}, [ITEM_GRISEOUS_CORE] = {gItemIcon_GriseousCore, gItemIconPalette_GriseousCore}, [ITEM_LUSTROUS_GLOBE] = {gItemIcon_LustrousGlobe, gItemIconPalette_LustrousGlobe}, + [ITEM_BLACK_AUGURITE] = {gItemIcon_BlackAugurite, gItemIconPalette_BlackAugurite}, + [ITEM_LINKING_CORD] = {gItemIcon_LinkingCord, gItemIconPalette_LinkingCord}, + [ITEM_PEAT_BLOCK] = {gItemIcon_PeatBlock, gItemIconPalette_PeatBlock}, // Return to field arrow [ITEMS_COUNT] = {gItemIcon_ReturnToFieldArrow, gItemIconPalette_ReturnToFieldArrow}, }; diff --git a/src/data/items.h b/src/data/items.h index 82e41901c9..6998aa573f 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -10283,4 +10283,40 @@ const struct Item gItems[] = .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .flingPower = 60, }, + + [ITEM_BLACK_AUGURITE] = + { + .name = _("BlackAugurite"), + .itemId = ITEM_BLACK_AUGURITE, + .price = 8000, + .description = sBlackAuguriteDesc, + .pocket = POCKET_ITEMS, + .type = ITEM_USE_PARTY_MENU, + .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .flingPower = 30, + }, + + [ITEM_LINKING_CORD] = + { + .name = _("Linking Cord"), + .itemId = ITEM_LINKING_CORD, + .price = 8000, + .description = sLinkingCordDesc, + .pocket = POCKET_ITEMS, + .type = ITEM_USE_PARTY_MENU, + .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .flingPower = 30, + }, + + [ITEM_PEAT_BLOCK] = + { + .name = _("Peat Block"), + .itemId = ITEM_PEAT_BLOCK, + .price = 10000, + .description = sPeatBlockDesc, + .pocket = POCKET_ITEMS, + .type = ITEM_USE_PARTY_MENU, + .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .flingPower = 30, + }, }; diff --git a/src/data/pokemon/evolution.h b/src/data/pokemon/evolution.h index b76e83a730..6ec3c0a14c 100644 --- a/src/data/pokemon/evolution.h +++ b/src/data/pokemon/evolution.h @@ -47,15 +47,18 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_POLIWHIRL] = {{EVO_ITEM, ITEM_WATER_STONE, SPECIES_POLIWRATH}, {EVO_TRADE_ITEM, ITEM_KINGS_ROCK, SPECIES_POLITOED}}, [SPECIES_ABRA] = {{EVO_LEVEL, 16, SPECIES_KADABRA}}, - [SPECIES_KADABRA] = {{EVO_TRADE, 0, SPECIES_ALAKAZAM}}, + [SPECIES_KADABRA] = {{EVO_TRADE, 0, SPECIES_ALAKAZAM}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_ALAKAZAM}}, [SPECIES_ALAKAZAM] = {{EVO_MEGA_EVOLUTION, ITEM_ALAKAZITE, SPECIES_ALAKAZAM_MEGA}}, [SPECIES_MACHOP] = {{EVO_LEVEL, 28, SPECIES_MACHOKE}}, - [SPECIES_MACHOKE] = {{EVO_TRADE, 0, SPECIES_MACHAMP}}, + [SPECIES_MACHOKE] = {{EVO_TRADE, 0, SPECIES_MACHAMP}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_MACHAMP}}, [SPECIES_BELLSPROUT] = {{EVO_LEVEL, 21, SPECIES_WEEPINBELL}}, [SPECIES_WEEPINBELL] = {{EVO_ITEM, ITEM_LEAF_STONE, SPECIES_VICTREEBEL}}, [SPECIES_TENTACOOL] = {{EVO_LEVEL, 30, SPECIES_TENTACRUEL}}, [SPECIES_GEODUDE] = {{EVO_LEVEL, 25, SPECIES_GRAVELER}}, - [SPECIES_GRAVELER] = {{EVO_TRADE, 0, SPECIES_GOLEM}}, + [SPECIES_GRAVELER] = {{EVO_TRADE, 0, SPECIES_GOLEM}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_GOLEM}}, [SPECIES_PONYTA] = {{EVO_LEVEL, 40, SPECIES_RAPIDASH}}, [SPECIES_SLOWPOKE] = {{EVO_LEVEL, 37, SPECIES_SLOWBRO}, {EVO_TRADE_ITEM, ITEM_KINGS_ROCK, SPECIES_SLOWKING}}, @@ -70,7 +73,8 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_GRIMER] = {{EVO_LEVEL, 38, SPECIES_MUK}}, [SPECIES_SHELLDER] = {{EVO_ITEM, ITEM_WATER_STONE, SPECIES_CLOYSTER}}, [SPECIES_GASTLY] = {{EVO_LEVEL, 25, SPECIES_HAUNTER}}, - [SPECIES_HAUNTER] = {{EVO_TRADE, 0, SPECIES_GENGAR}}, + [SPECIES_HAUNTER] = {{EVO_TRADE, 0, SPECIES_GENGAR}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_GENGAR}}, [SPECIES_GENGAR] = {{EVO_MEGA_EVOLUTION, ITEM_GENGARITE, SPECIES_GENGAR_MEGA}}, [SPECIES_ONIX] = {{EVO_TRADE_ITEM, ITEM_METAL_COAT, SPECIES_STEELIX}}, [SPECIES_DROWZEE] = {{EVO_LEVEL, 26, SPECIES_HYPNO}}, @@ -97,7 +101,8 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_SEADRA] = {{EVO_TRADE_ITEM, ITEM_DRAGON_SCALE, SPECIES_KINGDRA}}, [SPECIES_GOLDEEN] = {{EVO_LEVEL, 33, SPECIES_SEAKING}}, [SPECIES_STARYU] = {{EVO_ITEM, ITEM_WATER_STONE, SPECIES_STARMIE}}, - [SPECIES_SCYTHER] = {{EVO_TRADE_ITEM, ITEM_METAL_COAT, SPECIES_SCIZOR}}, + [SPECIES_SCYTHER] = {{EVO_TRADE_ITEM, ITEM_METAL_COAT, SPECIES_SCIZOR}, + {EVO_ITEM, ITEM_BLACK_AUGURITE, SPECIES_KLEAVOR}}, #if P_GEN_4_POKEMON == TRUE [SPECIES_ELECTABUZZ] = {{EVO_TRADE_ITEM, ITEM_ELECTIRIZER, SPECIES_ELECTIVIRE}}, [SPECIES_MAGMAR] = {{EVO_TRADE_ITEM, ITEM_MAGMARIZER, SPECIES_MAGMORTAR}}, @@ -364,12 +369,14 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_TRANQUILL] = {{EVO_LEVEL, 32, SPECIES_UNFEZANT}}, [SPECIES_BLITZLE] = {{EVO_LEVEL, 27, SPECIES_ZEBSTRIKA}}, [SPECIES_ROGGENROLA] = {{EVO_LEVEL, 25, SPECIES_BOLDORE}}, - [SPECIES_BOLDORE] = {{EVO_TRADE, 0, SPECIES_GIGALITH}}, + [SPECIES_BOLDORE] = {{EVO_TRADE, 0, SPECIES_GIGALITH}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_GIGALITH}}, [SPECIES_WOOBAT] = {{EVO_FRIENDSHIP, 0, SPECIES_SWOOBAT}}, [SPECIES_DRILBUR] = {{EVO_LEVEL, 31, SPECIES_EXCADRILL}}, [SPECIES_AUDINO] = {{EVO_MEGA_EVOLUTION, ITEM_AUDINITE, SPECIES_AUDINO_MEGA}}, [SPECIES_TIMBURR] = {{EVO_LEVEL, 25, SPECIES_GURDURR}}, - [SPECIES_GURDURR] = {{EVO_TRADE, 0, SPECIES_CONKELDURR}}, + [SPECIES_GURDURR] = {{EVO_TRADE, 0, SPECIES_CONKELDURR}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_CONKELDURR}}, [SPECIES_TYMPOLE] = {{EVO_LEVEL, 25, SPECIES_PALPITOAD}}, [SPECIES_PALPITOAD] = {{EVO_LEVEL, 36, SPECIES_SEISMITOAD}}, [SPECIES_SEWADDLE] = {{EVO_LEVEL, 20, SPECIES_SWADLOON}}, @@ -454,8 +461,10 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_AMAURA] = {{EVO_LEVEL_NIGHT, 39, SPECIES_AURORUS}}, [SPECIES_GOOMY] = {{EVO_LEVEL, 40, SPECIES_SLIGGOO}}, [SPECIES_SLIGGOO] = {{EVO_LEVEL_RAIN, 50, SPECIES_GOODRA}}, - [SPECIES_PHANTUMP] = {{EVO_TRADE, 0, SPECIES_TREVENANT}}, - [SPECIES_PUMPKABOO] = {{EVO_TRADE, 0, SPECIES_GOURGEIST}}, + [SPECIES_PHANTUMP] = {{EVO_TRADE, 0, SPECIES_TREVENANT}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_TREVENANT}}, + [SPECIES_PUMPKABOO] = {{EVO_TRADE, 0, SPECIES_GOURGEIST}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_GOURGEIST}}, [SPECIES_BERGMITE] = {{EVO_LEVEL, 37, SPECIES_AVALUGG}}, [SPECIES_NOIBAT] = {{EVO_LEVEL, 48, SPECIES_NOIVERN}}, [SPECIES_DIANCIE] = {{EVO_MEGA_EVOLUTION, ITEM_DIANCITE, SPECIES_DIANCIE_MEGA}}, @@ -552,7 +561,8 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_DIGLETT_ALOLAN] = {{EVO_LEVEL, 26, SPECIES_DUGTRIO_ALOLAN}}, [SPECIES_MEOWTH_ALOLAN] = {{EVO_FRIENDSHIP, 28, SPECIES_PERSIAN_ALOLAN}}, [SPECIES_GEODUDE_ALOLAN] = {{EVO_LEVEL, 25, SPECIES_GRAVELER_ALOLAN}}, - [SPECIES_GRAVELER_ALOLAN] = {{EVO_TRADE, 0, SPECIES_GOLEM_ALOLAN}}, + [SPECIES_GRAVELER_ALOLAN] = {{EVO_TRADE, 0, SPECIES_GOLEM_ALOLAN}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_GOLEM_ALOLAN}}, [SPECIES_GRIMER_ALOLAN] = {{EVO_LEVEL, 38, SPECIES_MUK_ALOLAN}}, #if P_GEN_8_POKEMON == TRUE [SPECIES_MEOWTH_GALARIAN] = {{EVO_LEVEL, 28, SPECIES_PERRSERKER}}, @@ -593,14 +603,18 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_FLOETTE_ORANGE_FLOWER] = {{EVO_ITEM, ITEM_SHINY_STONE, SPECIES_FLORGES_ORANGE_FLOWER}}, [SPECIES_FLOETTE_BLUE_FLOWER] = {{EVO_ITEM, ITEM_SHINY_STONE, SPECIES_FLORGES_BLUE_FLOWER}}, [SPECIES_FLOETTE_WHITE_FLOWER] = {{EVO_ITEM, ITEM_SHINY_STONE, SPECIES_FLORGES_WHITE_FLOWER}}, - [SPECIES_PUMPKABOO_SMALL] = {{EVO_TRADE, 0, SPECIES_GOURGEIST_SMALL}}, - [SPECIES_PUMPKABOO_LARGE] = {{EVO_TRADE, 0, SPECIES_GOURGEIST_LARGE}}, - [SPECIES_PUMPKABOO_SUPER] = {{EVO_TRADE, 0, SPECIES_GOURGEIST_SUPER}}, + [SPECIES_PUMPKABOO_SMALL] = {{EVO_TRADE, 0, SPECIES_GOURGEIST_SMALL}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_GOURGEIST_SMALL}}, + [SPECIES_PUMPKABOO_LARGE] = {{EVO_TRADE, 0, SPECIES_GOURGEIST_LARGE}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_GOURGEIST_LARGE}}, + [SPECIES_PUMPKABOO_SUPER] = {{EVO_TRADE, 0, SPECIES_GOURGEIST_SUPER}, + {EVO_ITEM, ITEM_LINKING_CORD, SPECIES_GOURGEIST_SUPER}}, #endif #if P_GEN_7_POKEMON == TRUE [SPECIES_ROCKRUFF_OWN_TEMPO] = {{EVO_LEVEL_DUSK, 25, SPECIES_LYCANROC_DUSK}}, #endif #if P_GEN_8_POKEMON == TRUE [SPECIES_SINISTEA_ANTIQUE] = {{EVO_ITEM, ITEM_CHIPPED_POT, SPECIES_POLTEAGEIST_ANTIQUE}}, + [SPECIES_URSARING] = {{EVO_ITEM_NIGHT, ITEM_PEAT_BLOCK, SPECIES_URSALUNA}}, #endif }; diff --git a/src/data/pokemon/item_effects.h b/src/data/pokemon/item_effects.h index 607f578140..632fb6b26e 100644 --- a/src/data/pokemon/item_effects.h +++ b/src/data/pokemon/item_effects.h @@ -556,6 +556,9 @@ const u8 *const gItemEffectTable[ITEMS_COUNT] = [ITEM_MALICIOUS_ARMOR] = gItemEffect_EvoItem, [ITEM_SCROLL_OF_DARKNESS] = gItemEffect_EvoItem, [ITEM_SCROLL_OF_WATERS] = gItemEffect_EvoItem, + [ITEM_BLACK_AUGURITE] = gItemEffect_EvoItem, + [ITEM_LINKING_CORD] = gItemEffect_EvoItem, + [ITEM_PEAT_BLOCK] = gItemEffect_EvoItem, // Berries [ITEM_CHERI_BERRY] = gItemEffect_CheriBerry, diff --git a/src/data/text/item_descriptions.h b/src/data/text/item_descriptions.h index da15f001c8..5dc870038a 100644 --- a/src/data/text/item_descriptions.h +++ b/src/data/text/item_descriptions.h @@ -1300,6 +1300,21 @@ static const u8 sEverstoneDesc[] = _( "item that prevents\n" "evolution."); +static const u8 sBlackAuguriteDesc[] = _( + "A black stone that\n" + "makes some Pokémon\n" + "evolve.");; + +static const u8 sLinkingCordDesc[] = _( + "A mysterious string\n" + "that makes some\n" + "Pokémon evolve."); + +static const u8 sPeatBlockDesc[] = _( + "A block of material\n" + "that makes some\n" + "Pokémon evolve."); + // Nectars static const u8 sRedNectarDesc[] = _( "Flower nectar that\n" diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 96e9173c9b..b784a2ab86 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -565,11 +565,13 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior) if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_FORCED_MOVE) && !MetatileBehavior_IsForcedMovementTile(metatileBehavior)) { + #if OW_POISON_DAMAGE < GEN_5 if (UpdatePoisonStepCounter() == TRUE) { ScriptContext_SetupScript(EventScript_FieldPoison); return TRUE; } + #endif if (ShouldEggHatch()) { IncrementGameStat(GAME_STAT_HATCHED_EGGS); diff --git a/src/field_poison.c b/src/field_poison.c index f254a6d142..da162e4134 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -44,7 +44,9 @@ static void FaintFromFieldPoison(u8 partyIdx) struct Pokemon *pokemon = &gPlayerParty[partyIdx]; u32 status = STATUS1_NONE; +#if OW_POISON_DAMAGE < GEN_4 AdjustFriendship(pokemon, FRIENDSHIP_EVENT_FAINT_FIELD_PSN); +#endif SetMonData(pokemon, MON_DATA_STATUS, &status); GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1); StringGet_Nickname(gStringVar1); @@ -53,7 +55,11 @@ static void FaintFromFieldPoison(u8 partyIdx) static bool32 MonFaintedFromPoison(u8 partyIdx) { struct Pokemon *pokemon = &gPlayerParty[partyIdx]; +#if OW_POISON_DAMAGE < GEN_4 if (IsMonValidSpecies(pokemon) && GetMonData(pokemon, MON_DATA_HP) == 0 && GetAilmentFromStatus(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN) +#else + if (IsMonValidSpecies(pokemon) && GetMonData(pokemon, MON_DATA_HP) == 1 && GetAilmentFromStatus(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN) +#endif return TRUE; return FALSE; @@ -127,7 +133,11 @@ s32 DoPoisonFieldEffect(void) { // Apply poison damage hp = GetMonData(pokemon, MON_DATA_HP); + #if OW_POISON_DAMAGE < GEN_4 if (hp == 0 || --hp == 0) + #else + if (hp == 1 || --hp == 1) + #endif numFainted++; SetMonData(pokemon, MON_DATA_HP, &hp); diff --git a/src/pokemon.c b/src/pokemon.c index f9f7d811db..10a4d0efd3 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6812,6 +6812,11 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s if (GetMonGender(mon) == MON_MALE && gEvolutionTable[species][i].param == evolutionItem) targetSpecies = gEvolutionTable[species][i].targetSpecies; break; + case EVO_ITEM_NIGHT: + RtcCalcLocalTime(); + if (gLocalTime.hours >= 0 && gLocalTime.hours < 12 && gEvolutionTable[species][i].param == evolutionItem) + targetSpecies = gEvolutionTable[species][i].targetSpecies; + break; } } break; diff --git a/src/random.c b/src/random.c index e59b563876..14983e7764 100644 --- a/src/random.c +++ b/src/random.c @@ -38,9 +38,12 @@ u32 RandomUniform(enum RandomTag tag, u32 lo, u32 hi); __attribute__((weak, alias("RandomWeightedArrayDefault"))) u32 RandomWeightedArray(enum RandomTag tag, u32 sum, u32 n, const u8 *weights); +__attribute__((weak, alias("RandomElementArrayDefault"))) +const void *RandomElementArray(enum RandomTag tag, const void *array, size_t size, size_t count); + u32 RandomUniformDefault(enum RandomTag tag, u32 lo, u32 hi) { - return lo + (((hi - lo) * Random()) >> 16); + return lo + (((hi - lo + 1) * Random()) >> 16); } u32 RandomWeightedArrayDefault(enum RandomTag tag, u32 sum, u32 n, const u8 *weights) @@ -55,3 +58,8 @@ u32 RandomWeightedArrayDefault(enum RandomTag tag, u32 sum, u32 n, const u8 *wei } return n - 1; } + +const void *RandomElementArrayDefault(enum RandomTag tag, const void *array, size_t size, size_t count) +{ + return (const u8 *)array + size * RandomUniformDefault(tag, 0, count - 1); +} diff --git a/src/strings.c b/src/strings.c index 8815212e05..847b2849a6 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1191,7 +1191,11 @@ const u8 gText_PsychUp48BP[] = _("PSYCH UP{CLEAR_TO 0x4E}48BP"); const u8 gText_IcePunch48BP[] = _("ICE PUNCH{CLEAR_TO 0x4E}48BP"); const u8 gText_ThunderPunch48BP[] = _("THUNDERPUNCH{CLEAR_TO 0x4E}48BP"); const u8 gText_FirePunch48BP[] = _("FIRE PUNCH{CLEAR_TO 0x4E}48BP"); +#if OW_POISON_DAMAGE < GEN_4 const u8 gText_PkmnFainted_FldPsn[] = _("{STR_VAR_1} fainted…\p\n"); +#else +const u8 gText_PkmnFainted_FldPsn[] = _("{STR_VAR_1} survived the poisoning.\nThe poison faded away!\p"); +#endif const u8 gText_Marco[] = _("MARCO"); const u8 gText_TrainerCardName[] = _("NAME: "); const u8 gText_TrainerCardIDNo[] = _("IDNo."); diff --git a/src/wild_encounter.c b/src/wild_encounter.c index d228b87a14..ef668c3a1c 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -1097,7 +1097,11 @@ static void ApplyCleanseTagEncounterRateMod(u32 *encRate) bool8 TryDoDoubleWildBattle(void) { +#if B_DOUBLE_WILD_REQUIRE_2_MONS == TRUE if (GetSafariZoneFlag() || GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS) +#else + if (GetSafariZoneFlag()) +#endif return FALSE; #if B_FLAG_FORCE_DOUBLE_WILD != 0 else if (FlagGet(B_FLAG_FORCE_DOUBLE_WILD)) diff --git a/test/move_effect_dire_claw.c b/test/move_effect_dire_claw.c index f02555df30..2212c3cb0e 100644 --- a/test/move_effect_dire_claw.c +++ b/test/move_effect_dire_claw.c @@ -6,21 +6,14 @@ ASSUMPTIONS ASSUME(gBattleMoves[MOVE_DIRE_CLAW].effect == EFFECT_DIRE_CLAW); } -// found by brute-force -#define RNG_SLEEP 0xcb0 -#define RNG_POISON 0x2BE -#define RNG_PARALYSIS 5 - SINGLE_BATTLE_TEST("Dire Claw can inflict poison, paralysis or sleep") { u8 statusAnim; - u32 rng; - KNOWN_FAILING; - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = RNG_POISON; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = RNG_SLEEP; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; } + PASSES_RANDOMLY(1, 3, RNG_DIRE_CLAW); GIVEN { - RNGSeed(rng); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -48,15 +41,14 @@ SINGLE_BATTLE_TEST("Dire Claw cannot poison/paralyze poison/electric types respe u16 species; u32 rng; #if B_PARALYZE_ELECTRIC >= GEN_6 - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_RAICHU; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_RAICHU; } #endif // B_PARALYZE_ELECTRIC - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = RNG_POISON; species = SPECIES_ARBOK;} + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = MOVE_EFFECT_POISON; species = SPECIES_ARBOK;} GIVEN { - RNGSeed(rng); PLAYER(SPECIES_WOBBUFFET); OPPONENT(species); } WHEN { - TURN { MOVE(player, MOVE_DIRE_CLAW); } + TURN { MOVE(player, MOVE_DIRE_CLAW, WITH_RNG(RNG_DIRE_CLAW, rng)); } TURN {} } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_DIRE_CLAW, player); @@ -76,21 +68,20 @@ SINGLE_BATTLE_TEST("Dire Claw cannot poison/paralyze/cause to fall asleep pokemo u8 statusAnim; u16 species, ability; u32 rng; - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_RAICHU; ability = ABILITY_LIGHTNING_ROD; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_JOLTEON; ability = ABILITY_VOLT_ABSORB; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_RAICHU; ability = ABILITY_LIGHTNING_ROD; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_JOLTEON; ability = ABILITY_VOLT_ABSORB; } #if P_GEN_4_POKEMON == TRUE - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_ELECTIVIRE; ability = ABILITY_MOTOR_DRIVE; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_ELECTIVIRE; ability = ABILITY_MOTOR_DRIVE; } #endif // P_GEN_4_POKEMON - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = RNG_POISON; species = SPECIES_ZANGOOSE; ability = ABILITY_IMMUNITY; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = RNG_SLEEP; species = SPECIES_VIGOROTH; ability = ABILITY_VITAL_SPIRIT; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = RNG_SLEEP; species = SPECIES_HYPNO; ability = ABILITY_INSOMNIA; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = MOVE_EFFECT_POISON; species = SPECIES_ZANGOOSE; ability = ABILITY_IMMUNITY; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = MOVE_EFFECT_SLEEP; species = SPECIES_VIGOROTH; ability = ABILITY_VITAL_SPIRIT; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = MOVE_EFFECT_SLEEP; species = SPECIES_HYPNO; ability = ABILITY_INSOMNIA; } GIVEN { - RNGSeed(rng); PLAYER(SPECIES_WOBBUFFET); OPPONENT(species) {Ability(ability);} } WHEN { - TURN { MOVE(player, MOVE_DIRE_CLAW); } + TURN { MOVE(player, MOVE_DIRE_CLAW, WITH_RNG(RNG_DIRE_CLAW, rng)); } TURN {} } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_DIRE_CLAW, player); @@ -112,15 +103,14 @@ SINGLE_BATTLE_TEST("Dire Claw cannot poison/paralyze/cause to fall asleep a mon { u8 statusAnim; u32 rng; - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = RNG_POISON; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = RNG_SLEEP; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = MOVE_EFFECT_POISON; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = MOVE_EFFECT_SLEEP; } GIVEN { - RNGSeed(rng); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET) {Status1(STATUS1_BURN);} } WHEN { - TURN { MOVE(player, MOVE_DIRE_CLAW); } + TURN { MOVE(player, MOVE_DIRE_CLAW, WITH_RNG(RNG_DIRE_CLAW, rng)); } TURN {} } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_DIRE_CLAW, player); diff --git a/test/move_effect_tri_attack.c b/test/move_effect_tri_attack.c index 9bfacdb985..c3fbfaaceb 100644 --- a/test/move_effect_tri_attack.c +++ b/test/move_effect_tri_attack.c @@ -6,21 +6,14 @@ ASSUMPTIONS ASSUME(gBattleMoves[MOVE_TRI_ATTACK].effect == EFFECT_TRI_ATTACK); } -// found by brute-force -#define RNG_PARALYSIS 0xcb0 -#define RNG_BURN 0x2BE -#define RNG_FREEZE 5 - SINGLE_BATTLE_TEST("Tri Attack can inflict paralysis, burn or freeze") { u8 statusAnim; - u32 rng; - KNOWN_FAILING; - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = RNG_BURN; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = RNG_FREEZE; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; } + PASSES_RANDOMLY(1, 3, RNG_TRI_ATTACK); GIVEN { - RNGSeed(rng); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -48,16 +41,15 @@ SINGLE_BATTLE_TEST("Tri Attack cannot paralyze/burn/freeze electric/fire/ice typ u16 species; u32 rng; #if B_PARALYZE_ELECTRIC >= GEN_6 - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_RAICHU;} + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_RAICHU;} #endif // B_PARALYZE_ELECTRIC - PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = RNG_BURN; species = SPECIES_ARCANINE; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = RNG_FREEZE; species = SPECIES_GLALIE; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = MOVE_EFFECT_BURN; species = SPECIES_ARCANINE; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = MOVE_EFFECT_FREEZE; species = SPECIES_GLALIE; } GIVEN { - RNGSeed(rng); PLAYER(SPECIES_WOBBUFFET); OPPONENT(species); } WHEN { - TURN { MOVE(player, MOVE_TRI_ATTACK); } + TURN { MOVE(player, MOVE_TRI_ATTACK, WITH_RNG(RNG_TRI_ATTACK, rng)); } TURN {} } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_TRI_ATTACK, player); @@ -80,23 +72,22 @@ SINGLE_BATTLE_TEST("Tri Attack cannot paralyze/burn/freeze pokemon with abilitie u8 statusAnim; u16 species, ability; u32 rng; - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_RAICHU; ability = ABILITY_LIGHTNING_ROD; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_JOLTEON; ability = ABILITY_VOLT_ABSORB; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_RAICHU; ability = ABILITY_LIGHTNING_ROD; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_JOLTEON; ability = ABILITY_VOLT_ABSORB; } #if P_GEN_4_POKEMON == TRUE - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; species = SPECIES_ELECTIVIRE; ability = ABILITY_MOTOR_DRIVE; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_ELECTIVIRE; ability = ABILITY_MOTOR_DRIVE; } #endif // P_GEN_4_POKEMON #if P_GEN_7_POKEMON == TRUE - PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = RNG_BURN; species = SPECIES_DEWPIDER; ability = ABILITY_WATER_BUBBLE; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = MOVE_EFFECT_BURN; species = SPECIES_DEWPIDER; ability = ABILITY_WATER_BUBBLE; } #endif // P_GEN_7_POKEMON - PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = RNG_BURN; species = SPECIES_SEAKING; ability = ABILITY_WATER_VEIL; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = RNG_FREEZE; species = SPECIES_CAMERUPT; ability = ABILITY_MAGMA_ARMOR; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = MOVE_EFFECT_BURN; species = SPECIES_SEAKING; ability = ABILITY_WATER_VEIL; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = MOVE_EFFECT_FREEZE; species = SPECIES_CAMERUPT; ability = ABILITY_MAGMA_ARMOR; } GIVEN { - RNGSeed(rng); PLAYER(SPECIES_WOBBUFFET); OPPONENT(species) {Ability(ability);} } WHEN { - TURN { MOVE(player, MOVE_TRI_ATTACK); } + TURN { MOVE(player, MOVE_TRI_ATTACK, WITH_RNG(RNG_TRI_ATTACK, rng)); } TURN {} } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_TRI_ATTACK, player); @@ -118,15 +109,14 @@ SINGLE_BATTLE_TEST("Tri Attack cannot paralyze/burn/freeze a mon which is alread { u8 statusAnim; u32 rng; - PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = RNG_PARALYSIS; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = RNG_BURN; } - PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = RNG_FREEZE; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = MOVE_EFFECT_BURN; } + PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = MOVE_EFFECT_FREEZE; } GIVEN { - RNGSeed(rng); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET) {Status1(STATUS1_SLEEP);} } WHEN { - TURN { MOVE(player, MOVE_TRI_ATTACK); } + TURN { MOVE(player, MOVE_TRI_ATTACK, WITH_RNG(RNG_TRI_ATTACK, rng)); } TURN {} } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_TRI_ATTACK, player); diff --git a/test/random.c b/test/random.c index abaf4a4f82..39f587c062 100644 --- a/test/random.c +++ b/test/random.c @@ -34,6 +34,17 @@ TEST("RandomWeighted generates 0..n-1") } } +TEST("RandomElement generates an element") +{ + u32 i; + static const u8 es[4] = { 1, 2, 4, 8 }; + for (i = 0; i < 1024; i++) + { + u32 e = *(const u8 *)RandomElementArrayDefault(RNG_NONE, es, sizeof(es[0]), ARRAY_COUNT(es)); + EXPECT(e == 1 || e == 2 || e == 4 || e == 8); + } +} + TEST("RandomUniform generates uniform distribution") { u32 i, error; @@ -42,7 +53,7 @@ TEST("RandomUniform generates uniform distribution") memset(distribution, 0, sizeof(distribution)); for (i = 0; i < 4096; i++) { - u32 r = RandomUniformDefault(RNG_NONE, 0, ARRAY_COUNT(distribution)); + u32 r = RandomUniformDefault(RNG_NONE, 0, ARRAY_COUNT(distribution) - 1); EXPECT(0 <= r && r < ARRAY_COUNT(distribution)); distribution[r]++; } @@ -79,3 +90,23 @@ TEST("RandomWeighted generates distribution in proportion to the weights") EXPECT_LT(error, UQ_4_12(0.025)); } + +TEST("RandomElement generates a uniform distribution") +{ + u32 i, error; + static const u8 es[4] = { 1, 2, 4, 8 }; + u16 distribution[9]; + + memset(distribution, 0, sizeof(distribution)); + for (i = 0; i < 4096; i++) + { + u32 e = *(const u8 *)RandomElementArrayDefault(RNG_NONE, es, sizeof(es[0]), ARRAY_COUNT(es)); + distribution[e]++; + } + + error = 0; + for (i = 0; i < ARRAY_COUNT(es); i++) + error += abs(UQ_4_12(0.25) - distribution[es[i]]); + + EXPECT_LT(error, UQ_4_12(0.025)); +} diff --git a/test/terrain_electric.c b/test/terrain_electric.c new file mode 100644 index 0000000000..b5608e661b --- /dev/null +++ b/test/terrain_electric.c @@ -0,0 +1,63 @@ +#include "global.h" +#include "test_battle.h" + +SINGLE_BATTLE_TEST("Electric Terrain protects grounded battlers from falling asleep") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_CLAYDOL) { Ability(ABILITY_LEVITATE); } + } WHEN { + TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); MOVE(opponent, MOVE_SPORE); } + TURN { MOVE(player, MOVE_SPORE); } + } SCENE { + MESSAGE("Wobbuffet used ElctrcTrrain!"); + MESSAGE("Foe Claydol used Spore!"); + MESSAGE("Wobbuffet surrounds itself with electrified terrain!"); + MESSAGE("Wobbuffet used Spore!"); + MESSAGE("Foe Claydol fell asleep!"); + STATUS_ICON(opponent, sleep: TRUE); + } +} + +SINGLE_BATTLE_TEST("Electric Terrain activates Electric Seed and Mimicry") +{ + GIVEN { + ASSUME(P_GEN_8_POKEMON == TRUE); + ASSUME(gItems[ITEM_ELECTRIC_SEED].holdEffect == HOLD_EFFECT_SEEDS); + ASSUME(gItems[ITEM_ELECTRIC_SEED].holdEffectParam == HOLD_EFFECT_PARAM_ELECTRIC_TERRAIN); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_ELECTRIC_SEED); } + OPPONENT(SPECIES_STUNFISK_GALARIAN) { Ability(ABILITY_MIMICRY); } + } WHEN { + TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + MESSAGE("Using Electric Seed, the defense of Wobbuffet rose!"); + ABILITY_POPUP(opponent); + MESSAGE("Foe Stunfisk's type changed to Electr!"); + } FINALLY { + EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_ELECTRIC); + } +} + +SINGLE_BATTLE_TEST("Electric Terrain increases power of Electric-type moves by 30/50 percent", s16 damage) +{ + bool32 terrain; + PARAMETRIZE { terrain = FALSE; } + PARAMETRIZE { terrain = TRUE; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + if (terrain) + TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); } + TURN { MOVE(player, MOVE_THUNDER_SHOCK); } + } SCENE { + MESSAGE("Wobbuffet used ThunderShock!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + if (B_TERRAIN_TYPE_BOOST >= GEN_8) + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.3), results[1].damage); + else + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); + } +} diff --git a/test/terrain_grassy.c b/test/terrain_grassy.c index 77f8a99271..cf83048750 100644 --- a/test/terrain_grassy.c +++ b/test/terrain_grassy.c @@ -15,5 +15,72 @@ SINGLE_BATTLE_TEST("Grassy Terrain recovers 1/16th HP at end of turn") } } -TO_DO_BATTLE_TEST("Grassy Terrain increases power of Grass-type moves by 30/50 percent") -TO_DO_BATTLE_TEST("Grassy Terrain decreases power of Earthquake, Magnitude and Bulldoze by 50 percent") +SINGLE_BATTLE_TEST("Grassy Terrain activates Grassy Seed and Mimicry") +{ + GIVEN { + ASSUME(P_GEN_8_POKEMON == TRUE); + ASSUME(gItems[ITEM_GRASSY_SEED].holdEffect == HOLD_EFFECT_SEEDS); + ASSUME(gItems[ITEM_GRASSY_SEED].holdEffectParam == HOLD_EFFECT_PARAM_GRASSY_TERRAIN); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_GRASSY_SEED); } + OPPONENT(SPECIES_STUNFISK_GALARIAN) { Ability(ABILITY_MIMICRY); } + } WHEN { + TURN { MOVE(player, MOVE_GRASSY_TERRAIN); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + MESSAGE("Using Grassy Seed, the defense of Wobbuffet rose!"); + ABILITY_POPUP(opponent); + MESSAGE("Foe Stunfisk's type changed to Grass!"); + } FINALLY { + EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_GRASS); + } +} + +SINGLE_BATTLE_TEST("Grassy Terrain increases power of Grass-type moves by 30/50 percent", s16 damage) +{ + bool32 terrain; + PARAMETRIZE { terrain = FALSE; } + PARAMETRIZE { terrain = TRUE; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + if (terrain) + TURN { MOVE(player, MOVE_GRASSY_TERRAIN); } + TURN { MOVE(player, MOVE_ABSORB); } + } SCENE { + MESSAGE("Wobbuffet used Absorb!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + if (B_TERRAIN_TYPE_BOOST >= GEN_8) + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.3), results[1].damage); + else + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); + } +} + +// Magnitude is not tested because its damage is variable. +SINGLE_BATTLE_TEST("Grassy Terrain decreases power of Earthquake and Bulldoze by 50 percent", s16 damage) +{ + bool32 terrain; + u16 move; + PARAMETRIZE { terrain = FALSE; move = MOVE_EARTHQUAKE; } // 0 + PARAMETRIZE { terrain = TRUE; move = MOVE_EARTHQUAKE; } // 1 + PARAMETRIZE { terrain = FALSE; move = MOVE_BULLDOZE; } // 2 + PARAMETRIZE { terrain = TRUE; move = MOVE_BULLDOZE; } // 3 + GIVEN { + ASSUME(gBattleMoves[MOVE_EARTHQUAKE].effect == EFFECT_EARTHQUAKE); + ASSUME(gBattleMoves[MOVE_BULLDOZE].effect == EFFECT_BULLDOZE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + if (terrain) + TURN { MOVE(player, MOVE_GRASSY_TERRAIN); } + TURN { MOVE(player, move); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, move, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + EXPECT_MUL_EQ(results[2].damage, Q_4_12(0.5), results[3].damage); + } +} diff --git a/test/terrain_misty.c b/test/terrain_misty.c new file mode 100644 index 0000000000..dda5253f23 --- /dev/null +++ b/test/terrain_misty.c @@ -0,0 +1,80 @@ +#include "global.h" +#include "test_battle.h" + +SINGLE_BATTLE_TEST("Misty Terrain protects grounded battlers from non-volatile status conditions") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_CLAYDOL) { Ability(ABILITY_LEVITATE); } + } WHEN { + TURN { MOVE(player, MOVE_MISTY_TERRAIN); MOVE(opponent, MOVE_TOXIC); } + TURN { MOVE(player, MOVE_TOXIC); } + } SCENE { + MESSAGE("Wobbuffet used MistyTerrain!"); + MESSAGE("Foe Claydol used Toxic!"); + MESSAGE("Wobbuffet surrounds itself with a protective mist!"); + NOT { STATUS_ICON(opponent, badPoison: TRUE); } + MESSAGE("Wobbuffet used Toxic!"); + STATUS_ICON(opponent, badPoison: TRUE); + } +} + +SINGLE_BATTLE_TEST("Misty Terrain activates Misty Seed and Mimicry") +{ + GIVEN { + ASSUME(P_GEN_8_POKEMON == TRUE); + ASSUME(gItems[ITEM_MISTY_SEED].holdEffect == HOLD_EFFECT_SEEDS); + ASSUME(gItems[ITEM_MISTY_SEED].holdEffectParam == HOLD_EFFECT_PARAM_MISTY_TERRAIN); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_MISTY_SEED); } + OPPONENT(SPECIES_STUNFISK_GALARIAN) { Ability(ABILITY_MIMICRY); } + } WHEN { + TURN { MOVE(player, MOVE_MISTY_TERRAIN); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + MESSAGE("Using Misty Seed, the sp. defense of Wobbuffet rose!"); + ABILITY_POPUP(opponent); + MESSAGE("Foe Stunfisk's type changed to Fairy!"); + } FINALLY { + EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_FAIRY); + } +} + +SINGLE_BATTLE_TEST("Misty Terrain does not increase the power of Fairy-type moves", s16 damage) +{ + bool32 terrain; + PARAMETRIZE { terrain = FALSE; } + PARAMETRIZE { terrain = TRUE; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + if (terrain) + TURN { MOVE(player, MOVE_MISTY_TERRAIN); } + TURN { MOVE(player, MOVE_MOONBLAST); } + } SCENE { + MESSAGE("Wobbuffet used Moonblast!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_EQ(results[0].damage, results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Misty Terrain decreases power of Dragon-type moves by 50 percent", s16 damage) +{ + bool32 terrain; + PARAMETRIZE { terrain = FALSE; } + PARAMETRIZE { terrain = TRUE; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + if (terrain) + TURN { MOVE(player, MOVE_MISTY_TERRAIN); } + TURN { MOVE(player, MOVE_DRAGON_CLAW); } + } SCENE { + MESSAGE("Wobbuffet used Dragon Claw!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + } +} diff --git a/test/terrain_psychic.c b/test/terrain_psychic.c new file mode 100644 index 0000000000..eb5103f314 --- /dev/null +++ b/test/terrain_psychic.c @@ -0,0 +1,138 @@ +#include "global.h" +#include "test_battle.h" + +SINGLE_BATTLE_TEST("Psychic Terrain protects grounded battlers from priority moves") +{ + GIVEN { + PLAYER(SPECIES_CLAYDOL) { Ability(ABILITY_LEVITATE); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } + TURN { MOVE(player, MOVE_QUICK_ATTACK); MOVE(opponent, MOVE_QUICK_ATTACK); } + } SCENE { + MESSAGE("Claydol used PsychcTrrain!"); + MESSAGE("Claydol cannot use Quick Attack!"); + NOT { HP_BAR(opponent); } + MESSAGE("Foe Wobbuffet used Quick Attack!"); + HP_BAR(player); + } +} + +SINGLE_BATTLE_TEST("Psychic Terrain activates Psychic Seed and Mimicry") +{ + GIVEN { + ASSUME(P_GEN_8_POKEMON == TRUE); + ASSUME(gItems[ITEM_PSYCHIC_SEED].holdEffect == HOLD_EFFECT_SEEDS); + ASSUME(gItems[ITEM_PSYCHIC_SEED].holdEffectParam == HOLD_EFFECT_PARAM_PSYCHIC_TERRAIN); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_PSYCHIC_SEED); } + OPPONENT(SPECIES_STUNFISK_GALARIAN) { Ability(ABILITY_MIMICRY); } + } WHEN { + TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); + MESSAGE("Using Psychic Seed, the sp. defense of Wobbuffet rose!"); + ABILITY_POPUP(opponent); + MESSAGE("Foe Stunfisk's type changed to Psychc!"); + } FINALLY { + EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_PSYCHIC); + } +} + +SINGLE_BATTLE_TEST("Psychic Terrain increases power of Psychic-type moves by 30/50 percent", s16 damage) +{ + bool32 terrain; + PARAMETRIZE { terrain = FALSE; } + PARAMETRIZE { terrain = TRUE; } + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + if (terrain) + TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } + TURN { MOVE(player, MOVE_CONFUSION); } + } SCENE { + MESSAGE("Wobbuffet used Confusion!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + if (B_TERRAIN_TYPE_BOOST >= GEN_8) + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.3), results[1].damage); + else + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target the user", s16 damage) +{ + GIVEN { + PLAYER(SPECIES_SABLEYE) { Ability(ABILITY_PRANKSTER); HP(1); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } + TURN { MOVE(player, MOVE_RECOVER); } + } SCENE { + MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Recover!"); + HP_BAR(player); + } +} + +SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all battlers", s16 damage) +{ + KNOWN_FAILING; + GIVEN { + PLAYER(SPECIES_SABLEYE) { Ability(ABILITY_PRANKSTER); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } + TURN { MOVE(player, MOVE_HAZE); } + } SCENE { + MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Haze!"); + } +} + +SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all opponents", s16 damage) +{ + KNOWN_FAILING; + GIVEN { + PLAYER(SPECIES_SABLEYE) { Ability(ABILITY_PRANKSTER); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } + TURN { MOVE(player, MOVE_SPIKES); } + } SCENE { + MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Spikes!"); + } +} + +DOUBLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target allies", s16 damage) +{ + GIVEN { + PLAYER(SPECIES_SABLEYE) { Ability(ABILITY_PRANKSTER); } + PLAYER(SPECIES_WOBBUFFET) { HP(1); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerLeft, MOVE_PSYCHIC_TERRAIN); } + TURN { MOVE(playerLeft, MOVE_HEAL_PULSE, target: playerRight); } + } SCENE { + MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Heal Pulse!"); + } +} + +SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority field moves", s16 damage) +{ + KNOWN_FAILING; + GIVEN { + PLAYER(SPECIES_SABLEYE) { Ability(ABILITY_PRANKSTER); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } + TURN { MOVE(player, MOVE_SUNNY_DAY); } + } SCENE { + MESSAGE("Sableye used PsychcTrrain!"); + MESSAGE("Sableye used Sunny Day!"); + } +} diff --git a/test/test_battle.h b/test/test_battle.h index 0e0464254f..60d0dc33cc 100644 --- a/test/test_battle.h +++ b/test/test_battle.h @@ -303,13 +303,14 @@ * The inference process is naive, if your test contains anything that * modifies the speed of a battler you should specify them explicitly. * - * MOVE(battler, move | moveSlot:, [megaEvolve:], [hit:], [criticalHit:], [target:], [allowed:]) + * MOVE(battler, move | moveSlot:, [megaEvolve:], [hit:], [criticalHit:], [target:], [allowed:], [WITH_RNG(tag, value]) * Used when the battler chooses Fight. Either the move ID or move slot * must be specified. megaEvolve: TRUE causes the battler to Mega Evolve * if able, hit: FALSE causes the move to miss, criticalHit: TRUE causes * the move to land a critical hit, target: is used in double battles to * choose the target (when necessary), and allowed: FALSE is used to - * reject an illegal move e.g. a Disabled one. + * reject an illegal move e.g. a Disabled one. WITH_RNG allows the move + * to specify an explicit outcome for an RNG tag. * MOVE(playerLeft, MOVE_TACKLE, target: opponentRight); * If the battler does not have an explicit Moves specified the moveset * will be populated based on the MOVEs it uses. @@ -538,11 +539,18 @@ struct QueuedEvent } as; }; +struct TurnRNG +{ + u16 tag; + u16 value; +}; + struct BattlerTurn { u8 hit:2; u8 criticalHit:2; u8 secondaryEffect:2; + struct TurnRNG rng; }; struct BattleTestData @@ -758,6 +766,8 @@ enum { TURN_CLOSED, TURN_OPEN, TURN_CLOSING }; #define SKIP_TURN(battler) SkipTurn(__LINE__, battler) #define SEND_OUT(battler, partyIndex) SendOut(__LINE__, battler, partyIndex) +#define WITH_RNG(tag, value) rng: ((struct TurnRNG) { tag, value }) + struct MoveContext { u16 move; @@ -777,6 +787,8 @@ struct MoveContext u16 explicitAllowed:1; struct BattlePokemon *target; bool8 explicitTarget; + struct TurnRNG rng; + bool8 explicitRNG; }; void OpenTurn(u32 sourceLine); diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index d869bf2e51..1b03341a45 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -292,6 +292,20 @@ static void BattleTest_Run(void *data) u32 RandomUniform(enum RandomTag tag, u32 lo, u32 hi) { + const struct BattlerTurn *turn = NULL; + u32 default_ = hi; + + if (gCurrentTurnActionNumber < gBattlersCount) + { + u32 battlerId = gBattlerByTurnOrder[gCurrentTurnActionNumber]; + turn = &DATA.battleRecordTurns[gBattleResults.battleTurnCounter][battlerId]; + } + + if (turn && turn->rng.tag == tag) + { + default_ = turn->rng.value; + } + if (tag == STATE->rngTag) { u32 n = hi - lo + 1; @@ -308,7 +322,7 @@ u32 RandomUniform(enum RandomTag tag, u32 lo, u32 hi) return STATE->runTrial + lo; } - return hi; + return default_; } u32 RandomWeightedArray(enum RandomTag tag, u32 sum, u32 n, const u8 *weights) @@ -322,28 +336,35 @@ u32 RandomWeightedArray(enum RandomTag tag, u32 sum, u32 n, const u8 *weights) turn = &DATA.battleRecordTurns[gBattleResults.battleTurnCounter][battlerId]; } - switch (tag) + if (turn && turn->rng.tag == tag) { - case RNG_ACCURACY: - ASSUME(n == 2); - if (turn && turn->hit) - return turn->hit - 1; - default_ = TRUE; - break; + default_ = turn->rng.value; + } + else + { + switch (tag) + { + case RNG_ACCURACY: + ASSUME(n == 2); + if (turn && turn->hit) + return turn->hit - 1; + default_ = TRUE; + break; - case RNG_CRITICAL_HIT: - ASSUME(n == 2); - if (turn && turn->criticalHit) - return turn->criticalHit - 1; - default_ = FALSE; - break; + case RNG_CRITICAL_HIT: + ASSUME(n == 2); + if (turn && turn->criticalHit) + return turn->criticalHit - 1; + default_ = FALSE; + break; - case RNG_SECONDARY_EFFECT: - ASSUME(n == 2); - if (turn && turn->secondaryEffect) - return turn->secondaryEffect - 1; - default_ = TRUE; - break; + case RNG_SECONDARY_EFFECT: + ASSUME(n == 2); + if (turn && turn->secondaryEffect) + return turn->secondaryEffect - 1; + default_ = TRUE; + break; + } } if (tag == STATE->rngTag) @@ -365,6 +386,52 @@ u32 RandomWeightedArray(enum RandomTag tag, u32 sum, u32 n, const u8 *weights) return default_; } +const void *RandomElementArray(enum RandomTag tag, const void *array, size_t size, size_t count) +{ + const struct BattlerTurn *turn = NULL; + u32 index = count-1; + + if (gCurrentTurnActionNumber < gBattlersCount) + { + u32 battlerId = gBattlerByTurnOrder[gCurrentTurnActionNumber]; + turn = &DATA.battleRecordTurns[gBattleResults.battleTurnCounter][battlerId]; + } + + if (turn && turn->rng.tag == tag) + { + u32 element; + for (index = 0; index < count; index++) + { + memcpy(&element, (const u8 *)array + size * index, size); + if (element == turn->rng.value) + break; + } + if (index == count) + { + // TODO: Incorporate the line number. + const char *filename = gTestRunnerState.test->filename; + Test_ExitWithResult(TEST_RESULT_ERROR, "%s: RandomElement illegal value requested: %d", filename, turn->rng.value); + } + } + + if (tag == STATE->rngTag) + { + if (STATE->trials == 1) + { + STATE->trials = count; + PrintTestName(); + } + else if (STATE->trials != count) + { + Test_ExitWithResult(TEST_RESULT_ERROR, "RandomElement called with inconsistent trials %d and %d", STATE->trials, count); + } + STATE->trialRatio = Q_4_12(1) / count; + index = STATE->runTrial; + } + + return (const u8 *)array + size * index; +} + static s32 TryAbilityPopUp(s32 i, s32 n, u32 battlerId, u32 ability) { struct QueuedAbilityEvent *event; @@ -1357,6 +1424,8 @@ void Move(u32 sourceLine, struct BattlePokemon *battler, struct MoveContext ctx) DATA.battleRecordTurns[DATA.turns][battlerId].criticalHit = 1 + ctx.criticalHit; if (ctx.explicitSecondaryEffect) DATA.battleRecordTurns[DATA.turns][battlerId].secondaryEffect = 1 + ctx.secondaryEffect; + if (ctx.explicitRNG) + DATA.battleRecordTurns[DATA.turns][battlerId].rng = ctx.rng; if (!(DATA.actionBattlers & (1 << battlerId))) { diff --git a/test/trainer_control.c b/test/trainer_control.c index 3079422076..2a21dcdf61 100644 --- a/test/trainer_control.c +++ b/test/trainer_control.c @@ -81,7 +81,7 @@ TEST("CreateNPCTrainerPartyForTrainer generates customized Pokémon") EXPECT(GetMonData(&testParty[0], MON_DATA_HELD_ITEM, 0) == ITEM_ASSAULT_VEST); EXPECT(GetMonData(&testParty[1], MON_DATA_HELD_ITEM, 0) == ITEM_NONE); - + EXPECT(GetMonData(&testParty[0], MON_DATA_HP_IV, 0) == 25); EXPECT(GetMonData(&testParty[0], MON_DATA_ATK_IV, 0) == 26); EXPECT(GetMonData(&testParty[0], MON_DATA_DEF_IV, 0) == 27);