Remove redundant Future Sight flag (#8185)
This commit is contained in:
parent
d2425c1468
commit
d9797fa01d
@ -4,11 +4,6 @@
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_ai_field_statuses.h"
|
||||
|
||||
// Left and right are determined by how they're referred to in tests and everywhere else.
|
||||
// Left is battlers 0 and 1, right 2 and 3; if you assume the battler referencing them is south, left is to the northeast and right to the northwest.
|
||||
#define LEFT_FOE(battler) ((BATTLE_OPPOSITE(battler)) & BIT_SIDE)
|
||||
#define RIGHT_FOE(battler) (((BATTLE_OPPOSITE(battler)) & BIT_SIDE) | BIT_FLANK)
|
||||
|
||||
// Roll boundaries used by AI when scoring. Doesn't affect actual damage dealt.
|
||||
#define MAX_ROLL_PERCENTAGE DMG_ROLL_PERCENT_HI
|
||||
#define MIN_ROLL_PERCENTAGE DMG_ROLL_PERCENT_LO
|
||||
|
||||
@ -45,6 +45,11 @@ enum BattlerId
|
||||
#define BATTLE_OPPOSITE(id) ((id) ^ BIT_SIDE)
|
||||
#define BATTLE_PARTNER(id) ((id) ^ BIT_FLANK)
|
||||
|
||||
// Left and right are determined by how they're referred to in tests and everywhere else.
|
||||
// Left is battlers 0 and 1, right 2 and 3; if you assume the battler referencing them is south, left is to the northeast and right to the northwest.
|
||||
#define LEFT_FOE(battler) ((BATTLE_OPPOSITE(battler)) & BIT_SIDE)
|
||||
#define RIGHT_FOE(battler) (((BATTLE_OPPOSITE(battler)) & BIT_SIDE) | BIT_FLANK)
|
||||
|
||||
enum BattleSide
|
||||
{
|
||||
B_SIDE_PLAYER = 0,
|
||||
@ -273,15 +278,14 @@ enum SemiInvulnerableExclusion
|
||||
#define SIDE_STATUS_REFLECT (1 << 0)
|
||||
#define SIDE_STATUS_LIGHTSCREEN (1 << 1)
|
||||
#define SIDE_STATUS_SAFEGUARD (1 << 2)
|
||||
#define SIDE_STATUS_FUTUREATTACK (1 << 3)
|
||||
#define SIDE_STATUS_MIST (1 << 4)
|
||||
#define SIDE_STATUS_TAILWIND (1 << 5)
|
||||
#define SIDE_STATUS_AURORA_VEIL (1 << 6)
|
||||
#define SIDE_STATUS_LUCKY_CHANT (1 << 7)
|
||||
#define SIDE_STATUS_DAMAGE_NON_TYPES (1 << 8)
|
||||
#define SIDE_STATUS_RAINBOW (1 << 9)
|
||||
#define SIDE_STATUS_SEA_OF_FIRE (1 << 10)
|
||||
#define SIDE_STATUS_SWAMP (1 << 11)
|
||||
#define SIDE_STATUS_MIST (1 << 3)
|
||||
#define SIDE_STATUS_TAILWIND (1 << 4)
|
||||
#define SIDE_STATUS_AURORA_VEIL (1 << 5)
|
||||
#define SIDE_STATUS_LUCKY_CHANT (1 << 6)
|
||||
#define SIDE_STATUS_DAMAGE_NON_TYPES (1 << 7)
|
||||
#define SIDE_STATUS_RAINBOW (1 << 8)
|
||||
#define SIDE_STATUS_SEA_OF_FIRE (1 << 9)
|
||||
#define SIDE_STATUS_SWAMP (1 << 10)
|
||||
|
||||
#define SIDE_STATUS_SCREEN_ANY (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL)
|
||||
#define SIDE_STATUS_PLEDGE_ANY (SIDE_STATUS_RAINBOW | SIDE_STATUS_SEA_OF_FIRE | SIDE_STATUS_SWAMP)
|
||||
|
||||
@ -1993,8 +1993,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
case EFFECT_FUTURE_SIGHT:
|
||||
if (gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_FUTUREATTACK
|
||||
|| gSideStatuses[GetBattlerSide(battlerAtk)] & SIDE_STATUS_FUTUREATTACK)
|
||||
if (gWishFutureKnock.futureSightCounter[LEFT_FOE(battlerAtk)] > gBattleTurnCounter
|
||||
|| gWishFutureKnock.futureSightCounter[RIGHT_FOE(battlerAtk)] > gBattleTurnCounter)
|
||||
ADJUST_SCORE(-12);
|
||||
else
|
||||
ADJUST_SCORE(GOOD_EFFECT);
|
||||
|
||||
@ -6831,10 +6831,10 @@ static void TrySwapStickyWebBattlerId(u32 battlerAtk, u32 battlerPartner)
|
||||
static void TrySwapWishBattlerIds(u32 battlerAtk, u32 battlerPartner)
|
||||
{
|
||||
u32 i, temp;
|
||||
u32 oppSide = GetBattlerSide(BATTLE_OPPOSITE(battlerAtk));
|
||||
|
||||
// if used future sight on opposing side, properly track who used it
|
||||
if (gSideStatuses[oppSide] & SIDE_STATUS_FUTUREATTACK)
|
||||
if (gWishFutureKnock.futureSightCounter[LEFT_FOE(battlerAtk)] > gBattleTurnCounter
|
||||
|| gWishFutureKnock.futureSightCounter[RIGHT_FOE(battlerAtk)] > gBattleTurnCounter)
|
||||
{
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
|
||||
@ -248,12 +248,6 @@ static bool32 HandleEndTurnFutureSight(u32 battler)
|
||||
|
||||
if (gWishFutureKnock.futureSightCounter[battler] == gBattleTurnCounter)
|
||||
{
|
||||
if (gWishFutureKnock.futureSightCounter[battler] == gBattleTurnCounter
|
||||
&& gWishFutureKnock.futureSightCounter[BATTLE_PARTNER(battler)] <= gBattleTurnCounter)
|
||||
{
|
||||
gSideStatuses[GetBattlerSide(battler)] &= ~SIDE_STATUS_FUTUREATTACK;
|
||||
}
|
||||
|
||||
if (!IsBattlerAlive(battler))
|
||||
return effect;
|
||||
|
||||
|
||||
@ -12348,7 +12348,6 @@ static void Cmd_setfutureattack(void)
|
||||
{
|
||||
CMD_ARGS();
|
||||
|
||||
gSideStatuses[GetBattlerSide(gBattlerTarget)] |= SIDE_STATUS_FUTUREATTACK;
|
||||
gWishFutureKnock.futureSightMove[gBattlerTarget] = gCurrentMove;
|
||||
gWishFutureKnock.futureSightBattlerIndex[gBattlerTarget] = gBattlerAttacker;
|
||||
gWishFutureKnock.futureSightPartyIndex[gBattlerTarget] = gBattlerPartyIndexes[gBattlerAttacker];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user