mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 23:23:43 +01:00
Merge pull request #2004 from ghoulslash/be/sports
Add sport effects back
This commit is contained in:
commit
7bffe6d1d5
@ -25,6 +25,10 @@
|
||||
#define ABILITYEFFECT_TRACE2 13
|
||||
#define ABILITYEFFECT_MOVE_END_OTHER 14
|
||||
#define ABILITYEFFECT_NEUTRALIZINGGAS 15
|
||||
#define ABILITYEFFECT_FIELD_SPORT 16 // Only used if B_SPORT_TURNS < GEN_6
|
||||
// Special cases
|
||||
#define ABILITYEFFECT_MUD_SPORT 252 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_WATER_SPORT 253 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_SWITCH_IN_TERRAIN 254
|
||||
#define ABILITYEFFECT_SWITCH_IN_WEATHER 255
|
||||
|
||||
|
@ -174,6 +174,8 @@
|
||||
|
||||
#define STATUS4_ELECTRIFIED (1 << 0)
|
||||
#define STATUS4_PLASMA_FISTS (1 << 1)
|
||||
#define STATUS4_MUD_SPORT (1 << 2) // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define STATUS4_WATER_SPORT (1 << 3) // Only used if B_SPORT_TURNS < GEN_6
|
||||
|
||||
#define HITMARKER_WAKE_UP_CLEAR (1 << 4) // Cleared when waking up. Never set or checked.
|
||||
#define HITMARKER_SKIP_DMG_TRACK (1 << 5)
|
||||
|
@ -118,7 +118,8 @@
|
||||
#define B_PAYBACK_SWITCH_BOOST GEN_7 // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled.
|
||||
#define B_HIDDEN_POWER_DMG GEN_7 // In Gen6+, Hidden Power's base power was set to always be 60. Before, it was determined by the mon's IVs.
|
||||
#define B_ROUGH_SKIN_DMG GEN_7 // In Gen4+, Rough Skin contact damage is 1/8th of max HP instead of 1/16th. This will also affect Iron Barbs.
|
||||
#define B_KNOCK_OFF_DMG GEN_8 // In Gen6+, Knock Off deals 50% more damage when knocking off an item
|
||||
#define B_KNOCK_OFF_DMG GEN_8 // In Gen6+, Knock Off deals 50% more damage when knocking off an item.
|
||||
#define B_SPORT_DMG_REDUCTION GEN_7 // In Gen5+, Water/Mud Sport reduce Fire/Electric Damage by 67% instead of 50%.
|
||||
|
||||
// Type settings
|
||||
#define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle.
|
||||
@ -135,6 +136,7 @@
|
||||
#define B_TAILWIND_TURNS GEN_7 // In Gen5+, Tailwind lasts 4 turns instead of 3.
|
||||
#define B_SLEEP_TURNS GEN_7 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns.
|
||||
#define B_TAUNT_TURNS GEN_7 // In Gen5+, Taunt lasts 3 turns if the user acts before the target, or 4 turns if the target acted before the user. In Gen3, taunt lasts 2 turns and in Gen 4, 3-5 turns.
|
||||
#define B_SPORT_TURNS GEN_7 // In Gen6+, Water/Mud Sport last 5 turns, even if the user switches out.
|
||||
|
||||
// Move data settings
|
||||
#define B_UPDATED_MOVE_DATA GEN_8 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc.
|
||||
|
@ -1603,11 +1603,13 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
break;
|
||||
case EFFECT_MUD_SPORT:
|
||||
if (gFieldStatuses & STATUS_FIELD_MUDSPORT
|
||||
|| gStatuses4[battlerAtk] & STATUS4_MUD_SPORT
|
||||
|| PartnerHasSameMoveEffectWithoutTarget(AI_DATA->battlerAtkPartner, move, AI_DATA->partnerMove))
|
||||
score -= 10;
|
||||
break;
|
||||
case EFFECT_WATER_SPORT:
|
||||
if (gFieldStatuses & STATUS_FIELD_WATERSPORT
|
||||
|| gStatuses4[battlerAtk] & STATUS4_WATER_SPORT
|
||||
|| PartnerHasSameMoveEffectWithoutTarget(AI_DATA->battlerAtkPartner, move, AI_DATA->partnerMove))
|
||||
score -= 10;
|
||||
break;
|
||||
|
@ -3030,7 +3030,7 @@ void SwitchInClearSetData(void)
|
||||
gStatuses3[gActiveBattler] &= (STATUS3_LEECHSEED_BATTLER | STATUS3_LEECHSEED | STATUS3_ALWAYS_HITS | STATUS3_PERISH_SONG | STATUS3_ROOTED
|
||||
| STATUS3_GASTRO_ACID | STATUS3_EMBARGO | STATUS3_TELEKINESIS | STATUS3_MAGNET_RISE | STATUS3_HEAL_BLOCK
|
||||
| STATUS3_AQUA_RING | STATUS3_POWER_TRICK);
|
||||
|
||||
gStatuses4[gActiveBattler] &= (STATUS4_MUD_SPORT | STATUS4_WATER_SPORT);
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (GetBattlerSide(gActiveBattler) != GetBattlerSide(i)
|
||||
@ -3048,9 +3048,8 @@ void SwitchInClearSetData(void)
|
||||
{
|
||||
gBattleMons[gActiveBattler].status2 = 0;
|
||||
gStatuses3[gActiveBattler] = 0;
|
||||
gStatuses4[gActiveBattler] = 0;
|
||||
}
|
||||
|
||||
gStatuses4[gActiveBattler] = 0;
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
|
@ -12996,23 +12996,41 @@ static void Cmd_settypebasedhalvers(void) // water and mud sport
|
||||
|
||||
if (gBattleMoves[gCurrentMove].effect == EFFECT_MUD_SPORT)
|
||||
{
|
||||
if (!(gFieldStatuses & STATUS_FIELD_MUDSPORT))
|
||||
{
|
||||
gFieldStatuses |= STATUS_FIELD_MUDSPORT;
|
||||
gFieldTimers.mudSportTimer = 5;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_ELECTRIC;
|
||||
worked = TRUE;
|
||||
}
|
||||
#if B_SPORT_TURNS >= GEN_6
|
||||
if (!(gFieldStatuses & STATUS_FIELD_MUDSPORT))
|
||||
{
|
||||
gFieldStatuses |= STATUS_FIELD_MUDSPORT;
|
||||
gFieldTimers.mudSportTimer = 5;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_ELECTRIC;
|
||||
worked = TRUE;
|
||||
}
|
||||
#else
|
||||
if (!(gStatuses4[gBattlerAttacker] & STATUS4_MUD_SPORT))
|
||||
{
|
||||
gStatuses4[gBattlerAttacker] |= STATUS4_MUD_SPORT;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_ELECTRIC;
|
||||
worked = TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else // water sport
|
||||
{
|
||||
if (!(gFieldStatuses & STATUS_FIELD_WATERSPORT))
|
||||
{
|
||||
gFieldStatuses |= STATUS_FIELD_WATERSPORT;
|
||||
gFieldTimers.waterSportTimer = 5;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_FIRE;
|
||||
worked = TRUE;
|
||||
}
|
||||
#if B_SPORT_TURNS >= GEN_6
|
||||
if (!(gFieldStatuses & STATUS_FIELD_WATERSPORT))
|
||||
{
|
||||
gFieldStatuses |= STATUS_FIELD_WATERSPORT;
|
||||
gFieldTimers.waterSportTimer = 5;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_FIRE;
|
||||
worked = TRUE;
|
||||
}
|
||||
#else
|
||||
if (!(gStatuses4[gBattlerAttacker] & STATUS4_WATER_SPORT))
|
||||
{
|
||||
gStatuses4[gBattlerAttacker] |= v;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEAKEN_FIRE;
|
||||
worked = TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (worked)
|
||||
|
@ -2381,21 +2381,25 @@ u8 DoFieldEndTurnEffects(void)
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_WATER_SPORT:
|
||||
if (gFieldStatuses & STATUS_FIELD_WATERSPORT && --gFieldTimers.waterSportTimer == 0)
|
||||
{
|
||||
gFieldStatuses &= ~STATUS_FIELD_WATERSPORT;
|
||||
BattleScriptExecute(BattleScript_WaterSportEnds);
|
||||
effect++;
|
||||
}
|
||||
#if B_SPORT_TURNS >= GEN_6
|
||||
if (gFieldStatuses & STATUS_FIELD_WATERSPORT && --gFieldTimers.waterSportTimer == 0)
|
||||
{
|
||||
gFieldStatuses &= ~STATUS_FIELD_WATERSPORT;
|
||||
BattleScriptExecute(BattleScript_WaterSportEnds);
|
||||
effect++;
|
||||
}
|
||||
#endif
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_MUD_SPORT:
|
||||
if (gFieldStatuses & STATUS_FIELD_MUDSPORT && --gFieldTimers.mudSportTimer == 0)
|
||||
{
|
||||
gFieldStatuses &= ~STATUS_FIELD_MUDSPORT;
|
||||
BattleScriptExecute(BattleScript_MudSportEnds);
|
||||
effect++;
|
||||
}
|
||||
#if B_SPORT_TURNS >= GEN_6
|
||||
if (gFieldStatuses & STATUS_FIELD_MUDSPORT && --gFieldTimers.mudSportTimer == 0)
|
||||
{
|
||||
gFieldStatuses &= ~STATUS_FIELD_MUDSPORT;
|
||||
BattleScriptExecute(BattleScript_MudSportEnds);
|
||||
effect++;
|
||||
}
|
||||
#endif
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_GRAVITY:
|
||||
@ -5620,6 +5624,35 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_FIELD_SPORT:
|
||||
switch (gLastUsedAbility)
|
||||
{
|
||||
case ABILITYEFFECT_MUD_SPORT:
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (gStatuses4[i] & STATUS4_MUD_SPORT)
|
||||
effect = i + 1;
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_WATER_SPORT:
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (gStatuses4[i] & STATUS4_WATER_SPORT)
|
||||
effect = i + 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (gBattleMons[i].ability == ability)
|
||||
{
|
||||
gLastUsedAbility = ability;
|
||||
effect = i + 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (effect && gLastUsedAbility != 0xFF)
|
||||
@ -8329,7 +8362,15 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
|
||||
MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5));
|
||||
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && moveType == TYPE_PSYCHIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE))
|
||||
MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5));
|
||||
|
||||
#if B_SPORT_TURNS >= GEN_6
|
||||
if ((gFieldStatuses & STATUS_FIELD_MUDSPORT && moveType == TYPE_ELECTRIC)
|
||||
|| (gFieldStatuses & STATUS_FIELD_WATERSPORT && moveType == TYPE_FIRE))
|
||||
MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5));
|
||||
#else
|
||||
if ((moveType == TYPE_ELECTRIC && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_MUD_SPORT, 0))
|
||||
|| (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0)))
|
||||
MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5));
|
||||
#endif
|
||||
return ApplyModifier(modifier, basePower);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user