This repository has been archived by the owner on Apr 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VoidPlayer.cs
127 lines (106 loc) · 3.04 KB
/
VoidPlayer.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
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameInput;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace LavaHeights
{
public class VoidPlayer : ModPlayer
{
public int voidMeterMax = 100;
private const int voidCrystalMax = 10;
public override TagCompound Save() {
return new TagCompound {
{"voidMeterMax", voidMeterMax},
};
}
public override void Load(TagCompound tag)
{
voidMeterMax = tag.GetInt("voidMeterMax");
}
public float voidMeter = 0;
public float voidRegen = 0;
public float voidCost = 1f;
public float voidSpeed = 1f;
public int voidMeterMax2 = 0;
public static VoidPlayer ModPlayer(Player player) {
return player.GetModPlayer<VoidPlayer>();
}
public float voidDamage = 1f;
public float voidKnockback;
public int voidCrit;
public override void ResetEffects() {
ResetVariables();
}
public override void UpdateDead() {
ResetVariables();
}
private void ResetVariables() {
voidDamage = 1f;
if(voidMeter < 0)
{
player.lifeRegen += (int)(voidMeter * 0.7f);
voidMeter += -player.lifeRegen * 0.02f;
voidDamage -= voidMeter * 0.025f;
voidDamage += (player.statLifeMax2 - player.statLife) * 0.01f;
}
voidSpeed = 1f;
voidCost = 1;
voidMeter += 0.03f + voidRegen;
voidMeterMax2 = voidMeterMax;
if(voidMeter > voidMeterMax2)
voidMeter = voidMeterMax2;
{
}
voidKnockback = 0f;
voidCrit = 0;
voidRegen = 0;
}
public int voidMana;
public override void GetWeaponDamage(Item item, ref int damage)
{
int voidMana = item.mana;
voidMana = (int)(voidMana * VoidPlayer.ModPlayer(player).voidCost);
}
public override float UseTimeMultiplier(Item item){
return voidSpeed;
}
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.melee && !item.ranged && !item.magic && !item.summon && !item.thrown && item.mana > 0) //Checking if item is a void item (possibly temporary until a more optimal check is put in place)
{
player.statMana += item.mana;
int voidMana = item.mana;
voidMana = (int)(voidMana * VoidPlayer.ModPlayer(player).voidCost);
int chargeInt = (int)VoidPlayer.ModPlayer(player).voidMeter;
string text = chargeInt.ToString();;
//Main.NewText("Void = " + text, 195, 145, 0);
VoidPlayer.ModPlayer(player).voidMeter -= voidMana;
if(VoidPlayer.ModPlayer(player).voidMeter < 0)
{
player.statLife -= voidMana;
if(player.statLife < 1)
{
player.statLife = 1;
}
}
chargeInt = (int)VoidPlayer.ModPlayer(player).voidMeter;
text = chargeInt.ToString();;
//Main.NewText("Void = " + text, 195, 145, 0);
if(item.shoot != 10)
{
return true;
}
return false;
}
return true;
}
}
}