diff --git a/core/src/main/assets/interfaces/buffs.png b/core/src/main/assets/interfaces/buffs.png index 27b5b5414..1457fd801 100644 Binary files a/core/src/main/assets/interfaces/buffs.png and b/core/src/main/assets/interfaces/buffs.png differ diff --git a/core/src/main/assets/interfaces/large_buffs.png b/core/src/main/assets/interfaces/large_buffs.png index e1755e116..ffbac1a5e 100644 Binary files a/core/src/main/assets/interfaces/large_buffs.png and b/core/src/main/assets/interfaces/large_buffs.png differ diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 9df265f03..eb490f19c 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1510,6 +1510,9 @@ items.weapon.melee.dirk.desc=A longer thrusting dagger, gives a bit more steel t items.weapon.melee.flail.name=flail items.weapon.melee.flail.stats_desc=This is a rather inaccurate weapon.\nThis weapon cannot surprise attack. +items.weapon.melee.flail.ability_name=spin +items.weapon.melee.flail.spin_warn=You can't spin the flail any more. +items.weapon.melee.flail.ability_desc=The Duelist can _spin_ a flail to build up power for a short time. Each turn the flail is spun it will deal +20% damage, to a max of 3 times. At 3 spins the flail is also guaranteed to hit. Starting to spin the flail costs 2 charges. items.weapon.melee.flail.desc=A spiked ball attached to a handle by a length of chain. Very unwieldy, but devastating if it lands a solid hit. items.weapon.melee.gauntlet.name=stone gauntlet diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Flail.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Flail.java index 272d2fadf..315289538 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Flail.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Flail.java @@ -22,7 +22,18 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.Image; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Bundle; public class Flail extends MeleeWeapon { @@ -41,4 +52,103 @@ public class Flail extends MeleeWeapon { return Math.round(7*(tier+1)) + //35 base, up from 25 lvl*Math.round(1.6f*(tier+1)); //+8 per level, up from +5 } + + @Override + public int damageRoll(Char owner) { + int dmg = super.damageRoll(owner); + + SpinAbilityTracker spin = owner.buff(SpinAbilityTracker.class); + if (spin != null){ + dmg = Math.round(dmg * (1f + 0.2f*spin.spins)); + if (spin.spins == 3) Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); + spin.detach(); + } + + return dmg; + } + + @Override + public float accuracyFactor(Char owner, Char target) { + SpinAbilityTracker spin = owner.buff(SpinAbilityTracker.class); + if (spin != null && spin.spins >= 3f) { + return Float.POSITIVE_INFINITY; + } else { + return super.accuracyFactor(owner, target); + } + } + + @Override + public int abilityChargeUse() { + return (Dungeon.hero.buff(SpinAbilityTracker.class) == null) ? 2 : 0; + } + + @Override + protected void duelistAbility(Hero hero, Integer target) { + + onAbilityUsed(hero); + SpinAbilityTracker spin = hero.buff(SpinAbilityTracker.class); + + if (spin == null){ + spin = Buff.affect(hero, SpinAbilityTracker.class, 3f); + } + + if (spin.spins < 3){ + spin.spins++; + Buff.prolong(hero, SpinAbilityTracker.class, 3f); + Sample.INSTANCE.play(Assets.Sounds.CHAINS, 1, 1, 0.9f + 0.1f*spin.spins); + hero.sprite.operate(hero.pos); + hero.spendAndNext(hero.attackDelay()); + BuffIndicator.refreshHero(); + } else { + GLog.w(Messages.get(this, "spin_warn")); + } + } + + public static class SpinAbilityTracker extends FlavourBuff { + + { + type = buffType.POSITIVE; + } + + public int spins = 0; + + @Override + public int icon() { + return BuffIndicator.DUEL_SPIN; + } + + @Override + public void tintIcon(Image icon) { + switch (spins){ + case 1: default: + icon.hardlight(0, 1, 0); + break; + case 2: + icon.hardlight(1, 1, 0); + break; + case 3: + icon.hardlight(1, 0, 0); + break; + } + } + + @Override + public float iconFadePercent() { + return Math.max(0, (3 - visualcooldown()) / 3); + } + + public static String SPINS = "spins"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(SPINS, spins); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + spins = bundle.getInt(SPINS); + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java index 94024b449..8295f4f84 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -113,6 +113,7 @@ public class BuffIndicator extends Component { public static final int AMULET = 59; public static final int DUEL_CLEAVE = 60; public static final int DUEL_GUARD = 61; + public static final int DUEL_SPIN = 62; public static final int SIZE_SMALL = 7; public static final int SIZE_LARGE = 16;