-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMasoDLCPlayer.cs
232 lines (219 loc) · 6.4 KB
/
MasoDLCPlayer.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
using System.Reflection;
using MasomodeDLC.Calamity.Buffs;
using MasomodeDLC.Thorium.Buffs;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
namespace MasomodeDLC
{
public class MasoDLCPlayer : ModPlayer
{
public int MinuteTimer = 60;
private readonly Mod Thorium = ModLoader.GetMod("ThoriumMod");
private readonly Mod Calamity = ModLoader.GetMod("CalamityMod");
//private readonly Mod Redemption = ModLoader.GetMod("Redemption");
#region Buff/effect flags
#region Thorium
public bool teslasurge;
public bool rubberWeapon;
public bool wristpain;
public bool creativeblank;
public bool displayClouds;
public bool abyssalDrag;
#endregion
#region Calamity
public bool voidVessel;
public bool antimatterDoll;
#endregion
#endregion
public override void ResetEffects()
{
teslasurge = false;
rubberWeapon = false;
wristpain = false;
creativeblank = false;
displayClouds = false;
abyssalDrag = false;
voidVessel = false;
antimatterDoll = false;
}
public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
{
if (rubberWeapon)
{
damage = 0;
RubberWeaponEffect(null, target);
}
}
public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (rubberWeapon)
{
damage = 0;
RubberWeaponEffect(null, target);
}
}
public override void ModifyHitPvp(Item item, Player target, ref int damage, ref bool crit)
{
if (rubberWeapon)
{
damage = 0;
RubberWeaponEffect(target, null);
}
}
public override void ModifyHitPvpWithProj(Projectile proj, Player target, ref int damage, ref bool crit)
{
if (rubberWeapon)
{
damage = 0;
RubberWeaponEffect(target, null);
}
}
public void RubberWeaponEffect(Player player, NPC npc)
{
int rand = Main.rand.Next(7);
string squeak = "/squeak" + rand;
if (npc == null)
{
player.statLife += 1;
player.HealEffect(1, true);
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "FargowiltasSouls/Sounds/SqueakyToy" + squeak), player.Center);
}
else if (player == null)
{
npc.life += 1;
npc.HealEffect(1, true);
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "FargowiltasSouls/Sounds/SqueakyToy" + squeak), npc.Center);
}
}
public override void PostUpdateBuffs()
{
if (Calamity != null)
{
ModPlayer calPlayer = player.GetModPlayer(Calamity, "CalamityPlayer");
FieldInfo field = calPlayer.GetType().GetField("ZoneSunkenSea");
var zoneSunkenSea = field.GetValue(calPlayer); // for getting the value of the field
if ((bool)zoneSunkenSea && player.wet)
{
player.AddBuff(Main.hardMode ? ModContent.BuffType<ForcedZen>() : ModContent.BuffType<ForcedPeace>(), 2);
}
}
if (Thorium != null)
{
ModPlayer thoriumPlayer = player.GetModPlayer(Thorium, "ThoriumPlayer");
FieldInfo field = thoriumPlayer.GetType().GetField("ZoneAqua");
var zoneAquaticDepths = field.GetValue(thoriumPlayer); // for getting the value of the field
if ((bool)zoneAquaticDepths && !ThorWorldBools.DownedJellyfishJam)
{
player.AddBuff(ModContent.BuffType<DontGoIntoTheFuckingAquaticDepthsBeforeQueen>(), 2); //hahayes
player.AddBuff(BuffID.NoBuilding, 2);
}
if (player.ZoneJungle && !ThorWorldBools.DownedCoolBloomFacts)
{
player.AddBuff(ThorBuffIDs.TaintedHearts, 2);
}
}
}
public override void PostUpdateRunSpeeds()
{
#region Thorium
if (Thorium != null)
{
if (player.HasBuff(ThorBuffIDs.Freezing))
{
player.runAcceleration /= 2f;
player.maxRunSpeed *= 0.666666666f;
}
if (player.HasBuff(ModContent.BuffType<Teslasurge>()))
{
for (int i = 0; i < 60; i++)
{
player.maxRunSpeed += Main.rand.NextFloat(-0.25f, 0.25f);
}
}
if (player.HasBuff(ModContent.BuffType<DontGoIntoTheFuckingAquaticDepthsBeforeQueen>()))
{
player.maxRunSpeed = 0.6f;
player.maxFallSpeed += 1f;
//how are we supposed to restrict vertical movement effectively - plant
player.velocity.Y += 0.333f;
// Something like that for now, will look further into this later -Thomas
// uh ok sure - plant
}
}
#endregion
#region Calamity
if (Calamity != null)
{
}
#endregion
}
public override void UpdateDead()
{
teslasurge = false;
rubberWeapon = false;
wristpain = false;
creativeblank = false;
displayClouds = false;
abyssalDrag = false;
}
public override void UpdateBadLifeRegen()
{
if (teslasurge)
{
if (player.lifeRegen > 0)
{
player.lifeRegen = 0;
}
player.lifeRegenTime = 0;
player.lifeRegen -= 8;
}
if (abyssalDrag && !player.wet)
{
if (player.lifeRegen > 0)
{
player.lifeRegen = 0;
}
player.lifeRegenTime = 0;
player.lifeRegen -= 16000000; // literally death
}
}
public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright)
{
if (teslasurge)
{
//todo: tesla effects
}
}
bool doCooldown = true;
int cloudTime = 0;
int coolDown = 0;
public override void PostUpdate()
{
if (displayClouds && Main.netMode != NetmodeID.Server && !Filters.Scene["CloudFilter"].IsActive())
{
Filters.Scene.Activate("CloudFilter", player.Center).GetShader().UseColor(1f, 1f, 1f).UseIntensity(80f).UseOpacity(0.95f);
}
else if (displayClouds && Main.netMode != NetmodeID.Server && Filters.Scene["CloudFilter"].IsActive())
{
doCooldown = true;
cloudTime++;
Filters.Scene["CloudFilter"].GetShader().UseProgress(cloudTime).UseTargetPosition(player.Center).UseOpacity(0.95f);
}
if (doCooldown && !displayClouds && Main.netMode != NetmodeID.Server)
{
coolDown++;
float progress = coolDown / 60f;
Filters.Scene["CloudFilter"].GetShader().UseProgress(progress).UseTargetPosition(player.Center).UseIntensity(80f - (progress * 80f)).UseOpacity(0.95f);
if (coolDown >= 60)
{
Filters.Scene["CloudFilter"].Deactivate();
cloudTime = 0;
coolDown = 0;
doCooldown = false;
}
}
}
}
}