mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 13:53:52 +01:00
Berserk
This commit is contained in:
parent
458809c5f7
commit
8f61445dfe
@ -539,6 +539,7 @@ struct BattleStruct
|
|||||||
u8 lastMoveTarget[MAX_BATTLERS_COUNT]; // The last target on which each mon used a move, for the sake of Instruct
|
u8 lastMoveTarget[MAX_BATTLERS_COUNT]; // The last target on which each mon used a move, for the sake of Instruct
|
||||||
u8 debugHoldEffects[MAX_BATTLERS_COUNT]; // These override actual items' hold effects.
|
u8 debugHoldEffects[MAX_BATTLERS_COUNT]; // These override actual items' hold effects.
|
||||||
u8 tracedAbility[MAX_BATTLERS_COUNT];
|
u8 tracedAbility[MAX_BATTLERS_COUNT];
|
||||||
|
u16 hpBefore[MAX_BATTLERS_COUNT]; // Hp of battlers before using a move. For Berserk
|
||||||
bool8 spriteIgnore0Hp;
|
bool8 spriteIgnore0Hp;
|
||||||
struct Illusion illusion[MAX_BATTLERS_COUNT];
|
struct Illusion illusion[MAX_BATTLERS_COUNT];
|
||||||
};
|
};
|
||||||
|
@ -5068,7 +5068,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk)
|
|||||||
|
|
||||||
static void HandleAction_UseMove(void)
|
static void HandleAction_UseMove(void)
|
||||||
{
|
{
|
||||||
u32 side, moveType, var = 4;
|
u32 i, side, moveType, var = 4;
|
||||||
|
|
||||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
||||||
if (gBattleStruct->field_91 & gBitTable[gBattlerAttacker] || !IsBattlerAlive(gBattlerAttacker))
|
if (gBattleStruct->field_91 & gBitTable[gBattlerAttacker] || !IsBattlerAlive(gBattlerAttacker))
|
||||||
@ -5316,6 +5316,10 @@ static void HandleAction_UseMove(void)
|
|||||||
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
|
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
|
||||||
BattleArena_AddMindPoints(gBattlerAttacker);
|
BattleArena_AddMindPoints(gBattlerAttacker);
|
||||||
|
|
||||||
|
// Record HP of each battler
|
||||||
|
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||||
|
gBattleStruct->hpBefore[i] = gBattleMons[i].hp;
|
||||||
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3286,6 +3286,23 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
|||||||
effect++;
|
effect++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ABILITY_BERSERK:
|
||||||
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
|
&& TARGET_TURN_DAMAGED
|
||||||
|
&& IsBattlerAlive(battler)
|
||||||
|
// Had more than half of hp before, now has less
|
||||||
|
&& gBattleStruct->hpBefore[battler] > gBattleMons[battler].maxHP / 2
|
||||||
|
&& gBattleMons[battler].hp < gBattleMons[battler].maxHP / 2
|
||||||
|
&& (gMultiHitCounter == 0 || gMultiHitCounter == 1)
|
||||||
|
&& !(GetBattlerAbility(gBattlerAttacker) == ABILITY_SHEER_FORCE && gBattleMoves[gCurrentMove].flags & FLAG_SHEER_FORCE_BOOST)
|
||||||
|
&& gBattleMons[battler].statStages[STAT_SPATK] != 12)
|
||||||
|
{
|
||||||
|
SET_STATCHANGER(STAT_SPATK, 1, FALSE);
|
||||||
|
BattleScriptPushCursor();
|
||||||
|
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaise;
|
||||||
|
effect++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ABILITY_WEAK_ARMOR:
|
case ABILITY_WEAK_ARMOR:
|
||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& TARGET_TURN_DAMAGED
|
&& TARGET_TURN_DAMAGED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user