Wild mon that have a natural enemy or preys on other mon will attack them whem partnered in double wild battles.
This commit is contained in:
parent
ae1d124a0c
commit
1708ac4b1b
2 changed files with 42 additions and 2 deletions
|
@ -52,6 +52,10 @@
|
|||
#define SPECIES_MORPEKO 0
|
||||
#define SPECIES_MORPEKO_HANGRY 10020
|
||||
#define SPECIES_SIRFETCHD 10021
|
||||
#define SPECIES_HEATMOR 0
|
||||
#define SPECIES_DURANT 0
|
||||
#define SPECIES_CARBINK 0
|
||||
#define SPECIES_MAREANIE 0
|
||||
#endif
|
||||
|
||||
// Items with peculiar battle effects.
|
||||
|
@ -227,7 +231,8 @@
|
|||
#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball.
|
||||
|
||||
// Other
|
||||
#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter.
|
||||
#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter.
|
||||
#define B_WILD_NATURAL_ENEMIES TRUE // Certain wild mon species will attack other species when partnered in double wild battles (eg. Zangoose vs Seviper)
|
||||
|
||||
// Animation Settings
|
||||
#define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle.
|
||||
|
|
|
@ -1617,7 +1617,42 @@ static void OpponentHandleChooseMove(void)
|
|||
if (gBattleMoves[move].target & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (gActiveBattler << 8));
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8));
|
||||
{
|
||||
#if B_WILD_NATURAL_ENEMIES == TRUE
|
||||
// Don't bother to loop through table if the move can't attack ally
|
||||
if (!(gBattleMoves[move].target & MOVE_TARGET_BOTH))
|
||||
{
|
||||
u16 i, speciesAttacker, speciesTarget, isPartnerEnemy = FALSE;
|
||||
static const u16 naturalEnemies[][2] =
|
||||
{
|
||||
// Attacker Target
|
||||
{SPECIES_ZANGOOSE, SPECIES_SEVIPER},
|
||||
{SPECIES_SEVIPER, SPECIES_ZANGOOSE},
|
||||
{SPECIES_HEATMOR, SPECIES_DURANT},
|
||||
{SPECIES_DURANT, SPECIES_HEATMOR},
|
||||
{SPECIES_SABLEYE, SPECIES_CARBINK},
|
||||
{SPECIES_MAREANIE, SPECIES_CORSOLA},
|
||||
};
|
||||
speciesAttacker = gBattleMons[gActiveBattler].species;
|
||||
speciesTarget = gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(gActiveBattler))].species;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(naturalEnemies); i++)
|
||||
{
|
||||
if (speciesAttacker == naturalEnemies[i][0] && speciesTarget == naturalEnemies[i][1])
|
||||
{
|
||||
isPartnerEnemy = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isPartnerEnemy)
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(BATTLE_PARTNER(gActiveBattler)) << 8));
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8));
|
||||
}
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8));
|
||||
|
||||
|
|
Loading…
Reference in a new issue