Fix Synchronize

This commit is contained in:
DizzyEggg 2019-06-25 13:04:14 +02:00
parent 10c27ac6a6
commit 48c801245c
2 changed files with 30 additions and 20 deletions

View File

@ -474,7 +474,7 @@ struct BattleStruct
u32 savedBattleTypeFlags;
u8 abilityPreventingSwitchout;
u8 hpScale;
u8 synchronizeMoveEffect;
u16 synchronizeMoveEffect;
bool8 anyMonHasTransformed;
void (*savedCallback)(void);
u16 usedHeldItems[MAX_BATTLERS_COUNT];

View File

@ -3527,32 +3527,42 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONISE_EFFECT))
{
gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT);
gBattleStruct->synchronizeMoveEffect &= ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC)
gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON;
gBattleScripting.moveEffect = gBattleStruct->synchronizeMoveEffect + MOVE_EFFECT_AFFECTS_USER;
gBattleScripting.battler = gBattlerTarget;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
if (!(gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY))
{
gBattleStruct->synchronizeMoveEffect &= ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC)
gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON;
gBattleScripting.moveEffect = gBattleStruct->synchronizeMoveEffect + MOVE_EFFECT_AFFECTS_USER;
gBattleScripting.battler = gBattlerAbility = gBattlerTarget;
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, ABILITY_SYNCHRONIZE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
}
}
break;
case ABILITYEFFECT_ATK_SYNCHRONIZE: // 8
if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONISE_EFFECT))
{
gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT);
gBattleStruct->synchronizeMoveEffect &= ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC)
gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON;
gBattleScripting.moveEffect = gBattleStruct->synchronizeMoveEffect;
gBattleScripting.battler = gBattlerAttacker;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
if (!(gBattleMons[gBattlerTarget].status1 & STATUS1_ANY))
{
gBattleStruct->synchronizeMoveEffect &= ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC)
gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON;
gBattleScripting.moveEffect = gBattleStruct->synchronizeMoveEffect;
gBattleScripting.battler = gBattlerAbility = gBattlerAttacker;
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, ABILITY_SYNCHRONIZE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
}
}
break;
case ABILITYEFFECT_INTIMIDATE1: // 9
@ -3635,7 +3645,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gBattleResources->flags->flags[i] &= ~(RESOURCE_FLAG_INTIMIDATED);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_IntimidateActivates;
gBattleStruct->intimidateBattler = i;
gBattlerAbility = gBattleStruct->intimidateBattler = i;
effect++;
break;
}