Fix physical atk stat stage and third type

This commit is contained in:
DizzyEggg 2018-11-17 23:47:35 +01:00
parent c9f57a3b7b
commit c2a3cff814
3 changed files with 18 additions and 7 deletions

View file

@ -4475,6 +4475,7 @@ static void atk4D_switchindataupdate(void)
gBattleMons[gActiveBattler].type1 = gBaseStats[gBattleMons[gActiveBattler].species].type1;
gBattleMons[gActiveBattler].type2 = gBaseStats[gBattleMons[gActiveBattler].species].type2;
gBattleMons[gActiveBattler].type3 = TYPE_MYSTERY;
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].altAbility);
// check knocked off item
@ -8059,7 +8060,8 @@ static void atk90_tryconversiontypechange(void) // randomly changes user's type
moveType = TYPE_NORMAL;
}
if (moveType != gBattleMons[gBattlerAttacker].type1
&& moveType != gBattleMons[gBattlerAttacker].type2)
&& moveType != gBattleMons[gBattlerAttacker].type2
&& moveType != gBattleMons[gBattlerAttacker].type3)
{
break;
}
@ -8086,7 +8088,7 @@ static void atk90_tryconversiontypechange(void) // randomly changes user's type
moveType = TYPE_NORMAL;
}
}
while (moveType == gBattleMons[gBattlerAttacker].type1 || moveType == gBattleMons[gBattlerAttacker].type2);
while (moveType == gBattleMons[gBattlerAttacker].type1 || moveType == gBattleMons[gBattlerAttacker].type2 || moveType == gBattleMons[gBattlerAttacker].type3);
SET_BATTLER_TYPE(gBattlerAttacker, moveType);
PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType);

View file

@ -5016,7 +5016,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
return ApplyModifier(modifier, basePower);
}
static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 isCrit)
u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 isCrit)
{
u8 atkStage;
u32 atkStat;
@ -5025,20 +5025,28 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b
if (gBattleMoves[move].effect == EFFECT_FOUL_PLAY)
{
if (IS_MOVE_PHYSICAL(move))
{
atkStat = gBattleMons[battlerDef].attack;
atkStage = gBattleMons[battlerDef].statStages[STAT_ATK];
}
else
{
atkStat = gBattleMons[battlerDef].spAttack;
atkStage = gBattleMons[battlerDef].statStages[STAT_ATK];
atkStage = gBattleMons[battlerDef].statStages[STAT_SPATK];
}
}
else
{
if (IS_MOVE_PHYSICAL(move))
{
atkStat = gBattleMons[battlerAtk].attack;
atkStage = gBattleMons[battlerAtk].statStages[STAT_ATK];
}
else
{
atkStat = gBattleMons[battlerAtk].spAttack;
atkStage = gBattleMons[battlerAtk].statStages[STAT_SPATK];
atkStage = gBattleMons[battlerAtk].statStages[STAT_SPATK];
}
}
// critical hits ignore attack stat's stage drops

View file

@ -4689,6 +4689,7 @@ void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst)
dst->otId = GetMonData(src, MON_DATA_OT_ID, NULL);
dst->type1 = gBaseStats[dst->species].type1;
dst->type2 = gBaseStats[dst->species].type2;
dst->type3 = TYPE_MYSTERY;
dst->ability = GetAbilityBySpecies(dst->species, dst->altAbility);
GetMonData(src, MON_DATA_NICKNAME, nickname);
StringCopy10(dst->nickname, nickname);