Skip to content

Commit

Permalink
Add sluggish curse trap (#660)
Browse files Browse the repository at this point in the history
Slows movement speed by 25%.
  • Loading branch information
Kewlan committed Apr 9, 2023
1 parent 868fbca commit ab7b05d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
4 changes: 4 additions & 0 deletions code/src/actors/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ f32 Player_GetSpeedMultiplier(void) {
speedMultiplier *= 1.5;
}

if (IceTrap_ActiveCurse == ICETRAP_CURSE_SLOW) {
speedMultiplier *= 0.75;
}

return speedMultiplier;
}

Expand Down
6 changes: 5 additions & 1 deletion code/src/icetrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ void IceTrap_InitTypes(void) {
possibleChestTraps[possibleChestTrapsAmount++] = ICETRAP_CURSE_SHIELD;
possibleChestTraps[possibleChestTrapsAmount++] = ICETRAP_CURSE_DIZZY;
possibleChestTraps[possibleChestTrapsAmount++] = ICETRAP_CURSE_BLIND;
possibleChestTraps[possibleChestTrapsAmount++] = ICETRAP_CURSE_SLOW;
possibleItemTraps[possibleItemTrapsAmount++] = ICETRAP_CURSE_SWORD;
possibleItemTraps[possibleItemTrapsAmount++] = ICETRAP_CURSE_SHIELD;
possibleItemTraps[possibleItemTrapsAmount++] = ICETRAP_CURSE_DIZZY;
possibleItemTraps[possibleItemTrapsAmount++] = ICETRAP_CURSE_BLIND;
possibleItemTraps[possibleItemTrapsAmount++] = ICETRAP_CURSE_SLOW;
}
if (gSettingsContext.screenTraps) {
possibleChestTraps[possibleChestTrapsAmount++] = ICETRAP_CURSE_CROOKED;
Expand Down Expand Up @@ -181,6 +183,8 @@ u8 IceTrap_ActivateCurseTrap(u8 curseType) {
gStaticContext.dekuNutFlash = -1;
gStaticContext.renderGeometryDisable = 1;
break;
case ICETRAP_CURSE_SLOW:
break;
case ICETRAP_CURSE_CROOKED:
targetOffset = dizzyCurseSeed % 0xC001 + 0x2000;
break;
Expand All @@ -196,7 +200,7 @@ u8 IceTrap_ActivateCurseTrap(u8 curseType) {
gSaveContext.timer2State = 4; // "active"
gSaveContext.timer2Value = 60;
TimerFrameCounter = 30;
DisplayTextbox(gGlobalContext, 0x8FF0 + curseType - ICETRAP_CURSE_SHIELD, 0);
DisplayTextbox(gGlobalContext, CURSETRAP_TEXT_BASE_INDEX + curseType - ICETRAP_CURSE_SHIELD, 0);
PlaySound(0x100035C); // Poe laugh SFX
IceTrap_ActiveCurse = (s8)curseType;
return 1;
Expand Down
5 changes: 4 additions & 1 deletion code/src/icetrap.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef _ICETRAP_H_
#define _ICETRAP_H_

#include "z3D/z3D.h"
#include "../include/z3D/z3D.h"

#define CURSETRAP_TEXT_BASE_INDEX 0x8FF0

extern s8 IceTrap_ActiveCurse;
extern u32 possibleChestTraps[20];
Expand Down Expand Up @@ -32,6 +34,7 @@ typedef enum {
ICETRAP_CURSE_SWORD,
ICETRAP_CURSE_DIZZY,
ICETRAP_CURSE_BLIND,
ICETRAP_CURSE_SLOW,
ICETRAP_CURSE_CROOKED,
ICETRAP_CURSE_UNSTABLE,
} IceTrapTypes;
Expand Down
31 changes: 25 additions & 6 deletions source/custom_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "shops.hpp"
#include "../code/src/message.h"
#include "settings.hpp"
#include "../code/src/icetrap.h"

#include <array>
#include <set>
Expand Down Expand Up @@ -612,7 +613,8 @@ void CreateAlwaysIncludedMessages() {
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + COLOR(QM_RED) + "NARR!" + COLOR(QM_WHITE) +
INSTANT_TEXT_OFF() + MESSAGE_END());
// Curse Traps
CreateMessage(0x8FF0, 0, 2, 3,
u32 curseIdxOffset = 0;
CreateMessage(CURSETRAP_TEXT_BASE_INDEX + curseIdxOffset++, 0, 2, 3,
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "You've been " + COLOR(QM_RED) + "cursed" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "You can't use your shield!" +
INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END(),
Expand All @@ -630,7 +632,7 @@ void CreateAlwaysIncludedMessages() {
"Du kannst deinen Schild nicht mehr benutzen!" + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) +
MESSAGE_END());
CreateMessage(
0x8FF1, 0, 2, 3,
CURSETRAP_TEXT_BASE_INDEX + curseIdxOffset++, 0, 2, 3,
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "You've been " + COLOR(QM_RED) + "cursed" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "Your sword " + COLOR(QM_RED) + "can't hit" +
COLOR(QM_WHITE) + " anything!" + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END(),
Expand All @@ -646,7 +648,7 @@ void CreateAlwaysIncludedMessages() {
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "Du wurdest " + COLOR(QM_RED) + "verflucht" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "Dein Schwert " + COLOR(QM_RED) + "verfehlt" +
COLOR(QM_WHITE) + " absolut alles!" + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END());
CreateMessage(0x8FF2, 0, 2, 3,
CreateMessage(CURSETRAP_TEXT_BASE_INDEX + curseIdxOffset++, 0, 2, 3,
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "You've been " + COLOR(QM_RED) + "cursed" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "You are " + COLOR(QM_RED) + "confused" +
COLOR(QM_WHITE) + "!" + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END(),
Expand All @@ -662,7 +664,7 @@ void CreateAlwaysIncludedMessages() {
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "Du wurdest " + COLOR(QM_RED) + "verflucht" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "Du bist " + COLOR(QM_RED) + "verwirrt" +
COLOR(QM_WHITE) + "!" + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END());
CreateMessage(0x8FF3, 0, 2, 3,
CreateMessage(CURSETRAP_TEXT_BASE_INDEX + curseIdxOffset++, 0, 2, 3,
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "You've been " + COLOR(QM_RED) + "cursed" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "Terrain is " + COLOR(QM_RED) + "invisible" +
COLOR(QM_WHITE) + "!" + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END(),
Expand All @@ -679,7 +681,24 @@ void CreateAlwaysIncludedMessages() {
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "Du wurdest " + COLOR(QM_RED) + "verflucht" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "Die Umgebung ist " + COLOR(QM_RED) +
"unsichtbar" + COLOR(QM_WHITE) + "!" + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END());
CreateMessage(0x8FF4, 0, 2, 3,
CreateMessage(CURSETRAP_TEXT_BASE_INDEX + curseIdxOffset++, 0, 2, 3,
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "You've been " + COLOR(QM_RED) + "cursed" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "You are feeling " + COLOR(QM_RED) +
"sluggish" + COLOR(QM_WHITE) + "..." + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END(),
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "Un " + COLOR(QM_RED) + "sort" + COLOR(QM_WHITE) +
" vous a été jeté!" + NEWLINE() + CENTER_TEXT() + "Vous vous sentez " + COLOR(QM_RED) +
"léthargique" + COLOR(QM_WHITE) + "..." + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END(),
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "¡Has sido " + COLOR(QM_RED) + "hechizado" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "Te sientes " + COLOR(QM_RED) + "lento" +
COLOR(QM_WHITE) + "..." + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END(),
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "Sei caduto vittima di una " + COLOR(QM_RED) +
"maledizione" + COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "Ti senti un po' " +
COLOR(QM_RED) + "fiacco" + COLOR(QM_WHITE) + "..." + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) +
MESSAGE_END(),
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "Du wurdest " + COLOR(QM_RED) + "verflucht" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "Du fühlst dich " + COLOR(QM_RED) + "träge" +
COLOR(QM_WHITE) + "..." + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END());
CreateMessage(CURSETRAP_TEXT_BASE_INDEX + curseIdxOffset++, 0, 2, 3,
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "You've been " + COLOR(QM_RED) + "cursed" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "The world is " + COLOR(QM_RED) + "crooked" +
COLOR(QM_WHITE) + "!" + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END(),
Expand All @@ -697,7 +716,7 @@ void CreateAlwaysIncludedMessages() {
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "Die Welt wurde " + COLOR(QM_RED) +
"gedreht" + COLOR(QM_WHITE) + "!" + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END());
CreateMessage(
0x8FF5, 0, 2, 3,
CURSETRAP_TEXT_BASE_INDEX + curseIdxOffset++, 0, 2, 3,
UNSKIPPABLE() + INSTANT_TEXT_ON() + CENTER_TEXT() + "You've been " + COLOR(QM_RED) + "cursed" +
COLOR(QM_WHITE) + "!" + NEWLINE() + CENTER_TEXT() + "The camera is " + COLOR(QM_RED) + "unstable" +
COLOR(QM_WHITE) + "!" + INSTANT_TEXT_OFF() + CLOSE_AFTER(120) + MESSAGE_END(),
Expand Down

0 comments on commit ab7b05d

Please sign in to comment.