Support for two typed moves.

This commit is contained in:
DizzyEggg 2018-08-05 13:57:37 +02:00
parent 5fbeef860c
commit de85f88bbb
4 changed files with 43 additions and 30 deletions

View File

@ -289,6 +289,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectAttackAccUp
.4byte BattleScript_EffectAttackSpAttackUp
.4byte BattleScript_EffectHurricane
.4byte BattleScript_EffectTwoTypedMove
BattleScript_EffectAttackSpAttackUp:
attackcanceler
@ -847,6 +848,7 @@ BattleScript_EffectPsyshock:
BattleScript_EffectWeatherBall:
BattleScript_EffectHiddenPower:
BattleScript_EffectFreezeDry:
BattleScript_EffectTwoTypedMove:
jumpifnotmove MOVE_SURF, BattleScript_HitFromAtkCanceler
jumpifnostatus3 BS_TARGET, STATUS3_UNDERWATER, BattleScript_HitFromAtkCanceler
orword gHitMarker, HITMARKER_IGNORE_UNDERWATER

View File

@ -278,5 +278,6 @@
#define EFFECT_ATTACK_ACCURACY_UP 272
#define EFFECT_ATTACK_SPATK_UP 273
#define EFFECT_HURRICANE 274
#define EFFECT_TWO_TYPED_MOVE 275
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -6724,7 +6724,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
.split = SPLIT_PHYSICAL,
},
{ // MOVE_FLYING_PRESS
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_TWO_TYPED_MOVE,
.power = 100,
.type = TYPE_FIGHTING,
.accuracy = 95,
@ -6734,6 +6734,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
.priority = 0,
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED | FLAG_DMG_MINIMIZE,
.split = SPLIT_PHYSICAL,
.argument = TYPE_FLYING,
},
{ // MOVE_MAT_BLOCK
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect

View File

@ -5447,41 +5447,50 @@ static void UpdateMoveResultFlags(u16 modifier)
}
}
static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 battlerAtk, u8 battlerDef, bool32 recordAbilities, u16 modifier)
{
u32 atkAbility = GetBattlerAbility(battlerAtk);
MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type1, atkAbility);
if (gBattleMons[battlerDef].type2 != gBattleMons[battlerDef].type1)
MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type2, atkAbility);
if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef))
{
modifier = UQ_4_12(0.0);
if (recordAbilities && GetBattlerAbility(battlerDef) == ABILITY_LEVITATE)
{
gLastUsedAbility = ABILITY_LEVITATE;
gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE);
gLastLandedMoves[battlerDef] = 0;
gBattleCommunication[6] = moveType;
RecordAbilityBattle(battlerDef, ABILITY_LEVITATE);
}
}
if (GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && gBattleMoves[move].power)
{
modifier = UQ_4_12(0.0);
if (recordAbilities)
{
gLastUsedAbility = ABILITY_WONDER_GUARD;
gMoveResultFlags |= MOVE_RESULT_MISSED;
gLastLandedMoves[battlerDef] = 0;
gBattleCommunication[6] = 3;
RecordAbilityBattle(battlerDef, ABILITY_WONDER_GUARD);
}
}
return modifier;
}
u16 CalcTypeEffectivenessMultiplier(u16 move, u8 moveType, u8 battlerAtk, u8 battlerDef, bool32 recordAbilities)
{
u16 modifier = UQ_4_12(1.0);
if (move != MOVE_STRUGGLE && moveType != TYPE_MYSTERY)
{
u32 atkAbility = GetBattlerAbility(battlerAtk);
MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type1, atkAbility);
if (gBattleMons[battlerDef].type2 != gBattleMons[battlerDef].type1)
MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type2, atkAbility);
if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef))
{
modifier = UQ_4_12(0.0);
if (recordAbilities && GetBattlerAbility(battlerDef) == ABILITY_LEVITATE)
{
gLastUsedAbility = ABILITY_LEVITATE;
gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE);
gLastLandedMoves[battlerDef] = 0;
gBattleCommunication[6] = moveType;
RecordAbilityBattle(battlerDef, ABILITY_LEVITATE);
}
}
if (GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && gBattleMoves[move].power)
{
modifier = UQ_4_12(0.0);
if (recordAbilities)
{
gLastUsedAbility = ABILITY_WONDER_GUARD;
gMoveResultFlags |= MOVE_RESULT_MISSED;
gLastLandedMoves[battlerDef] = 0;
gBattleCommunication[6] = 3;
RecordAbilityBattle(battlerDef, ABILITY_WONDER_GUARD);
}
}
modifier = CalcTypeEffectivenessMultiplierInternal(move, moveType, battlerAtk, battlerDef, recordAbilities, modifier);
if (gBattleMoves[move].effect == EFFECT_TWO_TYPED_MOVE)
modifier = CalcTypeEffectivenessMultiplierInternal(move, gBattleMoves[move].argument, battlerAtk, battlerDef, recordAbilities, modifier);
}
UpdateMoveResultFlags(modifier);