Skip to content

Commit bf35f4a

Browse files
committed
Use a string instead of a boolean to determine crit
Compatibility with https://github.com/Slotterleet/a-lot-of-damage crit display
1 parent f79a118 commit bf35f4a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/progressed/entities/bullet/energy/EMPCloudBulletType.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class EMPCloudBulletType extends BulletType{
2020
protected static Rand cloudRand = new Rand();
2121

2222
public float radius = 20f * tilesize;
23-
public float growTime = 6f * 60f;
23+
public float growTime = 2f * 60f;
2424
public float empInterval = 20f;
2525
public float timeDuration = 60f * 10f;
2626
public float powerDamageScl = 2f, powerSclDecrease = 0.2f;

src/progressed/entities/bullet/physical/CritBulletType.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public void init(){
4545

4646
@Override
4747
public void init(Bullet b){
48-
if(b.data == null) b.data = Mathf.chance(critChance);
49-
if((boolean)b.data) b.damage *= critMultiplier;
48+
if(b.data == null) b.data = Mathf.chance(critChance) ? "crit" : null;
49+
if(isCrit(b)) b.damage *= critMultiplier;
5050

5151
super.init(b);
5252
}
@@ -61,7 +61,7 @@ public void update(Bullet b){
6161
((PMTrail)(b.trail)).updateRot(b.x, b.y, b.rotation());
6262
}
6363

64-
if(Mathf.chanceDelta(1) && (boolean)b.data){
64+
if(Mathf.chanceDelta(1) && isCrit(b)){
6565
critEffect.at(b.x, b.y, b.rotation(), b.team.color);
6666
}
6767

@@ -143,7 +143,7 @@ public void hit(Bullet b, float x, float y){
143143
@Override
144144
public float damageMultiplier(Bullet b){
145145
float critMul = 1f;
146-
if(b.isAdded() && (boolean)b.data) critMul = critMultiplier;
146+
if(b.isAdded() && isCrit(b)) critMul = critMultiplier;
147147

148148
return super.damageMultiplier(b) * critMul;
149149
}
@@ -171,4 +171,8 @@ public void bounce(Bullet b){
171171
}
172172
}
173173
}
174+
175+
public boolean isCrit(Bullet b){
176+
return b.data instanceof String;
177+
}
174178
}

0 commit comments

Comments
 (0)