mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-02 03:00:29 +03:00
fix chance in remote places
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package mindustry.entities.bullet;
|
||||
|
||||
import arc.math.*;
|
||||
import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
@@ -57,7 +58,9 @@ public class EmpBulletType extends BasicBulletType{
|
||||
hitPowerEffect.at(other.x, other.y, b.angleTo(other), hitColor);
|
||||
chainEffect.at(x, y, 0, hitColor, other);
|
||||
other.damage(damage * unitDamageScl);
|
||||
other.apply(status, statusDuration);
|
||||
if(Mathf.chance(getStatusChance(b))){
|
||||
other.apply(status, statusDuration);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public class TractorBeamTurret extends BaseTurret{
|
||||
public Color laserColor = Color.white;
|
||||
public StatusEffect status = StatusEffects.none;
|
||||
public float statusDuration = 300;
|
||||
public float statusChance = 1f;
|
||||
|
||||
public Sound shootSound = Sounds.beamParallax;
|
||||
public float shootSoundVolume = 0.9f;
|
||||
@@ -59,6 +60,9 @@ public class TractorBeamTurret extends BaseTurret{
|
||||
stats.add(Stat.targetsAir, targetAir);
|
||||
stats.add(Stat.targetsGround, targetGround);
|
||||
if(damage > 0) stats.add(Stat.damage, damage * 60f, StatUnit.perSecond);
|
||||
if(status != StatusEffects.none && statusChance > 0f){
|
||||
stats.add(Stat.damage, StatValues.statusText(status, statusDuration, statusChance));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,7 +129,7 @@ public class TractorBeamTurret extends BaseTurret{
|
||||
target.damageContinuousPierce(damage * eff * timeScale * state.rules.blockDamage(team));
|
||||
}
|
||||
|
||||
if(status != StatusEffects.none){
|
||||
if(status != StatusEffects.none && Mathf.chance(statusChance)){
|
||||
target.apply(status, statusDuration);
|
||||
}
|
||||
|
||||
|
||||
@@ -225,6 +225,16 @@ public class StatValues{
|
||||
return withTooltip(element, content, false);
|
||||
}
|
||||
|
||||
/** Displays the chance for status effects */
|
||||
public static String statusText(StatusEffect status, float duration, float chance){
|
||||
return (chance < 1f ? Core.bundle.format("stat.chance", Strings.autoFixed(chance * 100f, 4)) : "") +
|
||||
(status.hasEmoji() ? status.emoji() + " " : "") +
|
||||
"[stat]" + status.localizedName +
|
||||
(status.reactive ? "" :
|
||||
"[lightgray] ~ [stat]" + Strings.autoFixed(duration / 60f, 1) +
|
||||
"[lightgray] " + Core.bundle.get("unit.seconds"));
|
||||
}
|
||||
|
||||
/** Displays an item with a specified amount. */
|
||||
private static Stack stack(TextureRegion region, int amount, @Nullable UnlockableContent content, boolean tooltip){
|
||||
Stack stack = new Stack();
|
||||
@@ -885,15 +895,6 @@ public class StatValues{
|
||||
});
|
||||
}
|
||||
|
||||
private static String statusText(StatusEffect status, float duration, float chance){
|
||||
return (chance < 1f ? Core.bundle.format("stat.chance", Strings.autoFixed(chance * 100f, 4)) : "") +
|
||||
(status.hasEmoji() ? status.emoji() + " " : "") +
|
||||
"[stat]" + status.localizedName +
|
||||
(status.reactive ? "" :
|
||||
"[lightgray] ~ [stat]" + Strings.autoFixed(duration / 60f, 1) +
|
||||
"[lightgray] " + Core.bundle.get("unit.seconds"));
|
||||
}
|
||||
|
||||
//for AmmoListValue
|
||||
private static Cell<?> sep(Table table, String text){
|
||||
table.row();
|
||||
|
||||
Reference in New Issue
Block a user