Sticky Web done

This commit is contained in:
DizzyEggg 2018-07-24 22:09:55 +02:00
parent f8b1f0a45c
commit 100ce73a12
9 changed files with 66 additions and 2 deletions

View File

@ -1365,6 +1365,14 @@
various \battler, VARIOUS_SWITCHIN_ABILITIES
.endm
.macro savetarget
various BS_TARGET, VARIOUS_SAVE_TARGET
.endm
.macro restoretarget
various BS_TARGET, VARIOUS_RESTORE_TARGET
.endm
@ helpful macros
.macro setstatchanger stat, stages, down
setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7

View File

@ -3855,6 +3855,26 @@ BattleScript_ToxicSpikesPoisoned::
waitstate
return
BattleScript_StickyWebOnSwitchIn::
savetarget
copybyte gBattlerTarget sBANK
printstring STRINGID_STICKYWEBSWITCHIN
waitmessage 0x40
statbuffchange 0x1, BattleScript_StickyWebOnSwitchInEnd
jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, 0x2, BattleScript_StickyWebOnSwitchInStatAnim
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x3, BattleScript_StickyWebOnSwitchInEnd
pause 0x20
goto BattleScript_StickyWebOnSwitchInPrintStatMsg
BattleScript_StickyWebOnSwitchInStatAnim:
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
BattleScript_StickyWebOnSwitchInPrintStatMsg:
printfromtable gStatDownStringIds
waitmessage 0x40
BattleScript_StickyWebOnSwitchInEnd:
restoretarget
return
BattleScript_PerishSongTakesLife::
printstring STRINGID_PKMNPERISHCOUNTFELL
waitmessage 0x40

View File

@ -257,6 +257,7 @@ struct SideTimer
/*0x0A*/ u8 spikesAmount;
u8 toxicSpikesAmount;
u8 stealthRockAmount;
u8 stickyWebAmount;
u8 auroraVeilTimer;
u8 auroraVeilBattlerId;
u8 tailwindTimer;
@ -592,6 +593,7 @@ struct BattleStruct
u8 magnitudeBasePower;
u8 presentBasePower;
u8 roostTypes[MAX_BATTLERS_COUNT][3];
u8 savedBattlerTarget;
};
#define GET_MOVE_TYPE(move, typeArg) \

View File

@ -316,5 +316,6 @@ extern const u8 BattleScript_BadDreamsActivates[];
extern const u8 BattleScript_SwitchInAbilityMsg[];
extern const u8 BattleScript_ToxicSpikesPoisoned[];
extern const u8 BattleScript_ToxicSpikesAbsorbed[];
extern const u8 BattleScript_StickyWebOnSwitchIn[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -74,6 +74,8 @@
#define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26
#define VARIOUS_STAT_TEXT_BUFFER 27
#define VARIOUS_SWITCHIN_ABILITIES 28
#define VARIOUS_SAVE_TARGET 29
#define VARIOUS_RESTORE_TARGET 30
// atk80, dmg manipulation
#define ATK80_DMG_CHANGE_SIGN 0

View File

@ -476,7 +476,8 @@
#define STRINGID_STEALTHROCKDMG 473
#define STRINGID_TOXICSPIKESABSORBED 474
#define STRINGID_TOXICSPIKESPOISONED 475
#define STRINGID_STICKYWEBSWITCHIN 476
#define BATTLESTRINGS_COUNT 466
#define BATTLESTRINGS_COUNT 467
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H

View File

@ -118,6 +118,7 @@ enum
LIST_SIDE_TAILWIND,
LIST_SIDE_STEALTH_ROCK,
LIST_SIDE_TOXIC_SPIKES,
LIST_SIDE_STICKY_WEB,
};
// const rom data
@ -177,6 +178,7 @@ static const u8 sText_Tailwind[] = _("Tailwind");
static const u8 sText_PP[] = _("PP");
static const u8 sText_StealthRock[] = _("Stealth Rock");
static const u8 sText_ToxicSpikes[] = _("Toxic Spikes");
static const u8 sText_StickyWeb[] = _("Sticky Web");
static const u8 sText_EmptyString[] = _("");
@ -329,6 +331,7 @@ static const struct ListMenuItem sSideStatusListItems[] =
{sText_Tailwind, LIST_SIDE_TAILWIND},
{sText_StealthRock, LIST_SIDE_STEALTH_ROCK},
{sText_ToxicSpikes, LIST_SIDE_TOXIC_SPIKES},
{sText_StickyWeb, LIST_SIDE_STICKY_WEB},
};
static const struct ListMenuItem sSecondaryListItems[] =
@ -1135,6 +1138,15 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus,
*(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_TOXIC_SPIKES);
}
return &sideTimer->toxicSpikesAmount;
case LIST_SIDE_STICKY_WEB:
if (changeStatus)
{
if (statusTrue)
*(u32*)(data->modifyArrows.modifiedValPtr) |= SIDE_STATUS_STICKY_WEB;
else
*(u32*)(data->modifyArrows.modifiedValPtr) &= ~(SIDE_STATUS_STICKY_WEB);
}
return &sideTimer->stickyWebAmount;
default:
return NULL;
}
@ -1243,7 +1255,7 @@ static void SetUpModifyArrows(struct BattleDebugMenu *data)
if (data->currentSecondaryListItemId == LIST_SIDE_SPIKES)
data->modifyArrows.maxValue = 3;
else if (data->currentSecondaryListItemId == LIST_SIDE_STEALTH_ROCK)
else if (data->currentSecondaryListItemId == LIST_SIDE_STEALTH_ROCK || data->currentSecondaryListItemId == LIST_SIDE_STICKY_WEB)
data->modifyArrows.maxValue = 1;
else
data->modifyArrows.maxValue = 9;

View File

@ -617,6 +617,7 @@ static const u8 sText_SymbiosisItemPass[] = _("{B_ATK_NAME_WITH_PREFIX} passed i
static const u8 sText_StealthRockDmg[] = _("Pointed stones dug into\n{B_SCR_ACTIVE_NAME_WITH_PREFIX}!");
static const u8 sText_ToxicSpikesAbsorbed[] = _("");
static const u8 sText_ToxicSpikesPoisoned[] = _("");
static const u8 sText_StickyWebSwitchIn[] = _("");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
@ -1085,6 +1086,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
sText_StealthRockDmg,
sText_ToxicSpikesAbsorbed,
sText_ToxicSpikesPoisoned,
sText_StickyWebSwitchIn,
};
const u16 gDmgHazardsStringIds[] =

View File

@ -5395,6 +5395,16 @@ static void atk52_switchineffects(void)
}
}
}
else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STICKY_WEB_DAMAGED)
&& (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_STICKY_WEB)
&& IsBattlerGrounded(gActiveBattler))
{
gSideStatuses[GetBattlerSide(gActiveBattler)] |= SIDE_STATUS_STICKY_WEB_DAMAGED;
gBattleScripting.battler = gActiveBattler;
SET_STATCHANGER(STAT_SPEED, 1, TRUE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_StickyWebOnSwitchIn;
}
else
{
if (gBattleMons[gActiveBattler].ability == ABILITY_TRUANT && !gDisableStructs[gActiveBattler].truantUnknownBit)
@ -6606,6 +6616,12 @@ static void atk76_various(void)
gBattlescriptCurrInstr += 3;
AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gActiveBattler, 0, 0, 0);
return;
case VARIOUS_SAVE_TARGET:
gBattleStruct->savedBattlerTarget = gBattlerTarget;
break;
case VARIOUS_RESTORE_TARGET:
gBattlerTarget = gBattleStruct->savedBattlerTarget;
break;
}
gBattlescriptCurrInstr += 3;