Add Powder

This commit is contained in:
DizzyEggg 2018-12-03 12:50:32 +01:00
parent 52d1e69591
commit b9e711bbf4
13 changed files with 77 additions and 3 deletions

View file

@ -1580,6 +1580,10 @@
various \battler, VARIOUS_ACUPRESSURE
.4byte \ptr
.endm
.macro setpowder battler:req
various \battler, VARIOUS_SET_POWDER
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req

View file

@ -650,6 +650,7 @@ gBattleAnims_StatusConditions::
.4byte Status_Freeze
.4byte Status_Curse
.4byte Status_Nightmare
.4byte Status_Powder
.align 2
gBattleAnims_General::
@ -11929,6 +11930,9 @@ Status_Nightmare:
waitforvisualfinish
clearmonbg ANIM_DEF_PARTNER
end
Status_Powder:
end
General_CastformChange:
createvisualtask sub_815BB18, 2

View file

@ -339,6 +339,20 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectSparklingAria
.4byte BattleScript_EffectAcupressure
.4byte BattleScript_EffectAromaticMist
.4byte BattleScript_EffectPowder
BattleScript_EffectPowder:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, NO_ACC_CALC_CHECK_LOCK_ON
attackstring
ppreduce
jumpifstatus2 BS_TARGET, STATUS2_POWDER, BattleScript_ButItFailed
setpowder BS_TARGET
attackanimation
waitanimation
printstring STRINGID_COVEREDINPOWDER
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_EffectAromaticMist:
attackcanceler
@ -5522,6 +5536,25 @@ BattleScript_DoSelfConfusionDmg::
goto BattleScript_MoveEnd
BattleScript_MoveUsedIsConfusedRet::
return
BattleScript_MoveUsedPowder::
bicword gHitMarker, HITMARKER_NO_ATTACKSTRING | HITMARKER_ATTACKSTRING_PRINTED
attackstring
ppreduce
pause 0x20
cancelmultiturnmoves BS_ATTACKER
status2animation BS_ATTACKER, STATUS2_POWDER
waitanimation
effectivenesssound
hitanimation BS_ATTACKER
waitstate
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
printstring STRINGID_POWDEREXPLODES
waitmessage 0x40
tryfaintmon BS_ATTACKER, FALSE, NULL
goto BattleScript_MoveEnd
BattleScript_MoveUsedIsConfusedNoMore::
printstring STRINGID_PKMNHEALEDCONFUSION

View file

@ -203,6 +203,7 @@ struct ProtectStruct
u32 usesBouncedMove:1;
u32 usedHealBlockedMove:1;
u32 usedGravityPreventedMove:1;
u32 powderSelfDmg:1;
u32 physicalDmg;
u32 specialDmg;
u8 physicalBattlerId;

View file

@ -286,5 +286,6 @@ extern const u8 BattleScript_MoveEffectFeint[];
extern const u8 BattleScript_ProteanActivates[];
extern const u8 BattleScript_DazzlingProtected[];
extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[];
extern const u8 BattleScript_MoveUsedPowder[];
#endif // GUARD_BATTLE_SCRIPTS_H

View file

@ -116,6 +116,7 @@
#define STATUS2_LOCK_CONFUSE 0x00000C00
#define STATUS2_MULTIPLETURNS 0x00001000
#define STATUS2_WRAPPED 0x00002000
#define STATUS2_POWDER 0x00004000
#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every battler
#define STATUS2_INFATUATED_WITH(battler) (gBitTable[battler] << 16)
#define STATUS2_FOCUS_ENERGY 0x00100000

View file

@ -327,5 +327,6 @@
#define EFFECT_SPARKLING_ARIA 321
#define EFFECT_ACUPRESSURE 322
#define EFFECT_AROMATIC_MIST 323
#define EFFECT_POWDER 324
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View file

@ -133,6 +133,7 @@
#define VARIOUS_SET_AURORA_VEIL 71
#define VARIOUS_TRY_THIRD_TYPE 72
#define VARIOUS_ACUPRESSURE 73
#define VARIOUS_SET_POWDER 74
// atk80, dmg manipulation
#define ATK80_DMG_CHANGE_SIGN 0

View file

@ -514,6 +514,8 @@
#define STRINGID_THIRDTYPEADDED 510
#define STRINGID_FELLFORFEINT 511
#define STRINGID_POKEMONCANNOTUSEMOVE 512
#define STRINGID_COVEREDINPOWDER 513
#define STRINGID_POWDEREXPLODES 514
#define BATTLESTRINGS_COUNT 525

View file

@ -651,6 +651,8 @@ static const u8 sText_BestowItemGiving[] = _("{B_DEF_NAME_WITH_PREFIX} received
static const u8 sText_ThirdTypeAdded[] = _("{B_BUFF1} type was added to\n{B_DEF_NAME_WITH_PREFIX}!");
static const u8 sText_FellForFeint[] = _("{B_DEF_NAME_WITH_PREFIX} fell for\nthe feint!");
static const u8 sText_PokemonCannotUseMove[] = _("{B_ATK_NAME_WITH_PREFIX} cannot\nuse {B_CURRENT_MOVE}!");
static const u8 sText_CoveredInPowder[] = _("{B_DEF_NAME_WITH_PREFIX} is covered in powder!");
static const u8 sText_PowderExplodes[] = _("When the flame touched the powder \non the Pokémon, it exploded!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
@ -1156,6 +1158,8 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
sText_ThirdTypeAdded,
sText_FellForFeint,
sText_PokemonCannotUseMove,
sText_CoveredInPowder,
sText_PowderExplodes,
};
const u16 gTerrainStringIds[] =

View file

@ -6338,6 +6338,9 @@ static void atk76_various(void)
switch (gBattlescriptCurrInstr[2])
{
case VARIOUS_SET_POWDER:
gBattleMons[gActiveBattler].status2 |= STATUS2_POWDER;
break;
case VARIOUS_ACUPRESSURE:
bits = 0;
for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++)

View file

@ -483,7 +483,8 @@ bool8 WasUnableToUseMove(u8 battler)
|| gProtectStructs[battler].usedHealBlockedMove
|| gProtectStructs[battler].flag2Unknown
|| gProtectStructs[battler].flinchImmobility
|| gProtectStructs[battler].confusionSelfDmg)
|| gProtectStructs[battler].confusionSelfDmg
|| gProtectStructs[battler].powderSelfDmg)
return TRUE;
else
return FALSE;
@ -1306,6 +1307,7 @@ enum
ENDTURN_ITEMS2,
ENDTURN_ROOST,
ENDTURN_ELECTRIFY,
ENDTURN_POWDER,
ENDTURN_BATTLER_COUNT
};
@ -1756,7 +1758,9 @@ u8 DoBattlerEndTurnEffects(void)
case ENDTURN_ELECTRIFY:
gStatuses3[gActiveBattler] &= ~(STATUS3_ELECTRIFIED);
gBattleStruct->turnEffectsTracker++;
break;
case ENDTURN_POWDER:
gBattleMons[gActiveBattler].status2 &= ~(STATUS2_POWDER);
gBattleStruct->turnEffectsTracker++;
case ENDTURN_BATTLER_COUNT: // done
gBattleStruct->turnEffectsTracker = 0;
gBattleStruct->turnEffectsBattlerId++;
@ -1982,6 +1986,7 @@ enum
CANCELLER_IN_LOVE,
CANCELLER_BIDE,
CANCELLER_THAW,
CANCELLER_POWDER,
CANCELLER_END,
CANCELLER_PSYCHIC_TERRAIN,
CANCELLER_END2,
@ -2272,6 +2277,20 @@ u8 AtkCanceller_UnableToUseMove(void)
}
gBattleStruct->atkCancellerTracker++;
break;
case CANCELLER_POWDER:
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_POWDER)
{
u32 moveType;
GET_MOVE_TYPE(gCurrentMove, moveType);
if (moveType == TYPE_FIRE)
{
gProtectStructs[gBattlerAttacker].powderSelfDmg = 1;
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4;
gBattlescriptCurrInstr = BattleScript_MoveUsedPowder;
}
}
gBattleStruct->atkCancellerTracker++;
break;
case CANCELLER_END:
break;
}

View file

@ -7218,7 +7218,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.split = SPLIT_STATUS,
},
{ // MOVE_POWDER
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_POWDER,
.power = 0,
.type = TYPE_BUG,
.accuracy = 100,