-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwarhead-stats.js
105 lines (89 loc) · 2.45 KB
/
warhead-stats.js
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
export class Warhead {
constructor({ name, armorPen, armorFalloff, ricochet,
ignoreEffectiveThickness, componentDamage, componentFalloff,
maxPenetrationDepth }) {
this.name = name;
this.baseArmorPen = armorPen;
this.armorFalloff = armorFalloff;
this.ricochet = ricochet;
this.ignoreEffectiveThickness = ignoreEffectiveThickness;
this.baseComponentDamage = componentDamage;
this.componentFalloff = componentFalloff;
this.maxPenetrationDepth = maxPenetrationDepth;
}
armorPenetration(size, _speed) {
return this.armorFalloff.calculate(this.baseArmorPen, size);
}
componentDamage(size) {
return this.componentFalloff.calculate(this.baseComponentDamage, size);
}
}
const minPenetrationSpeed = 25; // unity units per second
class CompositeWarhead {
constructor(name, penetrator, explosive) {
this.name = name;
this.penetrator = penetrator;
this.explosive = explosive;
}
armorPenetration(size, speed) {
return this.penetrator.armorPenetration(size) * Math.max(0, (speed/10 - minPenetrationSpeed));
}
componentDamage(size) {
return this.explosive.componentDamage(size);
}
}
class ParabolicFalloff {
constructor(falloffFactor) {
this.falloffFactor = falloffFactor;
}
calculate(damage, size) {
return damage * Math.sqrt(size * this.falloffFactor);
}
}
class HEKPFalloff {
constructor(falloffFactor) {
this.falloffFactor = falloffFactor;
}
calculate(damage, size) {
}
}
export class NoFalloff {
calculate(damage, size) {
return damage * size;
}
}
export const hei = new Warhead({
name: "HE Impact",
armorPen: 30,
armorFalloff: new ParabolicFalloff(0.8),
ricochet: false,
ignoreEffectiveThickness: true,
componentDamage: 240,
componentFalloff: new NoFalloff(),
maxPenetrationDepth: 70,
});
export const hekp_penetrator = new Warhead({
name: "HEKP Penetrator",
armorPen: 3.5,
armorFalloff: new ParabolicFalloff(0.8),
ricochet: false,
ignoreEffectiveThickness: false,
componentDamage: 50,
componentFalloff: new ParabolicFalloff(2),
maxPenetrationDepth: 70,
});
export const hekp_explosive = new Warhead({
name: "HEKP Explosive",
armorPen: 30,
armorFalloff: new NoFalloff(),
ricochet: false,
ignoreEffectiveThickness: true,
componentDamage: 400,
componentFalloff: new NoFalloff(),
maxPenetrationDepth: 175,
});
export const hekp = new CompositeWarhead("HEKP", hekp_penetrator, hekp_explosive);
export default {
hei,
hekp,
}