Implemented Triple Arrows' effect

This commit is contained in:
LOuroboros 2022-12-14 10:18:38 -03:00
parent 6574e01e73
commit 1595a66559
6 changed files with 49 additions and 5 deletions

View File

@ -423,6 +423,11 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHitSetEntryHazard @ EFFECT_HIT_SET_ENTRY_HAZARD
.4byte BattleScript_EffectDireClaw @ EFFECT_DIRE_CLAW
.4byte BattleScript_EffectBarbBarrage @ EFFECT_BARB_BARRAGE
.4byte BattleScript_EffectTripleArrows @ EFFECT_TRIPLE_ARROWS
BattleScript_EffectTripleArrows::
setmoveeffect MOVE_EFFECT_TRIPLE_ARROWS
goto BattleScript_EffectHit
BattleScript_StealthRockActivates::
setstealthrock BattleScript_MoveEnd
@ -1451,6 +1456,11 @@ BattleScript_DoubleShockRemoveType::
waitmessage B_WAIT_TIME_LONG
return
BattleScript_DefDown::
modifybattlerstatstage BS_TARGET, STAT_DEF, DECREASE, 1, BattleScript_DefDown_Ret, ANIM_ON
BattleScript_DefDown_Ret:
return
BattleScript_EffectPurify:
attackcanceler
attackstring

View File

@ -457,6 +457,7 @@ extern const u8 BattleScript_DampPreventsAftermath[];
extern const u8 BattleScript_HealingWishActivates[];
extern const u8 BattleScript_LunarDanceActivates[];
extern const u8 BattleScript_ShellTrapSetUp[];
extern const u8 BattleScript_DefDown[];
extern const u8 BattleScript_CouldntFullyProtect[];
extern const u8 BattleScript_MoveEffectStockpileWoreOff[];
extern const u8 BattleScript_StealthRockActivates[];

View File

@ -376,8 +376,9 @@
#define MOVE_EFFECT_DIRE_CLAW 74
#define MOVE_EFFECT_STEALTH_ROCK 75
#define MOVE_EFFECT_SPIKES 76
#define MOVE_EFFECT_TRIPLE_ARROWS 77
#define NUM_MOVE_EFFECTS 77
#define NUM_MOVE_EFFECTS 78
#define MOVE_EFFECT_AFFECTS_USER 0x4000
#define MOVE_EFFECT_CERTAIN 0x8000

View File

@ -404,7 +404,8 @@
#define EFFECT_HIT_SET_ENTRY_HAZARD 398
#define EFFECT_DIRE_CLAW 399
#define EFFECT_BARB_BARRAGE 400
#define EFFECT_TRIPLE_ARROWS 401
#define NUM_BATTLE_MOVE_EFFECTS 401
#define NUM_BATTLE_MOVE_EFFECTS 402
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -2082,7 +2082,8 @@ s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbi
#if B_AFFECTION_MECHANICS == TRUE
+ 2 * (GetBattlerFriendshipScore(gBattlerAttacker) >= FRIENDSHIP_200_TO_254)
#endif
+ (abilityAtk == ABILITY_SUPER_LUCK);
+ (abilityAtk == ABILITY_SUPER_LUCK)
+ (gBattleMoves[move].effect == EFFECT_TRIPLE_ARROWS);
if (critChance >= ARRAY_COUNT(sCriticalHitChance))
critChance = ARRAY_COUNT(sCriticalHitChance) - 1;
@ -3799,6 +3800,35 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattlescriptCurrInstr = BattleScript_SpikesActivates;
}
break;
case MOVE_EFFECT_TRIPLE_ARROWS:
{
u32 randomChance = Random() % 100;
if (randomChance < 50) // Chance to reduce a foe's Defense by 1 stat stage.
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_DefDown;
}
if (randomChance >= 50 && randomChance <= 80) // Chance to cause a foe to flinch.
{
if (battlerAbility == ABILITY_INNER_FOCUS)
{
if (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)
{
gLastUsedAbility = ABILITY_INNER_FOCUS;
gBattlerAbility = gEffectBattler;
RecordAbilityBattle(gEffectBattler, ABILITY_INNER_FOCUS);
gBattlescriptCurrInstr = BattleScript_FlinchPrevention;
}
}
else
{
if (GetBattlerTurnOrderNum(gEffectBattler) > gCurrentTurnActionNumber)
gBattleMons[gEffectBattler].status2 |= sStatusFlagsForMoveEffects[MOVE_EFFECT_FLINCH];
gBattlescriptCurrInstr++;
}
}
}
break;
}
}
}

View File

@ -12726,13 +12726,14 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
{
#if B_UPDATED_MOVE_DATA >= GEN_9
.power = 90,
.pp = 10,
#else
.power = 50,
.pp = 15,
#endif
.effect = EFFECT_PLACEHOLDER, // EFFECT_TRIPLE_ARROWS,
.effect = EFFECT_TRIPLE_ARROWS,
.type = TYPE_FIGHTING,
.accuracy = 100,
.pp = 15,
.secondaryEffectChance = 100,
.target = MOVE_TARGET_SELECTED,
.priority = 0,