Merge pull request #3013 from genNAowl/wall-stats

Add Wall Stats
This commit is contained in:
Anuken 2020-10-20 19:04:54 -04:00 committed by GitHub
commit 0878becb33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 7 deletions

View File

@ -628,6 +628,9 @@ stat.ammo = Ammo
stat.shieldhealth = Shield Health
stat.cooldowntime = Cooldown Time
stat.explosiveness = Explosiveness
stat.basedeflectchance = Base Deflect Chance
stat.lightningchance = Lightning Chance
stat.lightningdamage = Lightning Damage
stat.flammability = Flammability
stat.radioactivity = Radioactivity
stat.heatcapacity = HeatCapacity

View File

@ -794,14 +794,16 @@ public class Blocks implements ContentList{
phaseWall = new Wall("phase-wall"){{
requirements(Category.defense, with(Items.phasefabric, 6));
health = 150 * wallHealthMultiplier;
flashHit = deflect = true;
chanceDeflect = 10f;
flashHit = true;
}};
phaseWallLarge = new Wall("phase-wall-large"){{
requirements(Category.defense, ItemStack.mult(phaseWall.requirements, 4));
health = 150 * 4 * wallHealthMultiplier;
size = 2;
flashHit = deflect = true;
chanceDeflect = 10f;
flashHit = true;
}};
surgeWall = new Wall("surge-wall"){{

View File

@ -17,16 +17,17 @@ import static mindustry.Vars.*;
public class Wall extends Block{
public int variants = 0;
public float lightningChance = -0.001f;
/** Lighting chance. -1 to disable */
public float lightningChance = -1f;
public float lightningDamage = 20f;
public int lightningLength = 17;
public Color lightningColor = Pal.surge;
public Sound lightningSound = Sounds.spark;
public float chanceDeflect = 10f;
/** Bullet deflection chance. -1 to disable */
public float chanceDeflect = -1f;
public boolean flashHit;
public Color flashColor = Color.white;
public boolean deflect;
public Sound deflectSound = Sounds.none;
public Wall(String name){
@ -38,6 +39,17 @@ public class Wall extends Block{
canOverdrive = false;
}
@Override
public void setStats(){
super.setStats();
if(chanceDeflect > 0f) stats.add(Stat.baseDeflectChance, chanceDeflect, StatUnit.none);
if(lightningChance > 0f){
stats.add(Stat.lightningChance, lightningChance * 100f, StatUnit.percent);
stats.add(Stat.lightningDamage, lightningDamage, StatUnit.none);
}
}
@Override
public void load(){
super.load();
@ -96,7 +108,7 @@ public class Wall extends Block{
hit = 1f;
//create lightning if necessary
if(lightningChance > 0){
if(lightningChance > 0f){
if(Mathf.chance(lightningChance)){
Lightning.create(team, lightningColor, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength);
lightningSound.at(tile, Mathf.random(0.9f, 1.1f));
@ -104,7 +116,7 @@ public class Wall extends Block{
}
//deflect bullets if necessary
if(deflect){
if(chanceDeflect > 0f){
//slow bullets are not deflected
if(bullet.vel().len() <= 0.1f || !bullet.type.reflectable) return true;

View File

@ -22,6 +22,9 @@ public enum Stat{
buildSpeed,
mineSpeed,
mineTier,
baseDeflectChance,
lightningChance,
lightningDamage,
itemCapacity(StatCat.items),
itemsMoved(StatCat.items),