Add wall stats + other changes

This commit is contained in:
Leonwang4234
2020-10-18 13:35:20 -07:00
parent 521d44714d
commit db3db47ca1
4 changed files with 29 additions and 9 deletions

View File

@ -625,6 +625,9 @@ blocks.reload = Shots/Second
blocks.ammo = Ammo
blocks.shieldhealth = Shield Health
blocks.cooldowntime = Cooldown Time
blocks.basedeflectchance = Base Deflect Chance
blocks.lightningchance = Lightning Chance
blocks.lightningdamage = Lightning Damage
bar.drilltierreq = Better Drill Required
bar.noresources = Missing Resources
@ -1244,8 +1247,8 @@ block.plastanium-wall.description = A special type of wall that absorbs electric
block.plastanium-wall-large.description = A special type of wall that absorbs electric arcs and blocks automatic power node connections.\nSpans multiple tiles.
block.thorium-wall.description = A strong defensive block.\nDecent protection from enemies.
block.thorium-wall-large.description = A strong defensive block.\nDecent protection from enemies.\nSpans multiple tiles.
block.phase-wall.description = A wall coated with special phase-based reflective compound. Deflects most bullets upon impact.
block.phase-wall-large.description = A wall coated with special phase-based reflective compound. Deflects most bullets upon impact.\nSpans multiple tiles.
block.phase-wall.description = A wall coated with special phase-based reflective compound. Deflection chance is equal to the ratio of bullet damage to base deflection chance.
block.phase-wall-large.description = A wall coated with special phase-based reflective compound. Deflection chance is equal to the ratio of bullet damage to base deflection chance.\nSpans multiple tiles.
block.surge-wall.description = An extremely durable defensive block.\nBuilds up charge on bullet contact, releasing it randomly.
block.surge-wall-large.description = An extremely durable defensive block.\nBuilds up charge on bullet contact, releasing it randomly.\nSpans multiple tiles.
block.door.description = A small door. Can be opened or closed by tapping.

View File

@ -792,14 +792,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(BlockStat.baseDeflectChance, chanceDeflect, StatUnit.none);
if(lightningChance > 0f) {
stats.add(BlockStat.lightningChance, lightningChance * 100f, StatUnit.percent);
stats.add(BlockStat.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

@ -12,6 +12,9 @@ public enum BlockStat{
buildTime(StatCategory.general),
buildCost(StatCategory.general),
memoryCapacity(StatCategory.general),
baseDeflectChance(StatCategory.general),
lightningChance(StatCategory.general),
lightningDamage(StatCategory.general),
itemCapacity(StatCategory.items),
itemsMoved(StatCategory.items),