From b0027cb78b52cdc7ba749a01b17df796bd90e827 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 2 Dec 2022 23:07:25 -0300 Subject: [PATCH] Implemented Seed Sower's effect --- data/battle_scripts_1.s | 9 +++++++++ include/battle_scripts.h | 1 + src/battle_util.c | 12 ++++++++++++ 3 files changed, 22 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 6b8067721..d807f5610 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7023,6 +7023,15 @@ BattleScript_GulpMissileGorgingTargetDefenseCantGoLower: waitmessage B_WAIT_TIME_LONG return +BattleScript_SeedSowerActivates:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_TERRAINBECOMESGRASSY + waitmessage B_WAIT_TIME_LONG + playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG + call BattleScript_TerrainSeedLoop + return + BattleScript_PerishSongCountGoesDown:: printstring STRINGID_PKMNPERISHCOUNTFELL waitmessage B_WAIT_TIME_LONG diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 23f18e3be..d9dafe5df 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -433,6 +433,7 @@ extern const u8 BattleScript_SymbiosisActivates[]; extern const u8 BattleScript_MultiHitPrintStrings[]; extern const u8 BattleScript_BurnUpRemoveType[]; extern const u8 BattleScript_TargetAbilityStatRaiseRet[]; +extern const u8 BattleScript_SeedSowerActivates[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/src/battle_util.c b/src/battle_util.c index 72b26417c..e0b3f4b1b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5723,6 +5723,18 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } } break; + case ABILITY_SEED_SOWER: + if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + && !gProtectStructs[gBattlerAttacker].confusionSelfDmg + && TARGET_TURN_DAMAGED + && IsBattlerAlive(gBattlerTarget) + && TryChangeBattleTerrain(gBattlerTarget, STATUS_FIELD_GRASSY_TERRAIN, &gFieldTimers.terrainTimer)) + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_SeedSowerActivates; + effect++; + } + break; } break; case ABILITYEFFECT_MOVE_END_ATTACKER: // Same as above, but for attacker