diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 889a4ad0b..4c3d23e3c 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -959,7 +959,7 @@ items.rings.ringofforce.typical_ability_desc=The Duelist can adopt a _brawler's items.rings.ringofforce.ability_desc=The Duelist can adopt a _brawler's stance_ with this ring, causing her regular attacks to always use this ring even with a weapon equipped. These attacks will deal _%1$d-%2$d damage_ and will also inherit the weapon's enchantment and augmentation. This stance slows weapon recharging speed by 50%%. items.rings.ringofforce.desc=This ring enhances the force of the wearer's melee blows. This extra power is fairly weak when wielding weapons, but an unarmed attack will be made much stronger. A cursed ring will instead weaken the wearer's blows. items.rings.ringofforce$brawlersstance.name=brawler's stance -items.rings.ringofforce$brawlersstance.desc=While in this stance the Duelist's regular attacks will use an equipped ring of force even when she has a weapon equipped. These attacks gain bonus damage and will still use the weapon's augmentation and enchantment.\n\nMaintaining this stance takes focus however, reducing weapon ability recharge speed by 50%.\n\nThis stance can be toggled on or off by using a ring of force. +items.rings.ringofforce$brawlersstance.desc=While in this stance the Duelist's regular attacks will use an equipped ring of force even when she has a weapon equipped. These attacks gain bonus damage and will still use the weapon's augmentation and enchantment.\n\nMaintaining this stance takes focus however, reducing weapon ability recharge speed by 50%.\n\nThis stance can be toggled on or off by using a ring of force, but the reduction in charge speed will persist for a little while if the stance is quickly activated and deactivated. items.rings.ringoffuror.name=ring of furor items.rings.ringoffuror.stats=When worn, this ring will increase the speed of your attacks by _%s%%._ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java index c84d1f170..a3a8456f1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java @@ -176,7 +176,8 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action { } if (hero.belongings.weapon() instanceof MeleeWeapon - && hero.buff(RingOfForce.BrawlersStance.class) == null){ + && (hero.buff(RingOfForce.BrawlersStance.class) == null + || !hero.buff(RingOfForce.BrawlersStance.class).active)){ if (((MeleeWeapon) hero.belongings.weapon()).tier <= 1 && points >= 3){ enGainMulti += 1.20f; } else if (((MeleeWeapon) hero.belongings.weapon()).tier <= 2 && points >= 2){ 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 6c37209ee..563847e1d 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 @@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.utils.Bundle; import java.util.ArrayList; @@ -56,7 +57,7 @@ public class RingOfForce extends Ring { if (super.doUnequip(hero, collect, single)){ if (hero.buff(BrawlersStance.class) != null && hero.buff(Force.class) == null){ //clear brawler's stance if no ring of force is equipped - hero.buff(BrawlersStance.class).detach(); + hero.buff(BrawlersStance.class).active = false; } return true; } else { @@ -81,7 +82,8 @@ public class RingOfForce extends Ring { int level = getBuffedBonus(hero, Force.class); float tier = tier(hero.STR()); int dmg = Char.combatRoll(min(level, tier), max(level, tier)); - if (hero.buff(BrawlersStance.class) != null){ + if (hero.buff(BrawlersStance.class) != null + && hero.buff(BrawlersStance.class).active){ // 1+tier base dmg, roughly +35% dmg // lvl*((3+tier)/8) scaling, roughly +30% dmg dmg += Math.round(1+tier+(level*((3+tier)/8f))); @@ -175,13 +177,17 @@ public class RingOfForce extends Ring { public void execute(Hero hero, String action) { if (action.equals(AC_ABILITY)){ if (hero.buff(BrawlersStance.class) != null){ - hero.buff(BrawlersStance.class).detach(); + if (hero.buff(BrawlersStance.class).active){ + hero.buff(BrawlersStance.class).reset(); + } else { + hero.buff(BrawlersStance.class).active = false; + } AttackIndicator.updateState(); } else if (!isEquipped(hero)) { GLog.w(Messages.get(MeleeWeapon.class, "ability_need_equip")); } else { - Buff.affect(hero, BrawlersStance.class); + Buff.affect(hero, BrawlersStance.class).reset(); AttackIndicator.updateState(); } } else { @@ -218,10 +224,10 @@ public class RingOfForce extends Ring { return false; } BrawlersStance stance = hero.buff(BrawlersStance.class); - if (stance != null){ + if (stance != null && stance.active){ //clear the buff if no ring of force is equipped if (hero.buff(RingOfForce.Force.class) == null){ - stance.detach(); + stance.active = false; AttackIndicator.updateState(); return false; } else { @@ -239,7 +245,7 @@ public class RingOfForce extends Ring { return hero.buff(MonkEnergy.MonkAbility.FlurryEmpowerTracker.class) != null; } BrawlersStance stance = hero.buff(BrawlersStance.class); - if (stance != null){ + if (stance != null && stance.active){ return true; } return false; @@ -251,7 +257,7 @@ public class RingOfForce extends Ring { return false; } BrawlersStance stance = hero.buff(BrawlersStance.class); - if (stance != null){ + if (stance != null && stance.active){ return true; } return false; @@ -264,9 +270,47 @@ public class RingOfForce extends Ring { type = buffType.POSITIVE; } + //buff must be active for at least 50 turns, to discourage micro-managing for max charges + public boolean active; + private int minTurnsLeft; + + public void reset(){ + active = true; + minTurnsLeft = 50; + } + @Override public int icon() { - return BuffIndicator.DUEL_BRAWL; + return active ? BuffIndicator.DUEL_BRAWL : BuffIndicator.NONE; + } + + @Override + public boolean act() { + minTurnsLeft --; + + if (!active && minTurnsLeft <= 0){ + detach(); + } + + spend(TICK); + return true; + } + + public static final String ACTIVE = "active"; + public static final String MIN_TURNS_LEFT = "min_turns_left"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(ACTIVE, active); + bundle.put(MIN_TURNS_LEFT, minTurnsLeft); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + active = bundle.getBoolean(ACTIVE); + minTurnsLeft = bundle.getInt(MIN_TURNS_LEFT); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index e731d2d2a..a63081077 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -478,7 +478,7 @@ public class MeleeWeapon extends Weapon { chargeToGain *= 1.5f; } - //50% slower charge gain with brawler's stance enabled + //50% slower charge gain with brawler's stance enabled, even if buff is inactive if (Dungeon.hero.buff(RingOfForce.BrawlersStance.class) != null){ chargeToGain *= 0.50f; }