Fairy Lock

This commit is contained in:
DizzyEggg 2020-04-20 19:41:07 +02:00
parent 2daf1fbbf8
commit 0f628c8ff2
13 changed files with 59 additions and 4 deletions

View File

@ -1714,6 +1714,11 @@
.4byte \ptr .4byte \ptr
.endm .endm
.macro trysetfairylock ptr:req
various BS_ATTACKER, VARIOUS_TRY_FAIRY_LOCK
.4byte \ptr
.endm
@ helpful macros @ helpful macros
.macro setstatchanger stat:req, stages:req, down:req .macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View File

@ -262,6 +262,12 @@ AI_CheckBadMove_CheckEffect: @ 82DC045
if_effect EFFECT_HEAL_BELL, AI_CBM_HealBell if_effect EFFECT_HEAL_BELL, AI_CBM_HealBell
if_effect EFFECT_FOLLOW_ME, AI_CBM_FollowMe if_effect EFFECT_FOLLOW_ME, AI_CBM_FollowMe
if_effect EFFECT_GEOMANCY, AI_CBM_QuiverDance if_effect EFFECT_GEOMANCY, AI_CBM_QuiverDance
if_effect EFFECT_FAIRY_LOCK, AI_CBM_FairyLock
end
AI_CBM_FairyLock:
if_field_status STATUS_FIELD_FAIRY_LOCK, Score_Minus10
if_status2 AI_TARGET, STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED, Score_Minus10
end end
AI_CBM_Geomancy: AI_CBM_Geomancy:

View File

@ -361,6 +361,19 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectBurnUp .4byte BattleScript_EffectBurnUp
.4byte BattleScript_EffectShoreUp .4byte BattleScript_EffectShoreUp
.4byte BattleScript_EffectGeomancy .4byte BattleScript_EffectGeomancy
.4byte BattleScript_EffectFairyLock
BattleScript_EffectFairyLock:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
trysetfairylock BattleScript_ButItFailed
attackanimation
waitanimation
printstring STRINGID_NOONEWILLBEABLETORUNAWAY
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_EffectBurnUp: BattleScript_EffectBurnUp:
attackcanceler attackcanceler

View File

@ -221,6 +221,7 @@ struct FieldTimer
u8 psychicTerrainTimer; u8 psychicTerrainTimer;
u8 echoVoiceCounter; u8 echoVoiceCounter;
u8 gravityTimer; u8 gravityTimer;
u8 fairyLockTimer;
}; };
struct WishFutureKnock struct WishFutureKnock

View File

@ -224,6 +224,7 @@
#define STATUS_FIELD_ELECTRIC_TERRAIN 0x100 #define STATUS_FIELD_ELECTRIC_TERRAIN 0x100
#define STATUS_FIELD_PSYCHIC_TERRAIN 0x200 #define STATUS_FIELD_PSYCHIC_TERRAIN 0x200
#define STATUS_FIELD_ION_DELUGE 0x400 #define STATUS_FIELD_ION_DELUGE 0x400
#define STATUS_FIELD_FAIRY_LOCK 0x800
// Flags describing move's result // Flags describing move's result
#define MOVE_RESULT_MISSED (1 << 0) #define MOVE_RESULT_MISSED (1 << 0)

View File

@ -349,5 +349,6 @@
#define EFFECT_BURN_UP 343 #define EFFECT_BURN_UP 343
#define EFFECT_SHORE_UP 344 #define EFFECT_SHORE_UP 344
#define EFFECT_GEOMANCY 345 #define EFFECT_GEOMANCY 345
#define EFFECT_FAIRY_LOCK 346
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -154,6 +154,7 @@
#define VARIOUS_TRY_ACTIVATE_BEAST_BOOST 91 #define VARIOUS_TRY_ACTIVATE_BEAST_BOOST 91
#define VARIOUS_TRY_FRISK 92 #define VARIOUS_TRY_FRISK 92
#define VARIOUS_JUMP_IF_SHIELDS_DOWN_PROTECTED 93 #define VARIOUS_JUMP_IF_SHIELDS_DOWN_PROTECTED 93
#define VARIOUS_TRY_FAIRY_LOCK 94
// Cmd_manipulatedamage // Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0 #define DMG_CHANGE_SIGN 0

View File

@ -546,7 +546,8 @@
#define STRINGID_SCRIPTINGABILITYSTATRAISE 542 #define STRINGID_SCRIPTINGABILITYSTATRAISE 542
#define STRINGID_RECEIVERABILITYTAKEOVER 543 #define STRINGID_RECEIVERABILITYTAKEOVER 543
#define STRINGID_PKNMABSORBINGPOWER 544 #define STRINGID_PKNMABSORBINGPOWER 544
#define STRINGID_NOONEWILLBEABLETORUNAWAY 545
#define BATTLESTRINGS_COUNT 545 #define BATTLESTRINGS_COUNT 546
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H

View File

@ -3689,7 +3689,8 @@ u8 IsRunningFromBattleImpossible(void)
} }
if ((gBattleMons[gActiveBattler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) if ((gBattleMons[gActiveBattler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED))
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED)) || (gStatuses3[gActiveBattler] & STATUS3_ROOTED)
|| gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = 0; gBattleCommunication[MULTISTRING_CHOOSER] = 0;
return 1; return 1;
@ -3867,6 +3868,7 @@ static void HandleTurnActionSelectionState(void)
*(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler]; *(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
if (gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION) if (gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)
|| gBattleTypeFlags & BATTLE_TYPE_ARENA || gBattleTypeFlags & BATTLE_TYPE_ARENA
|| gFieldStatuses & STATUS_FIELD_FAIRY_LOCK
|| gStatuses3[gActiveBattler] & STATUS3_ROOTED) || gStatuses3[gActiveBattler] & STATUS3_ROOTED)
{ {
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); BtlController_EmitChoosePokemon(0, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
@ -5549,7 +5551,8 @@ static void HandleAction_Run(void)
} }
else else
{ {
if (gBattleMons[gBattlerAttacker].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)) if (gBattleMons[gBattlerAttacker].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)
|| gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = 4; gBattleCommunication[MULTISTRING_CHOOSER] = 4;
gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString; gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString;

View File

@ -667,9 +667,11 @@ static const u8 sText_AttackerLostFireType[] = _("{B_ATK_NAME_WITH_PREFIX} burne
static const u8 sText_HealerCure[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ABILITY}\ncured {B_SCR_ACTIVE_NAME_WITH_PREFIX}'s problem!"); static const u8 sText_HealerCure[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ABILITY}\ncured {B_SCR_ACTIVE_NAME_WITH_PREFIX}'s problem!");
static const u8 sText_ReceiverAbilityTakeOver[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nwas taken over!"); static const u8 sText_ReceiverAbilityTakeOver[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nwas taken over!");
static const u8 sText_PkmnAbsorbingPower[] = _("{B_ATK_NAME_WITH_PREFIX} is absorbing power!"); static const u8 sText_PkmnAbsorbingPower[] = _("{B_ATK_NAME_WITH_PREFIX} is absorbing power!");
static const u8 sText_NoOneWillBeAbleToRun[] = _("No one will be able to run away\nduring the next turn!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{ {
[STRINGID_NOONEWILLBEABLETORUNAWAY - 12] = sText_NoOneWillBeAbleToRun,
[STRINGID_PKNMABSORBINGPOWER - 12] = sText_PkmnAbsorbingPower, [STRINGID_PKNMABSORBINGPOWER - 12] = sText_PkmnAbsorbingPower,
[STRINGID_RECEIVERABILITYTAKEOVER - 12] = sText_ReceiverAbilityTakeOver, [STRINGID_RECEIVERABILITYTAKEOVER - 12] = sText_ReceiverAbilityTakeOver,
[STRINGID_SCRIPTINGABILITYSTATRAISE - 12] = sText_ScriptingAbilityRaisedStat, [STRINGID_SCRIPTINGABILITYSTATRAISE - 12] = sText_ScriptingAbilityRaisedStat,

View File

@ -5111,6 +5111,7 @@ static void Cmd_jumpifcantswitch(void)
if (!(gBattlescriptCurrInstr[1] & SWITCH_IGNORE_ESCAPE_PREVENTION) if (!(gBattlescriptCurrInstr[1] & SWITCH_IGNORE_ESCAPE_PREVENTION)
&& ((gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)) && ((gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION))
|| (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED))) || (gStatuses3[gActiveBattler] & STATUS3_ROOTED)))
{ {
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
@ -6826,6 +6827,18 @@ static void Cmd_various(void)
else else
gBattlescriptCurrInstr += 7; gBattlescriptCurrInstr += 7;
return; return;
case VARIOUS_TRY_FAIRY_LOCK:
if (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
}
else
{
gFieldStatuses |= STATUS_FIELD_FAIRY_LOCK;
gFieldTimers.fairyLockTimer = 2;
gBattlescriptCurrInstr += 7;
}
return;
case VARIOUS_GET_STAT_VALUE: case VARIOUS_GET_STAT_VALUE:
i = gBattlescriptCurrInstr[3]; i = gBattlescriptCurrInstr[3];
gBattleMoveDamage = *(u16*)(&gBattleMons[gActiveBattler].attack) + (i - 1); gBattleMoveDamage = *(u16*)(&gBattleMons[gActiveBattler].attack) + (i - 1);

View File

@ -934,6 +934,7 @@ enum
ENDTURN_GRASSY_TERRAIN, ENDTURN_GRASSY_TERRAIN,
ENDTURN_PSYCHIC_TERRAIN, ENDTURN_PSYCHIC_TERRAIN,
ENDTURN_ION_DELUGE, ENDTURN_ION_DELUGE,
ENDTURN_FAIRY_LOCK,
ENDTURN_FIELD_COUNT, ENDTURN_FIELD_COUNT,
}; };
@ -1350,6 +1351,13 @@ u8 DoFieldEndTurnEffects(void)
gFieldStatuses &= ~(STATUS_FIELD_ION_DELUGE); gFieldStatuses &= ~(STATUS_FIELD_ION_DELUGE);
gBattleStruct->turnCountersTracker++; gBattleStruct->turnCountersTracker++;
break; break;
case ENDTURN_FAIRY_LOCK:
if (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK && --gFieldTimers.fairyLockTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_FAIRY_LOCK);
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_FIELD_COUNT: case ENDTURN_FIELD_COUNT:
effect++; effect++;
break; break;

View File

@ -8240,7 +8240,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_FAIRY_LOCK] = [MOVE_FAIRY_LOCK] =
{ {
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect .effect = EFFECT_FAIRY_LOCK,
.power = 0, .power = 0,
.type = TYPE_FAIRY, .type = TYPE_FAIRY,
.accuracy = 0, .accuracy = 0,