From db3db47ca1ca72a602ee8a2ed15429ae9fcb3364 Mon Sep 17 00:00:00 2001 From: Leonwang4234 <62972692+Leonwang4234@users.noreply.github.com> Date: Sun, 18 Oct 2020 13:35:20 -0700 Subject: [PATCH 1/4] Add wall stats + other changes --- core/assets/bundles/bundle.properties | 7 ++++-- core/src/mindustry/content/Blocks.java | 6 +++-- .../mindustry/world/blocks/defense/Wall.java | 22 ++++++++++++++----- core/src/mindustry/world/meta/BlockStat.java | 3 +++ 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 196b6e87af..e5b2fcc8c9 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -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. diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index a70280f81f..ff24adaa1b 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -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"){{ diff --git a/core/src/mindustry/world/blocks/defense/Wall.java b/core/src/mindustry/world/blocks/defense/Wall.java index abb941b899..a5f0698238 100644 --- a/core/src/mindustry/world/blocks/defense/Wall.java +++ b/core/src/mindustry/world/blocks/defense/Wall.java @@ -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; diff --git a/core/src/mindustry/world/meta/BlockStat.java b/core/src/mindustry/world/meta/BlockStat.java index 05e45acbfe..5b3e71b14f 100644 --- a/core/src/mindustry/world/meta/BlockStat.java +++ b/core/src/mindustry/world/meta/BlockStat.java @@ -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), From 7a7fa74e65ca6af88d25ffc75b94c8832081b1bf Mon Sep 17 00:00:00 2001 From: genNAowl <68400583+genNAowl@users.noreply.github.com> Date: Sun, 18 Oct 2020 14:26:48 -0700 Subject: [PATCH 2/4] Update core/src/mindustry/world/blocks/defense/Wall.java Co-authored-by: Summet --- core/src/mindustry/world/blocks/defense/Wall.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/world/blocks/defense/Wall.java b/core/src/mindustry/world/blocks/defense/Wall.java index a5f0698238..bc99d814cc 100644 --- a/core/src/mindustry/world/blocks/defense/Wall.java +++ b/core/src/mindustry/world/blocks/defense/Wall.java @@ -44,7 +44,7 @@ public class Wall extends Block{ super.setStats(); if(chanceDeflect > 0f) stats.add(BlockStat.baseDeflectChance, chanceDeflect, StatUnit.none); - if(lightningChance > 0f) { + if(lightningChance > 0f){ stats.add(BlockStat.lightningChance, lightningChance * 100f, StatUnit.percent); stats.add(BlockStat.lightningDamage, lightningDamage, StatUnit.none); } From cff2799c72f53feb26c6c3c10972bbdbe5353a27 Mon Sep 17 00:00:00 2001 From: Leonwang4234 <62972692+Leonwang4234@users.noreply.github.com> Date: Sun, 18 Oct 2020 14:29:15 -0700 Subject: [PATCH 3/4] remove changes in description --- core/assets/bundles/bundle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index e5b2fcc8c9..4c12f1b633 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1247,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. 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.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.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. From 54fd2e03b45410a23243f3191f6e3b8c77889256 Mon Sep 17 00:00:00 2001 From: Leonwang4234 <62972692+Leonwang4234@users.noreply.github.com> Date: Tue, 20 Oct 2020 15:57:48 -0700 Subject: [PATCH 4/4] resolve conflicts --- core/assets/bundles/bundle.properties | 44 +----------- .../mindustry/world/blocks/defense/Wall.java | 6 +- core/src/mindustry/world/meta/BlockStat.java | 71 ------------------- core/src/mindustry/world/meta/Stat.java | 3 + 4 files changed, 9 insertions(+), 115 deletions(-) delete mode 100644 core/src/mindustry/world/meta/BlockStat.java diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 02632100bb..3e88aef2e1 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -583,47 +583,6 @@ error.crashtitle = An error has occured unit.nobuild = [scarlet]Unit can't build lastaccessed = [lightgray]Last Accessed: {0} block.unknown = [lightgray]??? -blocks.powercapacity = Power Capacity -blocks.powershot = Power/Shot -blocks.damage = Damage -blocks.targetsair = Targets Air -blocks.targetsground = Targets Ground -blocks.itemsmoved = Move Speed -blocks.launchtime = Time Between Launches -blocks.shootrange = Range -blocks.size = Size -blocks.displaysize = Display Size -blocks.liquidcapacity = Liquid Capacity -blocks.powerrange = Power Range -blocks.linkrange = Link Range -blocks.instructions = Instructions -blocks.powerconnections = Max Connections -blocks.poweruse = Power Use -blocks.powerdamage = Power/Damage -blocks.itemcapacity = Item Capacity -blocks.memorycapacity = Memory Capacity -blocks.basepowergeneration = Base Power Generation -blocks.productiontime = Production Time -blocks.repairtime = Block Full Repair Time -blocks.speedincrease = Speed Increase -blocks.range = Range -blocks.drilltier = Drillables -blocks.drillspeed = Base Drill Speed -blocks.boosteffect = Boost Effect -blocks.maxunits = Max Active Units -blocks.health = Health -blocks.buildtime = Build Time -blocks.maxconsecutive = Max Consecutive -blocks.buildcost = Build Cost -blocks.inaccuracy = Inaccuracy -blocks.shots = Shots -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 stat.input = Input stat.output = Output @@ -669,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 diff --git a/core/src/mindustry/world/blocks/defense/Wall.java b/core/src/mindustry/world/blocks/defense/Wall.java index bc99d814cc..a23a2583cd 100644 --- a/core/src/mindustry/world/blocks/defense/Wall.java +++ b/core/src/mindustry/world/blocks/defense/Wall.java @@ -43,10 +43,10 @@ public class Wall extends Block{ public void setStats(){ super.setStats(); - if(chanceDeflect > 0f) stats.add(BlockStat.baseDeflectChance, chanceDeflect, StatUnit.none); + if(chanceDeflect > 0f) stats.add(Stat.baseDeflectChance, chanceDeflect, StatUnit.none); if(lightningChance > 0f){ - stats.add(BlockStat.lightningChance, lightningChance * 100f, StatUnit.percent); - stats.add(BlockStat.lightningDamage, lightningDamage, StatUnit.none); + stats.add(Stat.lightningChance, lightningChance * 100f, StatUnit.percent); + stats.add(Stat.lightningDamage, lightningDamage, StatUnit.none); } } diff --git a/core/src/mindustry/world/meta/BlockStat.java b/core/src/mindustry/world/meta/BlockStat.java deleted file mode 100644 index 5b3e71b14f..0000000000 --- a/core/src/mindustry/world/meta/BlockStat.java +++ /dev/null @@ -1,71 +0,0 @@ -package mindustry.world.meta; - -import arc.*; - -import java.util.*; - -/** Describes one type of stat for a block. */ -public enum BlockStat{ - health(StatCategory.general), - size(StatCategory.general), - displaySize(StatCategory.general), - buildTime(StatCategory.general), - buildCost(StatCategory.general), - memoryCapacity(StatCategory.general), - baseDeflectChance(StatCategory.general), - lightningChance(StatCategory.general), - lightningDamage(StatCategory.general), - - itemCapacity(StatCategory.items), - itemsMoved(StatCategory.items), - launchTime(StatCategory.items), - maxConsecutive(StatCategory.items), - - liquidCapacity(StatCategory.liquids), - - powerCapacity(StatCategory.power), - powerUse(StatCategory.power), - powerDamage(StatCategory.power), - powerRange(StatCategory.power), - powerConnections(StatCategory.power), - basePowerGeneration(StatCategory.power), - - tiles(StatCategory.crafting), - input(StatCategory.crafting), - output(StatCategory.crafting), - productionTime(StatCategory.crafting), - drillTier(StatCategory.crafting), - drillSpeed(StatCategory.crafting), - maxUnits(StatCategory.crafting), - linkRange(StatCategory.crafting), - instructions(StatCategory.crafting), - - speedIncrease(StatCategory.shooting), - repairTime(StatCategory.shooting), - range(StatCategory.shooting), - shootRange(StatCategory.shooting), - inaccuracy(StatCategory.shooting), - shots(StatCategory.shooting), - reload(StatCategory.shooting), - powerShot(StatCategory.shooting), - targetsAir(StatCategory.shooting), - targetsGround(StatCategory.shooting), - damage(StatCategory.shooting), - ammo(StatCategory.shooting), - shieldHealth(StatCategory.shooting), - cooldownTime(StatCategory.shooting), - - booster(StatCategory.optional), - boostEffect(StatCategory.optional), - affinities(StatCategory.optional); - - public final StatCategory category; - - BlockStat(StatCategory category){ - this.category = category; - } - - public String localized(){ - return Core.bundle.get("blocks." + name().toLowerCase(Locale.ROOT)); - } -} diff --git a/core/src/mindustry/world/meta/Stat.java b/core/src/mindustry/world/meta/Stat.java index bb872f98c4..94e4c17b2c 100644 --- a/core/src/mindustry/world/meta/Stat.java +++ b/core/src/mindustry/world/meta/Stat.java @@ -22,6 +22,9 @@ public enum Stat{ buildSpeed, mineSpeed, mineTier, + baseDeflectChance, + lightningChance, + lightningDamage, itemCapacity(StatCat.items), itemsMoved(StatCat.items),