diff --git a/core/src/main/assets/interfaces/buffs.png b/core/src/main/assets/interfaces/buffs.png index 624d56214..3c9b04502 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 4121675ca..f84f75b1d 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 13ba744ea..88769e045 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1680,6 +1680,8 @@ items.weapon.melee.sai.stats_desc=This is a very fast weapon. items.weapon.melee.sai.ability_name=combo strike items.weapon.melee.sai.ability_desc=The Duelist can perform a _combo strike_ with sai. This attack is guaranteed to hit and deals +35% damage for each time the Duelist has already successfully attacked with melee or thrown weapons in the last 5 turns. items.weapon.melee.sai.desc=Two thin blades meant to be wielded in one hand each. Excellent for tearing down enemies with a flurry of cuts. +items.weapon.melee.sai$combostriketracker.name=combo strike +items.weapon.melee.sai$combostriketracker.desc=The duelist is building combo that can be used to increase the damage of the combo strike ability. Each strike made with a melee or thrown weapon in the last 5 turns will count.\n\nRecent hits: %d. items.weapon.melee.scimitar.name=scimitar items.weapon.melee.scimitar.stats_desc=This is a rather fast weapon. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 2d62bb820..cd906fb6c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -458,7 +458,7 @@ public class Hero extends Char { } if (hit && heroClass == HeroClass.DUELIST && wasEnemy){ - Buff.append( this, Sai.ComboStrikeTracker.class, Sai.ComboStrikeTracker.DURATION); + Buff.append( this, Sai.ComboStrikeTracker.class).addHit(); } return hit; @@ -2023,7 +2023,7 @@ public class Hero extends Char { } if (hit && heroClass == HeroClass.DUELIST && wasEnemy){ - Buff.append( this, Sai.ComboStrikeTracker.class, Sai.ComboStrikeTracker.DURATION); + Buff.affect( this, Sai.ComboStrikeTracker.class).addHit(); } RingOfForce.BrawlersStance brawlStance = buff(RingOfForce.BrawlersStance.class); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java index df2d51dab..13a443714 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java @@ -32,8 +32,10 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; 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.noosa.audio.Sample; +import com.watabou.utils.Bundle; import com.watabou.utils.Callback; import java.util.HashSet; @@ -90,10 +92,11 @@ public class Sai extends MeleeWeapon { wep.beforeAbilityUsed(hero); AttackIndicator.target(enemy); - HashSet buffs = hero.buffs(ComboStrikeTracker.class); - int recentHits = buffs.size(); - for (Buff b : buffs){ - b.detach(); + int recentHits = 0; + ComboStrikeTracker buff = hero.buff(ComboStrikeTracker.class); + if (buff != null){ + recentHits = buff.totalHits(); + buff.detach(); } boolean hit = hero.attack(enemy, 1f + boostPerHit*recentHits, 0, Char.INFINITE_ACCURACY); @@ -112,10 +115,89 @@ public class Sai extends MeleeWeapon { }); } - public static class ComboStrikeTracker extends FlavourBuff{ + public static class ComboStrikeTracker extends Buff { - public static float DURATION = 5f; + { + type = buffType.POSITIVE; + } + public static int DURATION = 6; //to account for the turn the attack is made in + public int[] hits = new int[DURATION]; + + @Override + public int icon() { + //pre-v2.1 saves + if (totalHits() == 0) return BuffIndicator.NONE; + + if (Dungeon.hero.belongings.weapon() instanceof Gloves + || Dungeon.hero.belongings.weapon() instanceof Sai + || Dungeon.hero.belongings.weapon() instanceof Gauntlet + || Dungeon.hero.belongings.secondWep() instanceof Gloves + || Dungeon.hero.belongings.secondWep() instanceof Sai + || Dungeon.hero.belongings.secondWep() instanceof Gauntlet) { + return BuffIndicator.DUEL_COMBO; + } else { + return BuffIndicator.NONE; + } + } + + @Override + public boolean act() { + + //shuffle all hits down one turn + for (int i = 0; i < DURATION; i++){ + if (i == DURATION-1){ + hits[i] = 0; + } else { + hits[i] = hits[i+1]; + } + } + + if (totalHits() == 0){ + detach(); + } + + spend(TICK); + return true; + } + + public void addHit(){ + hits[DURATION-1]++; + } + + public int totalHits(){ + int sum = 0; + for (int i = 0; i < DURATION; i++){ + sum += hits[i]; + } + return sum; + } + + @Override + public String iconTextDisplay() { + return Integer.toString(totalHits()); + } + + @Override + public String desc() { + return Messages.get(this, "desc", totalHits()); + } + + public static String RECENT_HITS = "recent_hits"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(RECENT_HITS, hits); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + if (bundle.contains(RECENT_HITS)) { + hits = bundle.getIntArray(RECENT_HITS); + } + } } } 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 aa9cc550d..3e2bb4664 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -120,6 +120,7 @@ public class BuffIndicator extends Component { public static final int DUEL_XBOW = 66; public static final int CHALLENGE = 67; public static final int MONK_ENERGY = 68; + public static final int DUEL_COMBO = 69; public static final int SIZE_SMALL = 7; public static final int SIZE_LARGE = 16;