-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebuff.java
More file actions
173 lines (160 loc) · 3.82 KB
/
Debuff.java
File metadata and controls
173 lines (160 loc) · 3.82 KB
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
/**
* The class of debuffs
* each debuff is it's own class
*
* @author James Lu & Terence Lai
* @version 1.0
*/
public class Debuff
{
private Enemy enemy; //the enemy this debuff belongs to
private int id; //id of the debuff
private int lv;
private int duration; //duration of the debuff
private int maxDuration; //the max duration
private int dmg; //damage of the debuff
private int rate; //rate of the dot
private float slow; //slow of the debuff, precentage
private float armorRedu; //armor reduction
private float chance;
private String name;
public Debuff(int id, int lv, Enemy e)
{
this.id = id;
this.lv = lv;
enemy = e;
if (id == 0){ //stun
if (lv == 1){
dmg = 0;
rate = 100;
slow = 1f;
armorRedu = 0;
name = "Stun";
}
}else if (id == 1){ //lightning
if (lv == 1){
dmg = 3;
rate = 30;
slow = 0.05f;
armorRedu = 2;
name = "lightning";
}
}else if (id == 2){ //freeze
if (lv == 1){
dmg = 1;
rate = 20;
slow = 0.5f;
armorRedu = 1;
name = "Freeze";
}
}else if (id == 3){ //burn
if (lv == 1){
dmg = 10;
rate = 10;
slow = 0.005f;
armorRedu = 1;
name = "Burn";
}
}else if (id == 4){ //stone
if (lv == 1){
dmg = 3;
rate = 30;
slow = 0.75f;
armorRedu = 5;
name = "Stone";
}
}
maxDuration = Data.debuffDuration[lv-1][id];
duration = maxDuration;
}
public Debuff (int id, int lv){
this (id, lv, null);
}
/**
* the "act" method for the debuff class
* have to call this class manually since its not an actor
*/
public void run(){
duration--;
if (duration == 0){
enemy.removeDebuff (this);
}
}
/**
* increases the duration
*/
public void increasseDuration (){
duration = maxDuration;
}
/**
* Returns the id of the debuff <br>
* 0 is stun <br>
* 1 is lightning <br>
* 2 is freeze <br>
* 3 is burn <br>
* 4 is stone
*/
public int getId(){
return id;
}
/**
* Returns the duration of the debuff thats left
*/
public int getDuration(){
return duration;
}
/**
* Returns the max duration of the debuff
*/
public int getMaxDuration(){
return maxDuration;
}
/**
* Returns the currenent debuff's damage
*/
public int getDmg(){
if (duration > 0 && rate % duration == 0){
return dmg;
}
else{
return 0;
}
}
/**
* Returns the damage rate of the DoT
*/
public int getRate(){
return rate;
}
/**
* Returns the Damage Over Time of the debuff
*/
public float getDOT(){
float r = rate;
return dmg/r;
}
/**
* Returns the amount that this debuff slows <br>
* Returns a float between 0 and 1, which is a precentage
*/
public float getSlow(){
return slow;
}
/**
* Returns the armor reduction of this debuff
*/
public float getRedu(){
return armorRedu;
}
/**
* Returns the name of this debuff
*/
public String getName()
{
return name;
}
public float getChance()
{
return chance;
}
}