Skip to content

Commit

Permalink
Implemented Slow Start.
Browse files Browse the repository at this point in the history
  • Loading branch information
LOuroboros committed May 26, 2019
1 parent 05489be commit 096d3a3
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 10 deletions.
2 changes: 2 additions & 0 deletions constants/battle_text.inc
Expand Up @@ -355,3 +355,5 @@
enum BATTLE_TEXT_WhipHailstorm
enum BATTLE_TEXT_DrySkinDmg
enum BATTLE_TEXT_BadDreamsDmg
enum BATTLE_TEXT_SlowStarted
enum BATTLE_TEXT_SlowStartEnds
10 changes: 10 additions & 0 deletions data/battle_scripts_1.s
Expand Up @@ -4303,6 +4303,16 @@ BattleScript_DrySkinDmg::
datahpupdate USER
end3

BattleScript_SlowStarted::
printstring BATTLE_TEXT_SlowStarted
waitmessage 64
end3

BattleScript_SlowStartEnds::
printstring BATTLE_TEXT_SlowStartEnds
waitmessage 64
end3

BattleScript_CuteCharmActivates:: @ 81D9943
status2animation USER, STATUS2_INFATUATION
printstring BATTLE_TEXT_InfatuatedPoke
Expand Down
6 changes: 3 additions & 3 deletions data/text/ability_descriptions.inc
Expand Up @@ -328,8 +328,8 @@ gAbilityDescription_Simple:
gAbilityDescription_SkillLink:
.string "Enhances multi-hit moves.$"

gAbilityDescription_SlowStart: @ Placeholder
.string "Placeholder text.$"
gAbilityDescription_SlowStart:
.string "Halves ATK & SPD for a while.$"

gAbilityDescription_Sniper:
.string "Ups critical hits.$"
Expand Down Expand Up @@ -485,7 +485,7 @@ gAbilityDescriptions:: @ 81FA110
.4byte gAbilityDescription_Scrappy
.4byte gAbilityDescription_Simple
.4byte gAbilityDescription_SkillLink
.4byte gAbilityDescription_SlowStart @ Placeholder
.4byte gAbilityDescription_SlowStart
.4byte gAbilityDescription_Sniper
.4byte gAbilityDescription_SnowCloak
.4byte gAbilityDescription_SnowWarning
Expand Down
2 changes: 1 addition & 1 deletion data/text/ability_names.inc
Expand Up @@ -109,7 +109,7 @@ gAbilityNames:: @ 81FA248
.string "SCRAPPY$", 13
.string "SIMPLE$", 13
.string "SKILL LINK$", 13
.string "SLOW START$", 13 @ Placeholder
.string "SLOW START$", 13
.string "SNIPER$", 13
.string "SNOW CLOAK$", 13
.string "SNOW WARNING$", 13
Expand Down
3 changes: 2 additions & 1 deletion include/battle.h
Expand Up @@ -391,7 +391,7 @@ struct DisableStruct
/*0x14*/ u8 bankPreventingEscape;
/*0x15*/ u8 bankWithSureHit;
/*0x16*/ u8 isFirstTurn;
/*0x17*/ u8 unk17;
/*0x17*/ u8 slowStartTimer;
/*0x18*/ u8 truantCounter : 1;
/*0x18*/ u8 unk18_a : 3;
/*0x18*/ u8 unk18_b : 4;
Expand Down Expand Up @@ -523,6 +523,7 @@ struct SpecialStatus
u8 flag20 : 1;
u8 flag40 : 1;
u8 focusBanded : 1;
u8 slowStarted : 1;
u8 field1[3];
s32 moveturnLostHP;
s32 moveturnLostHP_physical;
Expand Down
2 changes: 1 addition & 1 deletion include/constants/abilities.h
Expand Up @@ -113,7 +113,7 @@
#define ABILITY_SCRAPPY 107
#define ABILITY_SIMPLE 108
#define ABILITY_SKILL_LINK 109
#define ABILITY_SLOW_START 110 // Placeholder
#define ABILITY_SLOW_START 110
#define ABILITY_SNIPER 111
#define ABILITY_SNOW_CLOAK 112
#define ABILITY_SNOW_WARNING 113
Expand Down
6 changes: 6 additions & 0 deletions src/battle/battle_2.c
Expand Up @@ -4552,6 +4552,9 @@ u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreMovePriorities)
if (heldItemEffect == HOLD_EFFECT_MACHO_BRACE)
bank1AdjustedSpeed /= 2;

if (gBattleMons[bank1].ability == ABILITY_SLOW_START && gDisableStructs[bank1].slowStartTimer <= 4)
bank1AdjustedSpeed /= 2;

if (gBattleMons[bank1].status1 & STATUS_PARALYSIS && (gBattleMons[bank1].ability != ABILITY_QUICK_FEET))
bank1AdjustedSpeed /= 4;

Expand Down Expand Up @@ -4589,6 +4592,9 @@ u8 GetWhoStrikesFirst(u8 bank1, u8 bank2, bool8 ignoreMovePriorities)
if (heldItemEffect == HOLD_EFFECT_MACHO_BRACE)
bank2AdjustedSpeed /= 2;

if (gBattleMons[bank2].ability == ABILITY_SLOW_START && gDisableStructs[bank2].slowStartTimer <= 4)
bank2AdjustedSpeed /= 2;

if (gBattleMons[bank2].status1 & STATUS_PARALYSIS && (gBattleMons[bank2].ability != ABILITY_QUICK_FEET))
bank2AdjustedSpeed /= 4;

Expand Down
2 changes: 1 addition & 1 deletion src/battle/battle_message.c
Expand Up @@ -16,7 +16,7 @@
#include "ewram.h"

#define BATTLESTRING_TO_SUB 12
#define BATTLESTRINGS_NO 356
#define BATTLESTRINGS_NO 358
#define BATTLESTRINGS_MAX BATTLESTRINGS_NO + BATTLESTRING_TO_SUB

#ifdef GERMAN
Expand Down
20 changes: 20 additions & 0 deletions src/battle/battle_util.c
Expand Up @@ -162,6 +162,8 @@ extern u8 BattleScript_DrySkinDmg[];
extern u8 BattleScript_IceBodyActivates[];
extern u8 BattleScript_ShedSkinActivates[];
extern u8 BattleScript_SpeedBoostActivates[];
extern u8 BattleScript_SlowStarted[];
extern u8 BattleScript_SlowStartEnds[];
extern u8 BattleScript_SoundproofProtected[];
extern u8 BattleScript_MoveHPDrain[];
extern u8 BattleScript_MoveHPDrain_PPLoss[];
Expand Down Expand Up @@ -1855,6 +1857,14 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleStruct->castformToChangeInto = effect - 1;
}
break;
case ABILITY_SLOW_START:
if (!(gSpecialStatuses[bank].slowStarted))
{
gSpecialStatuses[bank].slowStarted = 1; // This is entirely useless, but I'm leaving it in as some sort of ritual thingy anyway.
BattleScriptPushCursorAndCallback(BattleScript_SlowStarted);
effect++;
}
break;
case ABILITY_TRACE:
if (!(gSpecialStatuses[bank].traced))
{
Expand Down Expand Up @@ -2012,6 +2022,16 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
effect++;
}
break;
case ABILITY_SLOW_START:
if (gDisableStructs[bank].slowStartTimer <= 4)
gDisableStructs[bank].slowStartTimer++;
if (gDisableStructs[bank].slowStartTimer == 5)
{
BattleScriptPushCursorAndCallback(BattleScript_SlowStartEnds);
gDisableStructs[bank].slowStartTimer = 6;
effect++;
}
break;
case ABILITY_TRUANT:
gDisableStructs[gBankAttacker].truantCounter ^= 1;
break;
Expand Down
3 changes: 2 additions & 1 deletion src/battle/calculate_base_damage.c
Expand Up @@ -225,7 +225,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
gBattleMovePower = (150 * gBattleMovePower) / 100;
if (defender->ability == ABILITY_DRY_SKIN && (gBattleMoves[gCurrentMove].type == TYPE_FIRE))
gBattleMovePower = (125 * gBattleMovePower) / 100;

if (attacker->ability == ABILITY_SLOW_START && gDisableStructs[bankAtk].slowStartTimer <= 4)
attack /= 2;

// Rivalry
if (GetGenderFromSpeciesAndPersonality(attacker->species, attacker->personality) != MON_GENDERLESS
Expand Down
6 changes: 6 additions & 0 deletions src/data/battle_strings_en.h
Expand Up @@ -358,6 +358,8 @@ enum
BATTLE_TEXT_WhipHailstorm,
BATTLE_TEXT_DrySkinDmg,
BATTLE_TEXT_BadDreamsDmg,
BATTLE_TEXT_SlowStarted,
BATTLE_TEXT_SlowStartEnds,
};

const u8 BattleText_UnknownString[] = _("{STRING 33}");
Expand Down Expand Up @@ -850,6 +852,8 @@ const u8 BattleText_AngerPointBoost[] = _("{STRING 23} maximized {DEFENDING_MON}
const u8 BattleText_WhipHailstorm[] = _("{STRING 16}'s {STRING 23}\nwhipped up a hailstorm!");
const u8 BattleText_DrySkinDmg[] = _("{DEFENDING_MON}'s {STRING 22}\ncaused damage!");
const u8 BattleText_BadDreamsDmg[] = _("{DEFENDING_MON} is tormented\nby {ATTACKING_MON}'s BAD DREAMS!");
const u8 BattleText_SlowStarted[] = _("{DEFENDING_MON} can't get it going!");
const u8 BattleText_SlowStartEnds[] = _("{DEFENDING_MON} put its act together!");

const u8 *const gUnknown_08400F58[] =
{
Expand Down Expand Up @@ -1230,6 +1234,8 @@ const u8 *const gBattleStringsTable[] =
BattleText_WhipHailstorm,
BattleText_DrySkinDmg,
BattleText_BadDreamsDmg,
BattleText_SlowStarted,
BattleText_SlowStartEnds,
};

// below are lists of battle string enums and NOT pointers to the strings.
Expand Down
4 changes: 2 additions & 2 deletions src/data/pokemon/base_stats.h
Expand Up @@ -16123,8 +16123,8 @@ const struct BaseStats gBaseStats[] =
.growthRate = GROWTH_SLOW,
.eggGroup1 = EGG_GROUP_UNDISCOVERED,
.eggGroup2 = EGG_GROUP_UNDISCOVERED,
.ability1 = ABILITY_TRUANT,
.ability2 = ABILITY_TRUANT,
.ability1 = ABILITY_SLOW_START,
.ability2 = ABILITY_NONE,
.safariZoneFleeRate = 0,
.bodyColor = BODY_COLOR_WHITE,
.noFlip = FALSE,
Expand Down

0 comments on commit 096d3a3

Please sign in to comment.