From 5157b833940b72e267a86fba28d7b84b014964c1 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 7 Dec 2018 22:43:26 -0500 Subject: [PATCH] v0.7.1: corrected inconsistencies with ring description logic --- .../shatteredpixeldungeon/items/rings/Ring.java | 16 ++++++++++++---- .../items/rings/RingOfAccuracy.java | 14 +++++--------- .../items/rings/RingOfElements.java | 14 +++++--------- .../items/rings/RingOfEnergy.java | 14 +++++--------- .../items/rings/RingOfEvasion.java | 14 +++++--------- .../items/rings/RingOfForce.java | 16 ++++++---------- .../items/rings/RingOfFuror.java | 14 +++++--------- .../items/rings/RingOfHaste.java | 14 +++++--------- .../items/rings/RingOfMight.java | 14 +++++--------- .../items/rings/RingOfSharpshooting.java | 14 +++++--------- .../items/rings/RingOfTenacity.java | 14 +++++--------- .../items/rings/RingOfWealth.java | 14 +++++--------- 12 files changed, 68 insertions(+), 104 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java index 6f555384d..190c3f366 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java @@ -155,10 +155,10 @@ public class Ring extends KindofMisc { } @Override - public String desc() { - + public String info(){ + String desc = isKnown() ? super.desc() : Messages.get(this, "unknown_desc"); - + if (cursed && isEquipped( Dungeon.hero )) { desc += "\n\n" + Messages.get(Ring.class, "cursed_worn"); @@ -169,10 +169,18 @@ public class Ring extends KindofMisc { desc += "\n\n" + Messages.get(Ring.class, "not_cursed"); } - + + if (isKnown()) { + desc += "\n\n" + statsInfo(); + } + return desc; } + protected String statsInfo(){ + return ""; + } + @Override public Item upgrade() { super.upgrade(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java index eda10568e..4600fbd50 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java @@ -28,16 +28,12 @@ import java.text.DecimalFormat; public class RingOfAccuracy extends Ring { - public String info() { - String desc = desc(); - if (isKnown()){ - if (isIdentified()){ - desc += "\n\n" + Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.3f, soloBonus()) - 1f))); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(30f)); - } + public String statsInfo() { + if (isIdentified()){ + return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.3f, soloBonus()) - 1f))); + } else { + return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(30f)); } - return desc; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java index c0b7574cd..7c9401dea 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java @@ -46,16 +46,12 @@ import java.util.HashSet; public class RingOfElements extends Ring { - public String info() { - String desc = desc(); - if (isKnown()){ - if (isIdentified()){ - desc += "\n\n" + Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (1f - Math.pow(0.875f, soloBonus())))); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(12.5f)); - } + public String statsInfo() { + if (isIdentified()){ + return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (1f - Math.pow(0.875f, soloBonus())))); + } else { + return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(12.5f)); } - return desc; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEnergy.java index 69f4fead2..40e62bfe8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEnergy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEnergy.java @@ -28,16 +28,12 @@ import java.text.DecimalFormat; public class RingOfEnergy extends Ring { - public String info() { - String desc = desc(); - if (isKnown()){ - if (isIdentified()){ - desc += "\n\n" + Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.2f, soloBonus()) - 1f))); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(20f)); - } + public String statsInfo() { + if (isIdentified()){ + return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.2f, soloBonus()) - 1f))); + } else { + return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(20f)); } - return desc; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java index bda827a34..292afecb7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java @@ -28,16 +28,12 @@ import java.text.DecimalFormat; public class RingOfEvasion extends Ring { - public String info() { - String desc = desc(); - if (isKnown()){ - if (isIdentified()){ - desc += "\n\n" + Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.15f, soloBonus()) - 1f))); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(15f)); - } + public String statsInfo() { + if (isIdentified()){ + return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.15f, soloBonus()) - 1f))); + } else { + return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(15f)); } - return desc; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java index d4ef9c7b4..a6e45a0d0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java @@ -78,17 +78,13 @@ public class RingOfForce extends Ring { } @Override - public String desc() { - String desc = super.desc(); - if (isKnown()) { - float tier = tier(Dungeon.hero.STR()); - if (isIdentified()) { - desc += "\n\n" + Messages.get(this, "stats", min(soloBonus(), tier), max(soloBonus(), tier)); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", min(1, tier), max(1, tier)); - } + public String statsInfo() { + float tier = tier(Dungeon.hero.STR()); + if (isIdentified()) { + return Messages.get(this, "stats", min(soloBonus(), tier), max(soloBonus(), tier)); + } else { + return Messages.get(this, "typical_stats", min(1, tier), max(1, tier)); } - return desc; } public class Force extends RingBuff { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java index e7ae90aae..bc66bd026 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java @@ -28,16 +28,12 @@ import java.text.DecimalFormat; public class RingOfFuror extends Ring { - public String info() { - String desc = desc(); - if (isKnown()){ - if (isIdentified()){ - desc += "\n\n" + Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.105f, soloBonus()) - 1f))); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(10.5f)); - } + public String statsInfo() { + if (isIdentified()){ + return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.105f, soloBonus()) - 1f))); + } else { + return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(10.5f)); } - return desc; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java index f468064ca..96ebd6a7e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java @@ -28,16 +28,12 @@ import java.text.DecimalFormat; public class RingOfHaste extends Ring { - public String info() { - String desc = desc(); - if (isKnown()){ - if (isIdentified()){ - desc += "\n\n" + Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.2f, soloBonus()) - 1f))); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(20f)); - } + public String statsInfo() { + if (isIdentified()){ + return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.2f, soloBonus()) - 1f))); + } else { + return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(20f)); } - return desc; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java index c72be91e0..347119b03 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java @@ -70,16 +70,12 @@ public class RingOfMight extends Ring { } } - public String info() { - String desc = desc(); - if (isKnown()){ - if (isIdentified()){ - desc += "\n\n" + Messages.get(this, "stats", soloBonus(), new DecimalFormat("#.##").format(100f * (Math.pow(1.035, soloBonus()) - 1f))); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", 1, new DecimalFormat("#.##").format(3.5f)); - } + public String statsInfo() { + if (isIdentified()){ + return Messages.get(this, "stats", soloBonus(), new DecimalFormat("#.##").format(100f * (Math.pow(1.035, soloBonus()) - 1f))); + } else { + return Messages.get(this, "typical_stats", 1, new DecimalFormat("#.##").format(3.5f)); } - return desc; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java index 92da96c79..b3d0bff73 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java @@ -28,16 +28,12 @@ import java.text.DecimalFormat; public class RingOfSharpshooting extends Ring { - public String info() { - String desc = desc(); - if (isKnown()){ - if (isIdentified()){ - desc += "\n\n" + Messages.get(this, "stats", soloBonus(), new DecimalFormat("#.##").format(100f * (Math.pow(1.2, soloBonus()) - 1f))); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", 1, new DecimalFormat("#.##").format(20f)); - } + public String statsInfo() { + if (isIdentified()){ + return Messages.get(this, "stats", soloBonus(), new DecimalFormat("#.##").format(100f * (Math.pow(1.2, soloBonus()) - 1f))); + } else { + return Messages.get(this, "typical_stats", 1, new DecimalFormat("#.##").format(20f)); } - return desc; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java index 907032bea..6ef0721e3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java @@ -28,16 +28,12 @@ import java.text.DecimalFormat; public class RingOfTenacity extends Ring { - public String info() { - String desc = desc(); - if (isKnown()){ - if (isIdentified()){ - desc += "\n\n" + Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (1f - Math.pow(0.85f, soloBonus())))); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(15f)); - } + public String statsInfo() { + if (isIdentified()){ + return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (1f - Math.pow(0.85f, soloBonus())))); + } else { + return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(15f)); } - return desc; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java index c549507b7..4ea0165ac 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java @@ -38,16 +38,12 @@ public class RingOfWealth extends Ring { private float triesToDrop = 0; - public String info() { - String desc = desc(); - if (isKnown()){ - if (isIdentified()){ - desc += "\n\n" + Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.15f, soloBonus()) - 1f))); - } else { - desc += "\n\n" + Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(15f)); - } + public String statsInfo() { + if (isIdentified()){ + return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (Math.pow(1.15f, soloBonus()) - 1f))); + } else { + return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(15f)); } - return desc; } @Override