Skip to content

Commit

Permalink
Added 'remove debuffs' hotkey
Browse files Browse the repository at this point in the history
  • Loading branch information
Alana Gilston committed Aug 2, 2016
1 parent b0e0972 commit f34f8d2
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
42 changes: 42 additions & 0 deletions CheatHotkeys.cs
@@ -1,16 +1,32 @@
using Microsoft.Xna.Framework.Input;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.GameInput;
using Terraria.ModLoader;

namespace CheatHotkeys {
public class CheatHotkeys : Mod {
private static int[] debuffs = new int[] {
BuffID.Poisoned, BuffID.PotionSickness, BuffID.Darkness,
BuffID.Cursed, BuffID.OnFire, BuffID.Tipsy, BuffID.Bleeding,
BuffID.Confused, BuffID.Slow, BuffID.Weak,
BuffID.Silenced, BuffID.BrokenArmor, BuffID.CursedInferno,
BuffID.Chilled, BuffID.Frozen, BuffID.Ichor,
BuffID.Venom, BuffID.Midas, BuffID.Blackout,
BuffID.ChaosState, BuffID.ManaSickness, BuffID.Wet,
BuffID.Stinky, BuffID.Slimed, BuffID.Electrified,
BuffID.MoonLeech, BuffID.Rabies, BuffID.Webbed,
BuffID.ShadowFlame, BuffID.Stoned, BuffID.Dazed,
BuffID.VortexDebuff, BuffID.BoneJavelin, BuffID.Daybreak,
BuffID.StardustMinionBleed
};
private bool godMode = false;
private bool unlimitedAmmo = false;

private HotKey lifeKey = new HotKey("Refill Life", Keys.Z);
private HotKey manaKey = new HotKey("Refill Mana", Keys.X);
private HotKey removeDebuffs = new HotKey("Remove Debuffs", Keys.C);
private HotKey godModeKey = new HotKey("Toggle God Mode", Keys.F);
private HotKey unlimitedAmmoKey = new HotKey("Toggle Unlimited Ammo", Keys.G);

Expand All @@ -24,13 +40,18 @@ public class CheatHotkeys : Mod {
set { unlimitedAmmo = value; }
}

public static int[] Debuffs {
get { return debuffs; }
}

public override void Load() {
Properties = new ModProperties() {
Autoload = true
};

RegisterHotKey(lifeKey.Name, lifeKey.DefaultKey.ToString());
RegisterHotKey(manaKey.Name, manaKey.DefaultKey.ToString());
RegisterHotKey(removeDebuffs.Name, removeDebuffs.DefaultKey.ToString());
RegisterHotKey(godModeKey.Name, godModeKey.DefaultKey.ToString());
RegisterHotKey(unlimitedAmmoKey.Name, unlimitedAmmoKey.DefaultKey.ToString());
}
Expand All @@ -43,6 +64,9 @@ public class CheatHotkeys : Mod {
else if(name.Equals(manaKey.Name)) {
RefillMana();
}
else if(name.Equals(removeDebuffs.Name)) {
RemoveDebuffs();
}
else if(name.Equals(godModeKey.Name)) {
ToggleGodMode();
}
Expand All @@ -66,8 +90,26 @@ public class CheatHotkeys : Mod {
Main.NewText("Mana refilled!");
}

public void RemoveDebuffs() {
Player player = Main.player[Main.myPlayer];

foreach(int debuff in debuffs) {
if(player.HasBuff(debuff) > -1) {
player.ClearBuff(debuff);
}
}

Main.NewText("Removed debuffs!");
}

public void ToggleGodMode() {
GodMode = !GodMode;

if(GodMode) {
RefillLife();
RemoveDebuffs();
}

Main.NewText("God mode has been " + (GodMode ? "enabled" : "disabled") + "!");
}

Expand Down
11 changes: 10 additions & 1 deletion description.txt
Expand Up @@ -3,4 +3,13 @@
Z: Refill life
X: Refill mana
F: Toggle god mode
G: Toggle unlimited ammo
G: Toggle unlimited ammo

[Changelog]
2016-08-02 v1.1.0
- Added "remove debuffs" hotkey
- Enabling god mode refills life and removes debuffs
- Fix: player can no longer be hit by projectiles with god mode on

2016-08-01 v1.0.1
- Added homepage

0 comments on commit f34f8d2

Please sign in to comment.