-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShaggyAddonRacesPlayer.cs
88 lines (77 loc) · 3.26 KB
/
ShaggyAddonRacesPlayer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using Terraria.ModLoader;
using Terraria.ModLoader.Config;
using Terraria.GameInput;
using MrPlagueRaces;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using System.Runtime;
using Terraria.ModLoader.IO;
using ShaggyAddonRaces.Content.Buffs;
namespace ShaggyAddonRaces
{
public class ShaggyAddonRacesPlayer : ModPlayer
{
private int RacialKeySwitch = 0;
private bool AutoPressing = false;
private bool RacialToggle = true;
private ModHotKey RacialHotKey = MrPlagueRaces.MrPlagueRaces.RacialAbilityHotKey;
private MrPlagueRaces.MrPlagueRaces _MrPlagueRaces = ModLoader.GetMod("MrPlagueRaces") as MrPlagueRaces.MrPlagueRaces;
private MrPlagueRaces.MrPlagueRacesPlayer modPlayer;
public override void OnEnterWorld(Player player)
{
modPlayer = player.GetModPlayer<MrPlagueRaces.MrPlagueRacesPlayer>();
Main.NewText("Shaggy's Addon Races: ''Racial ability can toggle'' is set to true by default. (It's located in Mod Configuration if you want to change it!)");
}
public override void PostUpdate()
{
if (RacialHotKey == null)
{
RacialHotKey = MrPlagueRaces.MrPlagueRaces.RacialAbilityHotKey;
}
if (RacialToggle && RacialHotKey != null)
{
//Turns on the auto held racial key mechanic.
if (RacialHotKey.JustPressed && !AutoPressing)
{
AutoPressing = true;
}
//Turns off the auto held racial key mechanic.
else if (RacialHotKey.JustPressed && AutoPressing)
{
AutoPressing = false;
}
if (AutoPressing == true)
{
if (modPlayer.RaceStats)
{
if (player.HasBuff(_MrPlagueRaces.BuffType("VampireBat")))
{
player.AddBuff(_MrPlagueRaces.BuffType("VampireBat"), 2);
}
}
if (SoundType.Custom.Equals("Sounds/Derpkin_Hurt"))
{
Main.PlaySound(SoundLoader.customSoundType, (int)player.Center.X, (int)player.Center.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/Derpkin_Hurt"));
}
}
}
}
public void PostUpdateMiscEffects(Player player)
{
//What kills the Kobold sunlight debuff
if (Main.eclipse == true || player.armor[0].type == ItemID.Sunglasses || player.armor[0].type == ItemID.Goggles || player.armor[0].type == ItemID.SteampunkGoggles)
{
player.buffImmune[_MrPlagueRaces.BuffType("KoboldSunlight")] = true;
}
//What kills the Vampire sunlight debuff
if (Main.eclipse == true)
{
player.buffImmune[_MrPlagueRaces.BuffType("VampireBurn")] = true;
}
}
}
}