More changes from typeX to types[X]
This commit is contained in:
parent
cb4e687917
commit
5635f94036
18 changed files with 107 additions and 682 deletions
|
@ -834,29 +834,16 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER
|
|||
|
||||
#define SET_BATTLER_TYPE(battlerId, type) \
|
||||
{ \
|
||||
gBattleMons[battlerId].type1 = type; \
|
||||
gBattleMons[battlerId].type2 = type; \
|
||||
gBattleMons[battlerId].type3 = TYPE_MYSTERY; \
|
||||
gBattleMons[battlerId].types[0] = type; \
|
||||
gBattleMons[battlerId].types[1] = type; \
|
||||
gBattleMons[battlerId].types[2] = TYPE_MYSTERY; \
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
#define RESTORE_BATTLER_TYPE(battlerId) \
|
||||
{ \
|
||||
gBattleMons[battlerId].type1 = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; \
|
||||
gBattleMons[battlerId].type2 = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; \
|
||||
gBattleMons[battlerId].type3 = TYPE_MYSTERY; \
|
||||
=======
|
||||
#define IS_TYPE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
|
||||
#define IS_TYPE_SPECIAL(moveType)(moveType > TYPE_MYSTERY)
|
||||
|
||||
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0))
|
||||
|
||||
#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].types[0] == type || gBattleMons[battlerId].types[1] == type))
|
||||
#define SET_BATTLER_TYPE(battlerId, type) \
|
||||
{ \
|
||||
gBattleMons[battlerId].types[0] = type; \
|
||||
gBattleMons[battlerId].types[1] = type; \
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
gBattleMons[battlerId].types[0] = gSpeciesInfo[gBattleMons[battlerId].species].types[0]; \
|
||||
gBattleMons[battlerId].types[1] = gSpeciesInfo[gBattleMons[battlerId].species].types[1]; \
|
||||
gBattleMons[battlerId].types[2] = TYPE_MYSTERY; \
|
||||
}
|
||||
|
||||
#define IS_BATTLER_PROTECTED(battlerId)(gProtectStructs[battlerId].protected \
|
||||
|
|
|
@ -125,14 +125,8 @@ struct ChooseMoveStruct
|
|||
u8 currentPp[MAX_MON_MOVES];
|
||||
u8 maxPp[MAX_MON_MOVES];
|
||||
u16 species;
|
||||
<<<<<<< HEAD
|
||||
u8 monType1;
|
||||
u8 monType2;
|
||||
u8 monType3;
|
||||
u8 monTypes[3];
|
||||
struct ZMoveData zmove;
|
||||
=======
|
||||
u8 monTypes[2];
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
|
@ -322,11 +322,8 @@ struct BattlePokemon
|
|||
/*0x17*/ u32 spDefenseIV:5;
|
||||
/*0x17*/ u32 abilityNum:2;
|
||||
/*0x18*/ s8 statStages[NUM_BATTLE_STATS];
|
||||
<<<<<<< HEAD
|
||||
/*0x20*/ u16 ability;
|
||||
/*0x22*/ u8 type1;
|
||||
/*0x23*/ u8 type2;
|
||||
/*0x24*/ u8 type3;
|
||||
/*0x22*/ u8 types[3];
|
||||
/*0x25*/ u8 pp[MAX_MON_MOVES];
|
||||
/*0x29*/ u16 hp;
|
||||
/*0x2B*/ u8 level;
|
||||
|
@ -343,25 +340,6 @@ struct BattlePokemon
|
|||
/*0x55*/ u32 otId;
|
||||
/*0x59*/ u8 metLevel;
|
||||
/*0x5A*/ bool8 isShiny;
|
||||
=======
|
||||
/*0x20*/ u8 ability;
|
||||
/*0x21*/ u8 types[2];
|
||||
/*0x23*/ u8 unknown;
|
||||
/*0x24*/ u8 pp[MAX_MON_MOVES];
|
||||
/*0x28*/ u16 hp;
|
||||
/*0x2A*/ u8 level;
|
||||
/*0x2B*/ u8 friendship;
|
||||
/*0x2C*/ u16 maxHP;
|
||||
/*0x2E*/ u16 item;
|
||||
/*0x30*/ u8 nickname[POKEMON_NAME_LENGTH + 1];
|
||||
/*0x3B*/ u8 ppBonuses;
|
||||
/*0x3C*/ u8 otName[PLAYER_NAME_LENGTH + 1];
|
||||
/*0x44*/ u32 experience;
|
||||
/*0x48*/ u32 personality;
|
||||
/*0x4C*/ u32 status1;
|
||||
/*0x50*/ u32 status2;
|
||||
/*0x54*/ u32 otId;
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
};
|
||||
|
||||
struct Evolution
|
||||
|
|
|
@ -89,10 +89,10 @@ static bool32 HasBadOdds(u32 battler, bool32 emitResult)
|
|||
opposingBattler = GetBattlerAtPosition(opposingPosition);
|
||||
|
||||
// Gets types of player (opposingBattler) and computer (battler)
|
||||
atkType1 = gBattleMons[opposingBattler].type1;
|
||||
atkType2 = gBattleMons[opposingBattler].type2;
|
||||
defType1 = gBattleMons[battler].type1;
|
||||
defType2 = gBattleMons[battler].type2;
|
||||
atkType1 = gBattleMons[opposingBattler].types[0];
|
||||
atkType2 = gBattleMons[opposingBattler].types[1];
|
||||
defType1 = gBattleMons[battler].types[0];
|
||||
defType2 = gBattleMons[battler].types[1];
|
||||
|
||||
// Check AI moves for damage dealt
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
|
@ -1233,19 +1233,11 @@ static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId,
|
|||
{
|
||||
if (!(gBitTable[i] & invalidMons) && !(gBitTable[i] & bits))
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
u16 species = GetMonData(&party[i], MON_DATA_SPECIES);
|
||||
uq4_12_t typeEffectiveness = UQ_4_12(1.0);
|
||||
=======
|
||||
u8 type1 = gSpeciesInfo[species].types[0];
|
||||
u8 type2 = gSpeciesInfo[species].types[1];
|
||||
u8 typeDmg = TYPE_MUL_NORMAL;
|
||||
ModulateByTypeEffectiveness(gBattleMons[opposingBattler].types[0], type1, type2, &typeDmg);
|
||||
ModulateByTypeEffectiveness(gBattleMons[opposingBattler].types[1], type1, type2, &typeDmg);
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
|
||||
u8 atkType1 = gBattleMons[opposingBattler].type1;
|
||||
u8 atkType2 = gBattleMons[opposingBattler].type2;
|
||||
u8 atkType1 = gBattleMons[opposingBattler].types[0];
|
||||
u8 atkType2 = gBattleMons[opposingBattler].types[1];
|
||||
u8 defType1 = gSpeciesInfo[species].types[0];
|
||||
u8 defType2 = gSpeciesInfo[species].types[1];
|
||||
|
||||
|
@ -1345,7 +1337,7 @@ static bool32 IsMonGrounded(u16 heldItemEffect, u32 ability, u8 type1, u8 type2)
|
|||
// Gets hazard damage
|
||||
static u32 GetSwitchinHazardsDamage(u32 battler, struct BattlePokemon *battleMon)
|
||||
{
|
||||
u8 defType1 = battleMon->type1, defType2 = battleMon->type2, tSpikesLayers;
|
||||
u8 defType1 = battleMon->types[0], defType2 = battleMon->types[1], tSpikesLayers;
|
||||
u16 heldItemEffect = ItemId_GetHoldEffect(battleMon->item);
|
||||
u32 maxHP = battleMon->maxHP, ability = battleMon->ability, status = battleMon->status1;
|
||||
u32 spikesDamage = 0, tSpikesDamage = 0, hazardDamage = 0;
|
||||
|
@ -1412,7 +1404,7 @@ static s32 GetSwitchinWeatherImpact(void)
|
|||
if (holdEffect != HOLD_EFFECT_SAFETY_GOGGLES && ability != ABILITY_MAGIC_GUARD && ability != ABILITY_OVERCOAT)
|
||||
{
|
||||
if ((gBattleWeather & B_WEATHER_HAIL)
|
||||
&& (AI_DATA->switchinCandidate.battleMon.type1 != TYPE_ICE || AI_DATA->switchinCandidate.battleMon.type2 != TYPE_ICE)
|
||||
&& (AI_DATA->switchinCandidate.battleMon.types[0] != TYPE_ICE || AI_DATA->switchinCandidate.battleMon.types[1] != TYPE_ICE)
|
||||
&& ability != ABILITY_SNOW_CLOAK && ability != ABILITY_ICE_BODY)
|
||||
{
|
||||
weatherImpact = maxHP / 16;
|
||||
|
@ -1420,9 +1412,9 @@ static s32 GetSwitchinWeatherImpact(void)
|
|||
weatherImpact = 1;
|
||||
}
|
||||
else if ((gBattleWeather & B_WEATHER_SANDSTORM)
|
||||
&& (AI_DATA->switchinCandidate.battleMon.type1 != TYPE_GROUND && AI_DATA->switchinCandidate.battleMon.type2 != TYPE_GROUND
|
||||
&& AI_DATA->switchinCandidate.battleMon.type1 != TYPE_ROCK && AI_DATA->switchinCandidate.battleMon.type2 != TYPE_ROCK
|
||||
&& AI_DATA->switchinCandidate.battleMon.type1 != TYPE_STEEL && AI_DATA->switchinCandidate.battleMon.type2 != TYPE_STEEL
|
||||
&& (AI_DATA->switchinCandidate.battleMon.types[0] != TYPE_GROUND && AI_DATA->switchinCandidate.battleMon.types[1] != TYPE_GROUND
|
||||
&& AI_DATA->switchinCandidate.battleMon.types[0] != TYPE_ROCK && AI_DATA->switchinCandidate.battleMon.types[1] != TYPE_ROCK
|
||||
&& AI_DATA->switchinCandidate.battleMon.types[0] != TYPE_STEEL && AI_DATA->switchinCandidate.battleMon.types[1] != TYPE_STEEL
|
||||
&& ability != ABILITY_SAND_VEIL && ability != ABILITY_SAND_RUSH && ability != ABILITY_SAND_FORCE))
|
||||
{
|
||||
weatherImpact = maxHP / 16;
|
||||
|
@ -1473,7 +1465,7 @@ static u32 GetSwitchinRecurringHealing(void)
|
|||
// Items
|
||||
if (ability != ABILITY_KLUTZ)
|
||||
{
|
||||
if (holdEffect == HOLD_EFFECT_BLACK_SLUDGE && (AI_DATA->switchinCandidate.battleMon.type1 == TYPE_POISON || AI_DATA->switchinCandidate.battleMon.type2 == TYPE_POISON))
|
||||
if (holdEffect == HOLD_EFFECT_BLACK_SLUDGE && (AI_DATA->switchinCandidate.battleMon.types[0] == TYPE_POISON || AI_DATA->switchinCandidate.battleMon.types[1] == TYPE_POISON))
|
||||
{
|
||||
recurringHealing = maxHP / 16;
|
||||
if (recurringHealing == 0)
|
||||
|
@ -1507,7 +1499,7 @@ static u32 GetSwitchinRecurringDamage(void)
|
|||
// Items
|
||||
if (ability != ABILITY_MAGIC_GUARD && ability != ABILITY_KLUTZ)
|
||||
{
|
||||
if (holdEffect == HOLD_EFFECT_BLACK_SLUDGE && AI_DATA->switchinCandidate.battleMon.type1 != TYPE_POISON && AI_DATA->switchinCandidate.battleMon.type2 != TYPE_POISON)
|
||||
if (holdEffect == HOLD_EFFECT_BLACK_SLUDGE && AI_DATA->switchinCandidate.battleMon.types[0] != TYPE_POISON && AI_DATA->switchinCandidate.battleMon.types[1] != TYPE_POISON)
|
||||
{
|
||||
passiveDamage = maxHP / 8;
|
||||
if (passiveDamage == 0)
|
||||
|
@ -1532,7 +1524,7 @@ static u32 GetSwitchinRecurringDamage(void)
|
|||
// Gets one turn of status damage
|
||||
static u32 GetSwitchinStatusDamage(u32 battler)
|
||||
{
|
||||
u8 defType1 = AI_DATA->switchinCandidate.battleMon.type1, defType2 = AI_DATA->switchinCandidate.battleMon.type2;
|
||||
u8 defType1 = AI_DATA->switchinCandidate.battleMon.types[0], defType2 = AI_DATA->switchinCandidate.battleMon.types[1];
|
||||
u8 tSpikesLayers = gSideTimers[GetBattlerSide(battler)].toxicSpikesAmount;
|
||||
u16 heldItemEffect = ItemId_GetHoldEffect(AI_DATA->switchinCandidate.battleMon.item);
|
||||
u32 status = AI_DATA->switchinCandidate.battleMon.status1, ability = AI_DATA->switchinCandidate.battleMon.ability, maxHP = AI_DATA->switchinCandidate.battleMon.maxHP;
|
||||
|
@ -1714,7 +1706,7 @@ static u16 GetSwitchinTypeMatchup(u32 opposingBattler, struct BattlePokemon batt
|
|||
// Check type matchup
|
||||
u16 typeEffectiveness = UQ_4_12(1.0);
|
||||
u8 atkType1 = gSpeciesInfo[gBattleMons[opposingBattler].species].types[0], atkType2 = gSpeciesInfo[gBattleMons[opposingBattler].species].types[1],
|
||||
defType1 = battleMon.type1, defType2 = battleMon.type2;
|
||||
defType1 = battleMon.types[0], defType2 = battleMon.types[1];
|
||||
|
||||
// Multiply type effectiveness by a factor depending on type matchup
|
||||
typeEffectiveness = uq4_12_multiply(typeEffectiveness, (GetTypeModifier(atkType1, defType1)));
|
||||
|
@ -2010,7 +2002,7 @@ static u32 GetBestMonIntegrated(struct Pokemon *party, int firstId, int lastId,
|
|||
if (aceMonId != PARTY_SIZE
|
||||
&& (gMovesInfo[gLastUsedMove].effect == EFFECT_HIT_ESCAPE || gMovesInfo[gLastUsedMove].effect == EFFECT_PARTING_SHOT || gMovesInfo[gLastUsedMove].effect == EFFECT_BATON_PASS))
|
||||
return aceMonId;
|
||||
|
||||
|
||||
return PARTY_SIZE;
|
||||
}
|
||||
|
||||
|
|
|
@ -165,8 +165,8 @@ void SaveBattlerData(u32 battlerId)
|
|||
AI_THINKING_STRUCT->saved[battlerId].moves[i] = gBattleMons[battlerId].moves[i];
|
||||
}
|
||||
// Save and restore types even for AI controlled battlers in case it gets changed during move evaluation process.
|
||||
AI_THINKING_STRUCT->saved[battlerId].types[0] = gBattleMons[battlerId].type1;
|
||||
AI_THINKING_STRUCT->saved[battlerId].types[1] = gBattleMons[battlerId].type2;
|
||||
AI_THINKING_STRUCT->saved[battlerId].types[0] = gBattleMons[battlerId].types[0];
|
||||
AI_THINKING_STRUCT->saved[battlerId].types[1] = gBattleMons[battlerId].types[1];
|
||||
}
|
||||
|
||||
static bool32 ShouldFailForIllusion(u32 illusionSpecies, u32 battlerId)
|
||||
|
@ -218,11 +218,11 @@ void SetBattlerData(u32 battlerId)
|
|||
if (illusionSpecies != SPECIES_NONE && ShouldFailForIllusion(illusionSpecies, battlerId))
|
||||
{
|
||||
// If the battler's type has not been changed, AI assumes the types of the illusion mon.
|
||||
if (gBattleMons[battlerId].type1 == gSpeciesInfo[species].types[0]
|
||||
&& gBattleMons[battlerId].type2 == gSpeciesInfo[species].types[1])
|
||||
if (gBattleMons[battlerId].types[0] == gSpeciesInfo[species].types[0]
|
||||
&& gBattleMons[battlerId].types[1] == gSpeciesInfo[species].types[1])
|
||||
{
|
||||
gBattleMons[battlerId].type1 = gSpeciesInfo[illusionSpecies].types[0];
|
||||
gBattleMons[battlerId].type2 = gSpeciesInfo[illusionSpecies].types[1];
|
||||
gBattleMons[battlerId].types[0] = gSpeciesInfo[illusionSpecies].types[0];
|
||||
gBattleMons[battlerId].types[1] = gSpeciesInfo[illusionSpecies].types[1];
|
||||
}
|
||||
species = illusionSpecies;
|
||||
}
|
||||
|
@ -262,8 +262,8 @@ void RestoreBattlerData(u32 battlerId)
|
|||
for (i = 0; i < 4; i++)
|
||||
gBattleMons[battlerId].moves[i] = AI_THINKING_STRUCT->saved[battlerId].moves[i];
|
||||
}
|
||||
gBattleMons[battlerId].type1 = AI_THINKING_STRUCT->saved[battlerId].types[0];
|
||||
gBattleMons[battlerId].type2 = AI_THINKING_STRUCT->saved[battlerId].types[1];
|
||||
gBattleMons[battlerId].types[0] = AI_THINKING_STRUCT->saved[battlerId].types[0];
|
||||
gBattleMons[battlerId].types[1] = AI_THINKING_STRUCT->saved[battlerId].types[1];
|
||||
}
|
||||
|
||||
u32 GetHealthPercentage(u32 battlerId)
|
||||
|
|
|
@ -606,19 +606,9 @@ static void HandleInputShowEntireFieldTargets(u32 battler)
|
|||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
<<<<<<< HEAD
|
||||
HideAllTargets();
|
||||
if (gBattleStruct->gimmick.playerSelect)
|
||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | RET_GIMMICK | (gMultiUsePlayerCursor << 8));
|
||||
=======
|
||||
if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE)
|
||||
{
|
||||
if (moveInfo->monTypes[0] != TYPE_GHOST && moveInfo->monTypes[1] != TYPE_GHOST)
|
||||
moveTarget = MOVE_TARGET_USER;
|
||||
else
|
||||
moveTarget = MOVE_TARGET_SELECTED;
|
||||
}
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, gMoveSelectionCursor[battler] | (gMultiUsePlayerCursor << 8));
|
||||
HideGimmickTriggerSprite();
|
||||
|
@ -1743,7 +1733,7 @@ static void MoveSelectionDisplayMoveType(u32 battler)
|
|||
if (speciesId == SPECIES_OGERPON_WELLSPRING_MASK || speciesId == SPECIES_OGERPON_WELLSPRING_MASK_TERA
|
||||
|| speciesId == SPECIES_OGERPON_HEARTHFLAME_MASK || speciesId == SPECIES_OGERPON_HEARTHFLAME_MASK_TERA
|
||||
|| speciesId == SPECIES_OGERPON_CORNERSTONE_MASK || speciesId == SPECIES_OGERPON_CORNERSTONE_MASK_TERA)
|
||||
type = gBattleMons[battler].type2;
|
||||
type = gBattleMons[battler].types[1];
|
||||
}
|
||||
// Max Guard is a Normal-type move
|
||||
else if (gMovesInfo[moveInfo->moves[gMoveSelectionCursor[battler]]].category == DAMAGE_CATEGORY_STATUS
|
||||
|
|
|
@ -1670,7 +1670,7 @@ static void PrintSecondaryEntries(struct BattleDebugMenu *data)
|
|||
case LIST_ITEM_TYPES:
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
u8 *types = &gBattleMons[data->battlerId].type1;
|
||||
u8 *types = &gBattleMons[data->battlerId].types[0];
|
||||
|
||||
PadString(gTypesInfo[types[i]].name, text);
|
||||
printer.currentY = printer.y = (i * yMultiplier) + sSecondaryListTemplate.upText_Y;
|
||||
|
@ -2070,9 +2070,9 @@ static void SetUpModifyArrows(struct BattleDebugMenu *data)
|
|||
data->modifyArrows.minValue = 0;
|
||||
data->modifyArrows.maxValue = NUMBER_OF_MON_TYPES - 1;
|
||||
data->modifyArrows.maxDigits = 2;
|
||||
data->modifyArrows.modifiedValPtr = (u8 *)((&gBattleMons[data->battlerId].type1) + data->currentSecondaryListItemId);
|
||||
data->modifyArrows.modifiedValPtr = (u8 *)((&gBattleMons[data->battlerId].types[0]) + data->currentSecondaryListItemId);
|
||||
data->modifyArrows.typeOfVal = VAL_U8;
|
||||
data->modifyArrows.currValue = *(u8 *)((&gBattleMons[data->battlerId].type1) + data->currentSecondaryListItemId);
|
||||
data->modifyArrows.currValue = *(u8 *)((&gBattleMons[data->battlerId].types[0]) + data->currentSecondaryListItemId);
|
||||
break;
|
||||
case LIST_ITEM_STATS:
|
||||
data->modifyArrows.minValue = 0;
|
||||
|
|
|
@ -262,21 +262,7 @@ u16 ChooseMoveAndTargetInBattlePalace(u32 battler)
|
|||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
moveTarget = GetBattlerMoveTargetType(battler, moveInfo->moves[chosenMoveId]);
|
||||
=======
|
||||
if (moveInfo->moves[chosenMoveId] == MOVE_CURSE)
|
||||
{
|
||||
if (moveInfo->monTypes[0] != TYPE_GHOST && moveInfo->monTypes[1] != TYPE_GHOST)
|
||||
moveTarget = MOVE_TARGET_USER;
|
||||
else
|
||||
moveTarget = MOVE_TARGET_SELECTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
moveTarget = gBattleMoves[moveInfo->moves[chosenMoveId]].target;
|
||||
}
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
|
||||
if (moveTarget & MOVE_TARGET_USER)
|
||||
chosenMoveId |= (battler << 8);
|
||||
|
@ -1128,7 +1114,7 @@ void LoadAndCreateEnemyShadowSprites(void)
|
|||
u32 i;
|
||||
|
||||
LoadCompressedSpriteSheet(&gSpriteSheet_EnemyShadow);
|
||||
|
||||
|
||||
// initialize shadow sprite ids
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
|
@ -1137,7 +1123,7 @@ void LoadAndCreateEnemyShadowSprites(void)
|
|||
|
||||
battler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||
CreateEnemyShadowSprite(battler);
|
||||
|
||||
|
||||
if (IsDoubleBattle())
|
||||
{
|
||||
battler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
|
|
|
@ -3368,14 +3368,9 @@ const u8* FaintClearSetData(u32 battler)
|
|||
|
||||
gBattleResources->flags->flags[battler] = 0;
|
||||
|
||||
<<<<<<< HEAD
|
||||
gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0];
|
||||
gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1];
|
||||
gBattleMons[battler].type3 = TYPE_MYSTERY;
|
||||
=======
|
||||
gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0];
|
||||
gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1];
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
gBattleMons[battler].types[0] = gSpeciesInfo[gBattleMons[battler].species].types[0];
|
||||
gBattleMons[battler].types[1] = gSpeciesInfo[gBattleMons[battler].species].types[1];
|
||||
gBattleMons[battler].types[2] = TYPE_MYSTERY;
|
||||
|
||||
Ai_UpdateFaintData(battler);
|
||||
TryBattleFormChange(battler, FORM_CHANGE_FAINT);
|
||||
|
@ -3453,29 +3448,12 @@ static void DoBattleIntro(void)
|
|||
case 2: // Start graphical intro slide.
|
||||
if (!gBattleControllerExecFlags)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
battler = GetBattlerAtPosition(0);
|
||||
BtlController_EmitIntroSlide(battler, BUFFER_A, gBattleTerrain);
|
||||
MarkBattlerForControllerExec(battler);
|
||||
gBattleCommunication[0] = 0;
|
||||
gBattleCommunication[1] = 0;
|
||||
(*state)++;
|
||||
=======
|
||||
u16 *hpOnSwitchout;
|
||||
|
||||
ptr = (u8 *)&gBattleMons[gActiveBattler];
|
||||
for (i = 0; i < sizeof(struct BattlePokemon); i++)
|
||||
ptr[i] = gBattleBufferB[gActiveBattler][4 + i];
|
||||
|
||||
gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0];
|
||||
gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1];
|
||||
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum);
|
||||
hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)];
|
||||
*hpOnSwitchout = gBattleMons[gActiveBattler].hp;
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
gBattleMons[gActiveBattler].status2 = 0;
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
}
|
||||
break;
|
||||
case 3: // Wait for intro slide.
|
||||
|
@ -3492,9 +3470,9 @@ static void DoBattleIntro(void)
|
|||
else
|
||||
{
|
||||
memcpy(&gBattleMons[battler], &gBattleResources->bufferB[battler][4], sizeof(struct BattlePokemon));
|
||||
gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0];
|
||||
gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1];
|
||||
gBattleMons[battler].type3 = TYPE_MYSTERY;
|
||||
gBattleMons[battler].types[0] = gSpeciesInfo[gBattleMons[battler].species].types[0];
|
||||
gBattleMons[battler].types[1] = gSpeciesInfo[gBattleMons[battler].species].types[1];
|
||||
gBattleMons[battler].types[2] = TYPE_MYSTERY;
|
||||
gBattleMons[battler].ability = GetAbilityBySpecies(gBattleMons[battler].species, gBattleMons[battler].abilityNum);
|
||||
gBattleStruct->hpOnSwitchout[GetBattlerSide(battler)] = gBattleMons[battler].hp;
|
||||
gBattleMons[battler].status2 = 0;
|
||||
|
@ -4283,17 +4261,11 @@ static void HandleTurnActionSelectionState(void)
|
|||
{
|
||||
struct ChooseMoveStruct moveInfo;
|
||||
|
||||
<<<<<<< HEAD
|
||||
moveInfo.zmove = gBattleStruct->zmove;
|
||||
moveInfo.species = gBattleMons[battler].species;
|
||||
moveInfo.monType1 = gBattleMons[battler].type1;
|
||||
moveInfo.monType2 = gBattleMons[battler].type2;
|
||||
moveInfo.monType3 = gBattleMons[battler].type3;
|
||||
=======
|
||||
moveInfo.species = gBattleMons[gActiveBattler].species;
|
||||
moveInfo.monTypes[0] = gBattleMons[gActiveBattler].types[0];
|
||||
moveInfo.monTypes[1] = gBattleMons[gActiveBattler].types[1];
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
moveInfo.monTypes[0] = gBattleMons[battler].types[0];
|
||||
moveInfo.monTypes[1] = gBattleMons[battler].types[1];
|
||||
moveInfo.monTypes[2] = gBattleMons[battler].types[2];
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
|
@ -5856,26 +5828,26 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk)
|
|||
{
|
||||
if (GetActiveGimmick(battlerAtk) == GIMMICK_TERA && GetBattlerTeraType(battlerAtk) != TYPE_STELLAR)
|
||||
gBattleStruct->dynamicMoveType = GetBattlerTeraType(battlerAtk);
|
||||
else if (gBattleMons[battlerAtk].type1 != TYPE_MYSTERY)
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type1 | F_DYNAMIC_TYPE_SET;
|
||||
else if (gBattleMons[battlerAtk].type2 != TYPE_MYSTERY)
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | F_DYNAMIC_TYPE_SET;
|
||||
else if (gBattleMons[battlerAtk].type3 != TYPE_MYSTERY)
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type3 | F_DYNAMIC_TYPE_SET;
|
||||
else if (gBattleMons[battlerAtk].types[0] != TYPE_MYSTERY)
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].types[0] | F_DYNAMIC_TYPE_SET;
|
||||
else if (gBattleMons[battlerAtk].types[1] != TYPE_MYSTERY)
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].types[1] | F_DYNAMIC_TYPE_SET;
|
||||
else if (gBattleMons[battlerAtk].types[2] != TYPE_MYSTERY)
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].types[2] | F_DYNAMIC_TYPE_SET;
|
||||
}
|
||||
else if (gMovesInfo[move].effect == EFFECT_RAGING_BULL
|
||||
&& (gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_COMBAT_BREED
|
||||
|| gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_BLAZE_BREED
|
||||
|| gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_AQUA_BREED))
|
||||
{
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | F_DYNAMIC_TYPE_SET;
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].types[1] | F_DYNAMIC_TYPE_SET;
|
||||
}
|
||||
else if (gMovesInfo[move].effect == EFFECT_IVY_CUDGEL
|
||||
&& (gBattleMons[battlerAtk].species == SPECIES_OGERPON_WELLSPRING_MASK || gBattleMons[battlerAtk].species == SPECIES_OGERPON_WELLSPRING_MASK_TERA
|
||||
|| gBattleMons[battlerAtk].species == SPECIES_OGERPON_HEARTHFLAME_MASK || gBattleMons[battlerAtk].species == SPECIES_OGERPON_HEARTHFLAME_MASK_TERA
|
||||
|| gBattleMons[battlerAtk].species == SPECIES_OGERPON_CORNERSTONE_MASK || gBattleMons[battlerAtk].species == SPECIES_OGERPON_CORNERSTONE_MASK_TERA ))
|
||||
{
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | F_DYNAMIC_TYPE_SET;
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].types[1] | F_DYNAMIC_TYPE_SET;
|
||||
}
|
||||
else if (gMovesInfo[move].effect == EFFECT_NATURAL_GIFT)
|
||||
{
|
||||
|
|
|
@ -1160,8 +1160,8 @@ bool32 ProteanTryChangeType(u32 battler, u32 ability, u32 move, u32 moveType)
|
|||
{
|
||||
if ((ability == ABILITY_PROTEAN || ability == ABILITY_LIBERO)
|
||||
&& !gDisableStructs[gBattlerAttacker].usedProteanLibero
|
||||
&& (gBattleMons[battler].type1 != moveType || gBattleMons[battler].type2 != moveType
|
||||
|| (gBattleMons[battler].type3 != moveType && gBattleMons[battler].type3 != TYPE_MYSTERY))
|
||||
&& (gBattleMons[battler].types[0] != moveType || gBattleMons[battler].types[1] != moveType
|
||||
|| (gBattleMons[battler].types[2] != moveType && gBattleMons[battler].types[2] != TYPE_MYSTERY))
|
||||
&& move != MOVE_STRUGGLE
|
||||
&& GetActiveGimmick(battler) != GIMMICK_TERA)
|
||||
{
|
||||
|
@ -2000,7 +2000,6 @@ static void Cmd_adjustdamage(void)
|
|||
}
|
||||
if (GetBattlerAbility(gBattlerTarget) == ABILITY_ICE_FACE && IS_MOVE_PHYSICAL(gCurrentMove) && gBattleMons[gBattlerTarget].species == SPECIES_EISCUE)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
// Damage deals typeless 0 HP.
|
||||
gMoveResultFlags &= ~(MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE);
|
||||
gBattleMoveDamage = 0;
|
||||
|
@ -2008,312 +2007,12 @@ static void Cmd_adjustdamage(void)
|
|||
gBattleResources->flags->flags[gBattlerTarget] |= RESOURCE_FLAG_ICE_FACE;
|
||||
// Form change will be done after attack animation in Cmd_resultmessage.
|
||||
goto END;
|
||||
=======
|
||||
gLastUsedAbility = gBattleMons[gBattlerTarget].ability;
|
||||
gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE);
|
||||
gLastLandedMoves[gBattlerTarget] = 0;
|
||||
gLastHitByType[gBattlerTarget] = 0;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_GROUND_MISS;
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE)
|
||||
{
|
||||
if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT)
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].status2 & STATUS2_FORESIGHT)
|
||||
break;
|
||||
i += 3;
|
||||
continue;
|
||||
}
|
||||
else if (TYPE_EFFECT_ATK_TYPE(i) == moveType)
|
||||
{
|
||||
// check type1
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0])
|
||||
ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i));
|
||||
// check type2
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] &&
|
||||
gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1])
|
||||
ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i));
|
||||
}
|
||||
i += 3;
|
||||
}
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
}
|
||||
if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage)
|
||||
goto END;
|
||||
|
||||
<<<<<<< HEAD
|
||||
holdEffect = GetBattlerHoldEffect(gBattlerTarget, TRUE);
|
||||
param = GetBattlerHoldEffectParam(gBattlerTarget);
|
||||
=======
|
||||
if (gBattleMons[gBattlerTarget].ability == ABILITY_WONDER_GUARD && AttacksThisTurn(gBattlerAttacker, gCurrentMove) == 2
|
||||
&& (!(gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) || ((gMoveResultFlags & (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)) == (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)))
|
||||
&& gBattleMoves[gCurrentMove].power)
|
||||
{
|
||||
gLastUsedAbility = ABILITY_WONDER_GUARD;
|
||||
gMoveResultFlags |= MOVE_RESULT_MISSED;
|
||||
gLastLandedMoves[gBattlerTarget] = 0;
|
||||
gLastHitByType[gBattlerTarget] = 0;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_DMG;
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE)
|
||||
gProtectStructs[gBattlerAttacker].targetNotAffected = 1;
|
||||
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static void CheckWonderGuardAndLevitate(void)
|
||||
{
|
||||
u8 flags = 0;
|
||||
s32 i = 0;
|
||||
u8 moveType;
|
||||
|
||||
if (gCurrentMove == MOVE_STRUGGLE || !gBattleMoves[gCurrentMove].power)
|
||||
return;
|
||||
|
||||
GET_MOVE_TYPE(gCurrentMove, moveType);
|
||||
|
||||
if (gBattleMons[gBattlerTarget].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND)
|
||||
{
|
||||
gLastUsedAbility = ABILITY_LEVITATE;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_GROUND_MISS;
|
||||
RecordAbilityBattle(gBattlerTarget, ABILITY_LEVITATE);
|
||||
return;
|
||||
}
|
||||
|
||||
while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE)
|
||||
{
|
||||
if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT)
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].status2 & STATUS2_FORESIGHT)
|
||||
break;
|
||||
i += 3;
|
||||
continue;
|
||||
}
|
||||
if (TYPE_EFFECT_ATK_TYPE(i) == moveType)
|
||||
{
|
||||
// check no effect
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0]
|
||||
&& TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE;
|
||||
gProtectStructs[gBattlerAttacker].targetNotAffected = 1;
|
||||
}
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] &&
|
||||
gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1] &&
|
||||
TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE;
|
||||
gProtectStructs[gBattlerAttacker].targetNotAffected = 1;
|
||||
}
|
||||
|
||||
// check super effective
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] && TYPE_EFFECT_MULTIPLIER(i) == 20)
|
||||
flags |= 1;
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1]
|
||||
&& gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1]
|
||||
&& TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE)
|
||||
flags |= 1;
|
||||
|
||||
// check not very effective
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0] && TYPE_EFFECT_MULTIPLIER(i) == 5)
|
||||
flags |= 2;
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1]
|
||||
&& gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1]
|
||||
&& TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE)
|
||||
flags |= 2;
|
||||
}
|
||||
i += 3;
|
||||
}
|
||||
|
||||
if (gBattleMons[gBattlerTarget].ability == ABILITY_WONDER_GUARD && AttacksThisTurn(gBattlerAttacker, gCurrentMove) == 2)
|
||||
{
|
||||
if (((flags & 2) || !(flags & 1)) && gBattleMoves[gCurrentMove].power)
|
||||
{
|
||||
gLastUsedAbility = ABILITY_WONDER_GUARD;
|
||||
gBattleCommunication[MISS_TYPE] = B_MSG_AVOIDED_DMG;
|
||||
RecordAbilityBattle(gBattlerTarget, ABILITY_WONDER_GUARD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Same as ModulateDmgByType except different arguments
|
||||
static void ModulateDmgByType2(u8 multiplier, u16 move, u8 *flags)
|
||||
{
|
||||
gBattleMoveDamage = gBattleMoveDamage * multiplier / 10;
|
||||
if (gBattleMoveDamage == 0 && multiplier != 0)
|
||||
gBattleMoveDamage = 1;
|
||||
|
||||
switch (multiplier)
|
||||
{
|
||||
case TYPE_MUL_NO_EFFECT:
|
||||
*flags |= MOVE_RESULT_DOESNT_AFFECT_FOE;
|
||||
*flags &= ~MOVE_RESULT_NOT_VERY_EFFECTIVE;
|
||||
*flags &= ~MOVE_RESULT_SUPER_EFFECTIVE;
|
||||
break;
|
||||
case TYPE_MUL_NOT_EFFECTIVE:
|
||||
if (gBattleMoves[move].power && !(*flags & MOVE_RESULT_NO_EFFECT))
|
||||
{
|
||||
if (*flags & MOVE_RESULT_SUPER_EFFECTIVE)
|
||||
*flags &= ~MOVE_RESULT_SUPER_EFFECTIVE;
|
||||
else
|
||||
*flags |= MOVE_RESULT_NOT_VERY_EFFECTIVE;
|
||||
}
|
||||
break;
|
||||
case TYPE_MUL_SUPER_EFFECTIVE:
|
||||
if (gBattleMoves[move].power && !(*flags & MOVE_RESULT_NO_EFFECT))
|
||||
{
|
||||
if (*flags & MOVE_RESULT_NOT_VERY_EFFECTIVE)
|
||||
*flags &= ~MOVE_RESULT_NOT_VERY_EFFECTIVE;
|
||||
else
|
||||
*flags |= MOVE_RESULT_SUPER_EFFECTIVE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
u8 TypeCalc(u16 move, u8 attacker, u8 defender)
|
||||
{
|
||||
s32 i = 0;
|
||||
u8 flags = 0;
|
||||
u8 moveType;
|
||||
|
||||
if (move == MOVE_STRUGGLE)
|
||||
return 0;
|
||||
|
||||
moveType = gBattleMoves[move].type;
|
||||
|
||||
// check stab
|
||||
if (IS_BATTLER_OF_TYPE(attacker, moveType))
|
||||
{
|
||||
gBattleMoveDamage = gBattleMoveDamage * 15;
|
||||
gBattleMoveDamage = gBattleMoveDamage / 10;
|
||||
}
|
||||
|
||||
if (gBattleMons[defender].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND)
|
||||
{
|
||||
flags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE)
|
||||
{
|
||||
if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT)
|
||||
{
|
||||
if (gBattleMons[defender].status2 & STATUS2_FORESIGHT)
|
||||
break;
|
||||
i += 3;
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (TYPE_EFFECT_ATK_TYPE(i) == moveType)
|
||||
{
|
||||
// check type1
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].types[0])
|
||||
ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags);
|
||||
// check type2
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[defender].types[1] &&
|
||||
gBattleMons[defender].types[0] != gBattleMons[defender].types[1])
|
||||
ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags);
|
||||
}
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (gBattleMons[defender].ability == ABILITY_WONDER_GUARD && !(flags & MOVE_RESULT_MISSED)
|
||||
&& AttacksThisTurn(attacker, move) == 2
|
||||
&& (!(flags & MOVE_RESULT_SUPER_EFFECTIVE) || ((flags & (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)) == (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)))
|
||||
&& gBattleMoves[move].power)
|
||||
{
|
||||
flags |= MOVE_RESULT_MISSED;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility)
|
||||
{
|
||||
s32 i = 0;
|
||||
u8 flags = 0;
|
||||
u8 type1 = gSpeciesInfo[targetSpecies].types[0], type2 = gSpeciesInfo[targetSpecies].types[1];
|
||||
u8 moveType;
|
||||
|
||||
if (move == MOVE_STRUGGLE)
|
||||
return 0;
|
||||
|
||||
moveType = gBattleMoves[move].type;
|
||||
|
||||
if (targetAbility == ABILITY_LEVITATE && moveType == TYPE_GROUND)
|
||||
{
|
||||
flags = MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE)
|
||||
{
|
||||
if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT)
|
||||
{
|
||||
i += 3;
|
||||
continue;
|
||||
}
|
||||
if (TYPE_EFFECT_ATK_TYPE(i) == moveType)
|
||||
{
|
||||
// check type1
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == type1)
|
||||
ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags);
|
||||
// check type2
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == type2 && type1 != type2)
|
||||
ModulateDmgByType2(TYPE_EFFECT_MULTIPLIER(i), move, &flags);
|
||||
}
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
if (targetAbility == ABILITY_WONDER_GUARD
|
||||
&& (!(flags & MOVE_RESULT_SUPER_EFFECTIVE) || ((flags & (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)) == (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)))
|
||||
&& gBattleMoves[move].power)
|
||||
flags |= MOVE_RESULT_DOESNT_AFFECT_FOE;
|
||||
return flags;
|
||||
}
|
||||
|
||||
// Multiplies the damage by a random factor between 85% to 100% inclusive
|
||||
static inline void ApplyRandomDmgMultiplier(void)
|
||||
{
|
||||
u16 rand = Random();
|
||||
u16 randPercent = 100 - (rand % 16);
|
||||
|
||||
if (gBattleMoveDamage != 0)
|
||||
{
|
||||
gBattleMoveDamage *= randPercent;
|
||||
gBattleMoveDamage /= 100;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNUSED Unused_ApplyRandomDmgMultiplier(void)
|
||||
{
|
||||
ApplyRandomDmgMultiplier();
|
||||
}
|
||||
|
||||
static void Cmd_adjustnormaldamage(void)
|
||||
{
|
||||
u8 holdEffect, param;
|
||||
|
||||
ApplyRandomDmgMultiplier();
|
||||
|
||||
if (gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
holdEffect = gEnigmaBerries[gBattlerTarget].holdEffect;
|
||||
param = gEnigmaBerries[gBattlerTarget].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattlerTarget].item);
|
||||
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
||||
}
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
|
||||
gPotentialItemEffectBattler = gBattlerTarget;
|
||||
|
||||
|
@ -5367,18 +5066,11 @@ static void Cmd_setroost(void)
|
|||
{
|
||||
CMD_ARGS();
|
||||
|
||||
<<<<<<< HEAD
|
||||
gBattleResources->flags->flags[gBattlerAttacker] |= RESOURCE_FLAG_ROOST;
|
||||
gBattleStruct->roostTypes[gBattlerAttacker][0] = gBattleMons[gBattlerAttacker].type1;
|
||||
gBattleStruct->roostTypes[gBattlerAttacker][1] = gBattleMons[gBattlerAttacker].type2;
|
||||
gBattleStruct->roostTypes[gBattlerAttacker][0] = gBattleMons[gBattlerAttacker].types[0];
|
||||
gBattleStruct->roostTypes[gBattlerAttacker][1] = gBattleMons[gBattlerAttacker].types[1];
|
||||
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
=======
|
||||
if (gBattlescriptCurrInstr[2] == gBattleMons[battlerId].types[0] || gBattlescriptCurrInstr[2] == gBattleMons[battlerId].types[1])
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
}
|
||||
|
||||
static void Cmd_jumpifabilitypresent(void)
|
||||
|
@ -6741,71 +6433,9 @@ static void Cmd_sethealblock(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
gStatuses3[gBattlerTarget] |= STATUS3_HEAL_BLOCK;
|
||||
gDisableStructs[gBattlerTarget].healBlockTimer = 5;
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
=======
|
||||
while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE)
|
||||
{
|
||||
if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT)
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].status2 & STATUS2_FORESIGHT)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
i += 3;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (TYPE_EFFECT_ATK_TYPE(i) == moveType)
|
||||
{
|
||||
// check type1
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0])
|
||||
{
|
||||
if (TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE;
|
||||
break;
|
||||
}
|
||||
if (TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE)
|
||||
{
|
||||
flags |= MOVE_RESULT_NOT_VERY_EFFECTIVE;
|
||||
}
|
||||
if (TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE)
|
||||
{
|
||||
flags |= MOVE_RESULT_SUPER_EFFECTIVE;
|
||||
}
|
||||
}
|
||||
// check type2
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1])
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1]
|
||||
&& TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NO_EFFECT)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_DOESNT_AFFECT_FOE;
|
||||
break;
|
||||
}
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1]
|
||||
&& gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1]
|
||||
&& TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_NOT_EFFECTIVE)
|
||||
{
|
||||
flags |= MOVE_RESULT_NOT_VERY_EFFECTIVE;
|
||||
}
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1]
|
||||
&& gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1]
|
||||
&& TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE)
|
||||
{
|
||||
flags |= MOVE_RESULT_SUPER_EFFECTIVE;
|
||||
}
|
||||
}
|
||||
}
|
||||
i += 3;
|
||||
}
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6855,18 +6485,8 @@ static void Cmd_switchindataupdate(void)
|
|||
for (i = 0; i < sizeof(struct BattlePokemon); i++)
|
||||
monData[i] = gBattleResources->bufferB[battler][4 + i];
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Edge case: the sent out pokemon has 0 HP. This should never happen.
|
||||
if (!IsBattlerAlive(battler))
|
||||
=======
|
||||
gBattleMons[gActiveBattler].types[0] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[0];
|
||||
gBattleMons[gActiveBattler].types[1] = gSpeciesInfo[gBattleMons[gActiveBattler].species].types[1];
|
||||
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum);
|
||||
|
||||
// check knocked off item
|
||||
i = GetBattlerSide(gActiveBattler);
|
||||
if (gWishFutureKnock.knockedOffMons[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]])
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
{
|
||||
// If it's a test, mark it as invalid.
|
||||
if (gTestRunnerEnabled)
|
||||
|
@ -6894,9 +6514,9 @@ static void Cmd_switchindataupdate(void)
|
|||
}
|
||||
}
|
||||
|
||||
gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0];
|
||||
gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1];
|
||||
gBattleMons[battler].type3 = TYPE_MYSTERY;
|
||||
gBattleMons[battler].types[0] = gSpeciesInfo[gBattleMons[battler].species].types[0];
|
||||
gBattleMons[battler].types[1] = gSpeciesInfo[gBattleMons[battler].species].types[1];
|
||||
gBattleMons[battler].types[2] = TYPE_MYSTERY;
|
||||
gBattleMons[battler].ability = GetAbilityBySpecies(gBattleMons[battler].species, gBattleMons[battler].abilityNum);
|
||||
#if TESTING
|
||||
if (gTestRunnerEnabled)
|
||||
|
@ -10532,7 +10152,7 @@ static void Cmd_various(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
gBattleMons[battler].type3 = gMovesInfo[gCurrentMove].argument;
|
||||
gBattleMons[battler].types[2] = gMovesInfo[gCurrentMove].argument;
|
||||
PREPARE_TYPE_BUFFER(gBattleTextBuff1, gMovesInfo[gCurrentMove].argument);
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
|
@ -12577,12 +12197,7 @@ static void Cmd_tryconversiontypechange(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
if (IS_BATTLER_OF_TYPE(gBattlerAttacker, moveType))
|
||||
=======
|
||||
if (moveType != gBattleMons[gBattlerAttacker].types[0]
|
||||
&& moveType != gBattleMons[gBattlerAttacker].types[1])
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
{
|
||||
gBattlescriptCurrInstr = cmd->failInstr;
|
||||
}
|
||||
|
@ -12615,17 +12230,13 @@ static void Cmd_tryconversiontypechange(void)
|
|||
else
|
||||
moveType = TYPE_NORMAL;
|
||||
}
|
||||
if (moveType != gBattleMons[gBattlerAttacker].type1
|
||||
&& moveType != gBattleMons[gBattlerAttacker].type2
|
||||
&& moveType != gBattleMons[gBattlerAttacker].type3)
|
||||
if (moveType != gBattleMons[gBattlerAttacker].types[0]
|
||||
&& moveType != gBattleMons[gBattlerAttacker].types[1]
|
||||
&& moveType != gBattleMons[gBattlerAttacker].types[2])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
while (moveType == gBattleMons[gBattlerAttacker].types[0] || moveType == gBattleMons[gBattlerAttacker].types[1]);
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
|
||||
if (moveChecked == validMoves)
|
||||
{
|
||||
|
@ -12647,7 +12258,7 @@ static void Cmd_tryconversiontypechange(void)
|
|||
moveType = TYPE_NORMAL;
|
||||
}
|
||||
}
|
||||
while (moveType == gBattleMons[gBattlerAttacker].type1 || moveType == gBattleMons[gBattlerAttacker].type2 || moveType == gBattleMons[gBattlerAttacker].type3);
|
||||
while (moveType == gBattleMons[gBattlerAttacker].types[0] || moveType == gBattleMons[gBattlerAttacker].types[1] || moveType == gBattleMons[gBattlerAttacker].types[2]);
|
||||
|
||||
SET_BATTLER_TYPE(gBattlerAttacker, moveType);
|
||||
PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType);
|
||||
|
@ -12815,57 +12426,6 @@ static void Cmd_unused_95(void)
|
|||
|
||||
static void Cmd_unused_96(void)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
if (WEATHER_HAS_EFFECT)
|
||||
{
|
||||
if (gBattleWeather & B_WEATHER_SANDSTORM)
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].types[0] != TYPE_ROCK
|
||||
&& gBattleMons[gBattlerAttacker].types[0] != TYPE_STEEL
|
||||
&& gBattleMons[gBattlerAttacker].types[0] != TYPE_GROUND
|
||||
&& gBattleMons[gBattlerAttacker].types[1] != TYPE_ROCK
|
||||
&& gBattleMons[gBattlerAttacker].types[1] != TYPE_STEEL
|
||||
&& gBattleMons[gBattlerAttacker].types[1] != TYPE_GROUND
|
||||
&& gBattleMons[gBattlerAttacker].ability != ABILITY_SAND_VEIL
|
||||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND)
|
||||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER))
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMoveDamage = 0;
|
||||
}
|
||||
}
|
||||
if (gBattleWeather & B_WEATHER_HAIL)
|
||||
{
|
||||
if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)
|
||||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND)
|
||||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER))
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMoveDamage = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMoveDamage = 0;
|
||||
}
|
||||
|
||||
if (gAbsentBattlerFlags & gBitTable[gBattlerAttacker])
|
||||
gBattleMoveDamage = 0;
|
||||
|
||||
gBattlescriptCurrInstr++;
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
}
|
||||
|
||||
static void Cmd_tryinfatuating(void)
|
||||
|
@ -16963,30 +16523,30 @@ void BS_TryReflectType(void)
|
|||
}
|
||||
else if (targetType1 == TYPE_MYSTERY && targetType2 == TYPE_MYSTERY && targetType3 != TYPE_MYSTERY)
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].type1 = TYPE_NORMAL;
|
||||
gBattleMons[gBattlerAttacker].type2 = TYPE_NORMAL;
|
||||
gBattleMons[gBattlerAttacker].type3 = targetType3;
|
||||
gBattleMons[gBattlerAttacker].types[0] = TYPE_NORMAL;
|
||||
gBattleMons[gBattlerAttacker].types[1] = TYPE_NORMAL;
|
||||
gBattleMons[gBattlerAttacker].types[2] = targetType3;
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
else if (targetType1 == TYPE_MYSTERY && targetType2 != TYPE_MYSTERY)
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].type1 = targetType2;
|
||||
gBattleMons[gBattlerAttacker].type2 = targetType2;
|
||||
gBattleMons[gBattlerAttacker].type3 = targetType3;
|
||||
gBattleMons[gBattlerAttacker].types[0] = targetType2;
|
||||
gBattleMons[gBattlerAttacker].types[1] = targetType2;
|
||||
gBattleMons[gBattlerAttacker].types[2] = targetType3;
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
else if (targetType1 != TYPE_MYSTERY && targetType2 == TYPE_MYSTERY)
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].type1 = targetType1;
|
||||
gBattleMons[gBattlerAttacker].type2 = targetType1;
|
||||
gBattleMons[gBattlerAttacker].type3 = targetType3;
|
||||
gBattleMons[gBattlerAttacker].types[0] = targetType1;
|
||||
gBattleMons[gBattlerAttacker].types[1] = targetType1;
|
||||
gBattleMons[gBattlerAttacker].types[2] = targetType3;
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].type1 = targetType1;
|
||||
gBattleMons[gBattlerAttacker].type2 = targetType2;
|
||||
gBattleMons[gBattlerAttacker].type3 = targetType3;
|
||||
gBattleMons[gBattlerAttacker].types[0] = targetType1;
|
||||
gBattleMons[gBattlerAttacker].types[1] = targetType2;
|
||||
gBattleMons[gBattlerAttacker].types[2] = targetType3;
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10598,8 +10598,8 @@ s32 GetStealthHazardDamageByTypesAndHP(u8 hazardType, u8 type1, u8 type2, u32 ma
|
|||
|
||||
s32 GetStealthHazardDamage(u8 hazardType, u32 battler)
|
||||
{
|
||||
u8 type1 = gBattleMons[battler].type1;
|
||||
u8 type2 = gBattleMons[battler].type2;
|
||||
u8 type1 = gBattleMons[battler].types[0];
|
||||
u8 type2 = gBattleMons[battler].types[1];
|
||||
u32 maxHp = gBattleMons[battler].maxHP;
|
||||
|
||||
return GetStealthHazardDamageByTypesAndHP(hazardType, type1, type2, maxHp);
|
||||
|
@ -11496,9 +11496,9 @@ void CopyMonLevelAndBaseStatsToBattleMon(u32 battler, struct Pokemon *mon)
|
|||
void CopyMonAbilityAndTypesToBattleMon(u32 battler, struct Pokemon *mon)
|
||||
{
|
||||
gBattleMons[battler].ability = GetMonAbility(mon);
|
||||
gBattleMons[battler].type1 = gSpeciesInfo[gBattleMons[battler].species].types[0];
|
||||
gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1];
|
||||
gBattleMons[battler].type3 = TYPE_MYSTERY;
|
||||
gBattleMons[battler].types[0] = gSpeciesInfo[gBattleMons[battler].species].types[0];
|
||||
gBattleMons[battler].types[1] = gSpeciesInfo[gBattleMons[battler].species].types[1];
|
||||
gBattleMons[battler].types[2] = TYPE_MYSTERY;
|
||||
}
|
||||
|
||||
void RecalcBattlerStats(u32 battler, struct Pokemon *mon)
|
||||
|
@ -11703,9 +11703,9 @@ u8 GetBattlerType(u32 battler, u8 typeIndex, bool32 ignoreTera)
|
|||
{
|
||||
u32 teraType = GetBattlerTeraType(battler);
|
||||
u16 types[3] = {0};
|
||||
types[0] = gBattleMons[battler].type1;
|
||||
types[1] = gBattleMons[battler].type2;
|
||||
types[2] = gBattleMons[battler].type3;
|
||||
types[0] = gBattleMons[battler].types[0];
|
||||
types[1] = gBattleMons[battler].types[1];
|
||||
types[2] = gBattleMons[battler].types[2];
|
||||
|
||||
// Handle Terastallization
|
||||
if (GetActiveGimmick(battler) == GIMMICK_TERA && teraType != TYPE_STELLAR && !ignoreTera)
|
||||
|
@ -11734,8 +11734,8 @@ void RemoveBattlerType(u32 battler, u8 type)
|
|||
return;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (*(u8 *)(&gBattleMons[battler].type1 + i) == type)
|
||||
*(u8 *)(&gBattleMons[battler].type1 + i) = TYPE_MYSTERY;
|
||||
if (*(u8 *)(&gBattleMons[battler].types[0] + i) == type)
|
||||
*(u8 *)(&gBattleMons[battler].types[0] + i) = TYPE_MYSTERY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ bool32 MoveSelectionDisplayZMove(u16 zmove, u32 battler)
|
|||
|
||||
if (zEffect == Z_EFFECT_CURSE)
|
||||
{
|
||||
if (moveInfo->monType1 == TYPE_GHOST || moveInfo->monType2 == TYPE_GHOST || moveInfo->monType3 == TYPE_GHOST)
|
||||
if (moveInfo->monTypes[0] == TYPE_GHOST || moveInfo->monTypes[1] == TYPE_GHOST || moveInfo->monTypes[2] == TYPE_GHOST)
|
||||
zEffect = Z_EFFECT_RECOVER_HP;
|
||||
else
|
||||
zEffect = Z_EFFECT_ATK_UP_1;
|
||||
|
|
|
@ -3659,7 +3659,6 @@ void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst)
|
|||
dst->pp[i] = GetMonData(src, MON_DATA_PP1 + i, NULL);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
dst->species = GetMonData(src, MON_DATA_SPECIES, NULL);
|
||||
dst->item = GetMonData(src, MON_DATA_HELD_ITEM, NULL);
|
||||
dst->ppBonuses = GetMonData(src, MON_DATA_PP_BONUSES, NULL);
|
||||
|
@ -3683,47 +3682,14 @@ void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst)
|
|||
dst->spDefense = GetMonData(src, MON_DATA_SPDEF, NULL);
|
||||
dst->abilityNum = GetMonData(src, MON_DATA_ABILITY_NUM, NULL);
|
||||
dst->otId = GetMonData(src, MON_DATA_OT_ID, NULL);
|
||||
dst->type1 = gSpeciesInfo[dst->species].types[0];
|
||||
dst->type2 = gSpeciesInfo[dst->species].types[1];
|
||||
dst->type3 = TYPE_MYSTERY;
|
||||
dst->types[0] = gSpeciesInfo[dst->species].types[0];
|
||||
dst->types[1] = gSpeciesInfo[dst->species].types[1];
|
||||
dst->types[2] = TYPE_MYSTERY;
|
||||
dst->isShiny = IsMonShiny(src);
|
||||
dst->ability = GetAbilityBySpecies(dst->species, dst->abilityNum);
|
||||
GetMonData(src, MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(dst->nickname, nickname);
|
||||
GetMonData(src, MON_DATA_OT_NAME, dst->otName);
|
||||
=======
|
||||
gBattleMons[battlerId].ppBonuses = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PP_BONUSES, NULL);
|
||||
gBattleMons[battlerId].friendship = GetMonData(&gPlayerParty[partyIndex], MON_DATA_FRIENDSHIP, NULL);
|
||||
gBattleMons[battlerId].experience = GetMonData(&gPlayerParty[partyIndex], MON_DATA_EXP, NULL);
|
||||
gBattleMons[battlerId].hpIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HP_IV, NULL);
|
||||
gBattleMons[battlerId].attackIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ATK_IV, NULL);
|
||||
gBattleMons[battlerId].defenseIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_DEF_IV, NULL);
|
||||
gBattleMons[battlerId].speedIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPEED_IV, NULL);
|
||||
gBattleMons[battlerId].spAttackIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPATK_IV, NULL);
|
||||
gBattleMons[battlerId].spDefenseIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPDEF_IV, NULL);
|
||||
gBattleMons[battlerId].personality = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PERSONALITY, NULL);
|
||||
gBattleMons[battlerId].status1 = GetMonData(&gPlayerParty[partyIndex], MON_DATA_STATUS, NULL);
|
||||
gBattleMons[battlerId].level = GetMonData(&gPlayerParty[partyIndex], MON_DATA_LEVEL, NULL);
|
||||
gBattleMons[battlerId].hp = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HP, NULL);
|
||||
gBattleMons[battlerId].maxHP = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MAX_HP, NULL);
|
||||
gBattleMons[battlerId].attack = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ATK, NULL);
|
||||
gBattleMons[battlerId].defense = GetMonData(&gPlayerParty[partyIndex], MON_DATA_DEF, NULL);
|
||||
gBattleMons[battlerId].speed = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPEED, NULL);
|
||||
gBattleMons[battlerId].spAttack = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPATK, NULL);
|
||||
gBattleMons[battlerId].spDefense = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPDEF, NULL);
|
||||
gBattleMons[battlerId].isEgg = GetMonData(&gPlayerParty[partyIndex], MON_DATA_IS_EGG, NULL);
|
||||
gBattleMons[battlerId].abilityNum = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ABILITY_NUM, NULL);
|
||||
gBattleMons[battlerId].otId = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_ID, NULL);
|
||||
gBattleMons[battlerId].types[0] = gSpeciesInfo[gBattleMons[battlerId].species].types[0];
|
||||
gBattleMons[battlerId].types[1] = gSpeciesInfo[gBattleMons[battlerId].species].types[1];
|
||||
gBattleMons[battlerId].ability = GetAbilityBySpecies(gBattleMons[battlerId].species, gBattleMons[battlerId].abilityNum);
|
||||
GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname);
|
||||
StringCopy_Nickname(gBattleMons[battlerId].nickname, nickname);
|
||||
GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_NAME, gBattleMons[battlerId].otName);
|
||||
|
||||
hpSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(battlerId)];
|
||||
*hpSwitchout = gBattleMons[battlerId].hp;
|
||||
>>>>>>> 312749dd3109e607779bb1a15f3669ea2b0979dc
|
||||
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
dst->statStages[i] = DEFAULT_STAT_STAGE;
|
||||
|
|
|
@ -123,9 +123,9 @@ SINGLE_BATTLE_TEST("Reflect Type copies a target's dual types")
|
|||
ANIMATION(ANIM_TYPE_MOVE, MOVE_REFLECT_TYPE, player);
|
||||
MESSAGE("Arcanine's type changed to match the Foe Poliwrath's!");
|
||||
} THEN {
|
||||
EXPECT_EQ(player->type1, TYPE_WATER);
|
||||
EXPECT_EQ(player->type2, TYPE_FIGHTING);
|
||||
EXPECT_EQ(player->type3, TYPE_MYSTERY);
|
||||
EXPECT_EQ(player->types[0], TYPE_WATER);
|
||||
EXPECT_EQ(player->types[1], TYPE_FIGHTING);
|
||||
EXPECT_EQ(player->types[2], TYPE_MYSTERY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,13 +145,13 @@ SINGLE_BATTLE_TEST("Reflect Type copies a target's pure type")
|
|||
ANIMATION(ANIM_TYPE_MOVE, MOVE_REFLECT_TYPE, player);
|
||||
MESSAGE("Arcanine's type changed to match the Foe Sudowoodo's!");
|
||||
} THEN {
|
||||
EXPECT_EQ(player->type1, TYPE_ROCK);
|
||||
EXPECT_EQ(player->type2, TYPE_ROCK);
|
||||
EXPECT_EQ(player->type3, TYPE_MYSTERY);
|
||||
EXPECT_EQ(player->types[0], TYPE_ROCK);
|
||||
EXPECT_EQ(player->types[1], TYPE_ROCK);
|
||||
EXPECT_EQ(player->types[2], TYPE_MYSTERY);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Reflect Type defaults to Normal type for the user's type1 and type2 if the target only has a 3rd type")
|
||||
SINGLE_BATTLE_TEST("Reflect Type defaults to Normal type for the user's types[0] and types[1] if the target only has a 3rd type")
|
||||
{
|
||||
ASSUME(gSpeciesInfo[SPECIES_WOBBUFFET].types[0] == TYPE_PSYCHIC);
|
||||
ASSUME(gSpeciesInfo[SPECIES_WOBBUFFET].types[1] == TYPE_PSYCHIC);
|
||||
|
@ -179,8 +179,8 @@ SINGLE_BATTLE_TEST("Reflect Type defaults to Normal type for the user's type1 an
|
|||
ANIMATION(ANIM_TYPE_MOVE, MOVE_REFLECT_TYPE, player);
|
||||
MESSAGE("Wobbuffet's type changed to match the Foe Arcanine's!");
|
||||
} THEN {
|
||||
EXPECT_EQ(player->type1, TYPE_NORMAL);
|
||||
EXPECT_EQ(player->type2, TYPE_NORMAL);
|
||||
EXPECT_EQ(player->type3, TYPE_GRASS);
|
||||
EXPECT_EQ(player->types[0], TYPE_NORMAL);
|
||||
EXPECT_EQ(player->types[1], TYPE_NORMAL);
|
||||
EXPECT_EQ(player->types[2], TYPE_GRASS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ SINGLE_BATTLE_TEST("Electric Terrain activates Electric Seed and Mimicry")
|
|||
ABILITY_POPUP(opponent);
|
||||
MESSAGE("Foe Stunfisk's type changed to Electric!");
|
||||
} THEN {
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_ELECTRIC);
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].types[0], TYPE_ELECTRIC);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ SINGLE_BATTLE_TEST("Grassy Terrain activates Grassy Seed and Mimicry")
|
|||
ABILITY_POPUP(opponent);
|
||||
MESSAGE("Foe Stunfisk's type changed to Grass!");
|
||||
} THEN {
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_GRASS);
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].types[0], TYPE_GRASS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ SINGLE_BATTLE_TEST("Misty Terrain activates Misty Seed and Mimicry")
|
|||
ABILITY_POPUP(opponent);
|
||||
MESSAGE("Foe Stunfisk's type changed to Fairy!");
|
||||
} THEN {
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_FAIRY);
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].types[0], TYPE_FAIRY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain activates Psychic Seed and Mimicry")
|
|||
ABILITY_POPUP(opponent);
|
||||
MESSAGE("Foe Stunfisk's type changed to Psychic!");
|
||||
} THEN {
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_PSYCHIC);
|
||||
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].types[0], TYPE_PSYCHIC);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue