-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBrittleDamageScript.groovy
46 lines (38 loc) · 1.6 KB
/
BrittleDamageScript.groovy
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
import roguelikeengine.item.*;
import java.util.Random;
import roguelikeengine.largeobjects.*;
import roguelikeengine.stat.*;
class BrittleDamageScript implements DamageScript {
public static int SMASHING_ATTACK = 0;
public static int CUTTING_ATTACK = 1;
public static int PIERCING_ATTACK = 2;
public static int THRUSTING_ATTACK = 3;
public void run(Attack a, Item i) throws NoSuchStatException {
float contactArea = Math.min(a.getScore("Contact Area"), i.getScore("Size"));
switch ((int) a.getScore("Type")) {
case SMASHING_ATTACK:
float bluntDamage = a.getScore("Raw Damage")/contactArea;
if (i.getScore("Impact Point") < i.getScore("Fracture Point"))
switch ((int) bluntDamage/i.getScore("Impact Point")) {
case 0: break;
// case 1: i.addMod(new ItemMod())
}
else
switch ((int) bluntDamage/i.getScore("Fracture Point")) {
case 0: break;
}
break;
case THRUSTING_ATTACK:
float bluntDamage = a.getScore("Raw Damage")/contactArea;
break;
case CUTTING_ATTACK:
float cuttingDamage = a.getScore("Raw Damage") * a.getScore("Sharpness");
break;
case PIERCING_ATTACK:
float piercingDamage = (a.getScore("Raw Damage") * a.getScore("Sharpness"))/contactArea;
break;
default:
break;
}
}
}