From b7f2b29554454fe419157c2ac6314de7d4912434 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 11 Feb 2021 22:48:55 -0500 Subject: [PATCH] v0.9.2: tweaked wand of regrowth charge limit and added it to desc --- .../assets/messages/items/items.properties | 1 + .../items/wands/WandOfRegrowth.java | 27 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index e0c57c54b..1f17098d4 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1222,6 +1222,7 @@ items.wands.wandofregrowth.name=wand of regrowth items.wands.wandofregrowth.staff_name=staff of regrowth items.wands.wandofregrowth.desc=This wand is made from a thin shaft of expertly carved wood. Somehow it is still alive and vibrant, bright green like a young tree's core. "When life ceases new life always begins to grow... The eternal cycle always remains!" items.wands.wandofregrowth.stats_desc=When used, this wand will blast magical regrowth energy outward in a cone, causing grass, roots, and rare plants to spring to life. Its next zap will consume _%1$d charges_. The more charges the wand uses, the larger and stronger the effect. +items.wands.wandofregrowth.degradation=After another _%d charges_ this wand will start failing to produce plants and fresh grass. This limit is increased by levelling up or upgrading the wand. items.wands.wandofregrowth.bmage_desc=When _the Battlemage_ strikes an enemy with a staff of regrowth, and either are standing on grass, the Battlemage will gain herbal healing in proportion with the damage dealt. items.wands.wandofregrowth$dewcatcher.name=Dewcatcher items.wands.wandofregrowth$dewcatcher.desc=Dewcatchers are wondrous plants that fill themselves with magical dew. They attempt to camouflage as grass to avoid attention, but their bulges of collected dew give them away. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java index 598de5552..eb3e558e8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java @@ -62,6 +62,7 @@ public class WandOfRegrowth extends Wand { } private int totChrgUsed = 0; + private int chargesOverLimit = 0; ConeAOE cone; int target; @@ -81,8 +82,10 @@ public class WandOfRegrowth extends Wand { ArrayList cells = new ArrayList<>(cone.cells); - int overLimit = totChrgUsed - chargeLimit(Dungeon.hero.lvl); - float furrowedChance = overLimit > 0 ? (overLimit / (10f + Dungeon.hero.lvl)) : 0; + float furrowedChance = 0; + if (totChrgUsed >= chargeLimit(Dungeon.hero.lvl)){ + furrowedChance = (chargesOverLimit+1)/5f; + } int chrgUsed = chargesPerCast(); int grassToPlace = Math.round((3.67f+buffedLvl()/3f)*chrgUsed); @@ -175,9 +178,17 @@ public class WandOfRegrowth extends Wand { grassToPlace--; } - if (furrowedChance < 1f) { + if (totChrgUsed < chargeLimit(Dungeon.hero.lvl)) { + chargesOverLimit = 0; totChrgUsed += chrgUsed; + if (totChrgUsed > chargeLimit(Dungeon.hero.lvl)){ + chargesOverLimit = totChrgUsed - chargeLimit(Dungeon.hero.lvl); + totChrgUsed = chargeLimit(Dungeon.hero.lvl); + } + } else { + chargesOverLimit += chrgUsed; } + } private int chargeLimit( int heroLvl ){ @@ -254,7 +265,12 @@ public class WandOfRegrowth extends Wand { @Override public String statsDesc() { - return Messages.get(this, "stats_desc", chargesPerCast()); + String desc = Messages.get(this, "stats_desc", chargesPerCast()); + if (isIdentified()){ + int chargeLeft = chargeLimit(Dungeon.hero.lvl) - totChrgUsed; + if (chargeLeft < 10000) desc += " " + Messages.get(this, "degradation", Math.max(chargeLeft, 0)); + } + return desc; } @Override @@ -270,17 +286,20 @@ public class WandOfRegrowth extends Wand { } private static final String TOTAL = "totChrgUsed"; + private static final String OVER = "chargesOverLimit"; @Override public void storeInBundle(Bundle bundle) { super.storeInBundle(bundle); bundle.put( TOTAL, totChrgUsed ); + bundle.put( OVER, chargesOverLimit); } @Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); totChrgUsed = bundle.getInt(TOTAL); + chargesOverLimit = bundle.getInt(OVER); } public static class Dewcatcher extends Plant{