-
Notifications
You must be signed in to change notification settings - Fork 2
/
PrismPlayer.cs
192 lines (172 loc) · 5.74 KB
/
PrismPlayer.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
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.GameInput;
using Terraria.ID;
using Terraria.ModLoader;
namespace prismmod
{
internal class PrismPlayer : ModPlayer
{
private Random rndm = new Random();
//biomes
public bool ZoneWaterTown = false;
//pets and mounts
public bool tinyTurtle = false;
public bool facePancake = false;
public bool apatheticCloud = false;
public bool upPressed;
public int upTimer;
public bool downPressed;
public int downTimer;
public int vertDashCooldown = 0;
//boss shit
public bool spawnedPrismachine = false;
//stat changes
public float noAmmoUseChance = 0;
public float IncreaseBulletSpeed = 0;
public int timesBounced = 0;
public float flamerDamageIncrease = 1f;
public float flamerSpeedIncrease = 1f;
public float rocketDamageIncrease = 1f;
public float bulletDamageIncrease = 1f;
public float arrowDamageIncrease = 1f;
public float arrowsFreezeEnemies = 0f;
public float twoShotRocket = 0f;
public float reducedContactDamage = 1f;
public bool vertDash = false;
public override void UpdateBiomes()
{
ZoneWaterTown = PrismWorld.moistChiseledStoneCount > 200;
}
public override bool ConsumeAmmo(Item weapon, Item ammo)
{
double number = rndm.NextDouble();
if (number < noAmmoUseChance)
{
noAmmoUseChance = 0f;
return false;
}
noAmmoUseChance = 0f;
return true;
}
public override void ResetEffects()
{
flamerDamageIncrease = 1f;
flamerSpeedIncrease = 1f;
rocketDamageIncrease = 1f;
bulletDamageIncrease = 1f;
arrowDamageIncrease = 1f;
arrowsFreezeEnemies = 0f;
twoShotRocket = 0f;
reducedContactDamage = 1f;
tinyTurtle = false;
facePancake = false;
vertDash = false;
ResetDashTimers();
}
public void ResetDashTimers()
{
if (upPressed)
{
upTimer++;
if (upTimer > 30)
{
upTimer = 0;
upPressed = false;
}
}
if (downPressed)
{
downTimer++;
if (downTimer > 30)
{
downTimer = 0;
downPressed = false;
}
}
if (vertDashCooldown > 0)
{
vertDashCooldown--;
}
}
public override bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (item.useAmmo == AmmoID.Gel)
{
damage = (int)((float)damage * flamerDamageIncrease);
speedY *= flamerSpeedIncrease;
speedX *= flamerSpeedIncrease;
}
if (item.useAmmo == AmmoID.Rocket)
{
damage = (int)((float)damage * rocketDamageIncrease);
double number = rndm.NextDouble();
if (number < twoShotRocket)
{
Vector2 perturbedSpeed = new Vector2(speedX, speedY);
perturbedSpeed = perturbedSpeed * 0.5f;
Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI);
}
}
if (item.useAmmo == AmmoID.Bullet)
{
damage = (int)((float)damage * bulletDamageIncrease);
}
if (item.useAmmo == AmmoID.Arrow)
{
damage = (int)((float)damage * arrowDamageIncrease);
}
return true;
}
public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (proj.arrow)
{
double number = rndm.NextDouble();
if (number < arrowsFreezeEnemies)
{
target.AddBuff(mod.BuffType("Freezing"), 180);//for 3 seconds, can be changed for balancing later
}
}
}
public override void OnHitByNPC(NPC npc, int damage, bool crit)
{
damage = (int)((float)damage * (reducedContactDamage - 1f));
}
public override void ProcessTriggers(TriggersSet triggersSet)
{
if (vertDash && vertDashCooldown == 0)
{
if (player.controlUp && player.releaseUp)
{
if (upPressed)
{
player.velocity.Y = -15f;
upPressed = false;
upTimer = 0;
vertDashCooldown = 60;
}
else
{
upPressed = true;
}
}
if (player.controlDown && player.releaseDown)
{
if (downPressed)
{
player.velocity.Y = 15f;
downPressed = false;
downTimer = 0;
vertDashCooldown = 60;
}
else
{
downPressed = true;
}
}
}
}
}
}