diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Badges.java b/src/com/shatteredpixel/shatteredpixeldungeon/Badges.java index 919b7631f..fad78b96d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Badges.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Badges.java @@ -716,7 +716,7 @@ public class Badges { } public static void validateMasteryCombo( int n ) { - if (!local.contains( Badge.MASTERY_COMBO ) && n == 7) { + if (!local.contains( Badge.MASTERY_COMBO ) && n == 10) { Badge badge = Badge.MASTERY_COMBO; local.add( badge ); displayBadge( badge ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java index da84499e5..6274faff2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java @@ -21,14 +21,23 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; import com.shatteredpixel.shatteredpixeldungeon.Badges; -import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.Image; +import com.watabou.utils.Bundle; -public class Combo extends Buff { +public class Combo extends Buff implements ActionIndicator.Action { - public int count = 0; + private int count = 0; + private float comboTime = 0f; + private int misses = 0; @Override public int icon() { @@ -40,37 +49,87 @@ public class Combo extends Buff { return Messages.get(this, "name"); } - public int hit( Char enemy, int damage ) { + public void hit() { count++; + comboTime = 3f; + misses = 0; - if (count >= 3) { - + if (count >= 2) { + + ActionIndicator.setAction( this ); Badges.validateMasteryCombo( count ); - + GLog.p( Messages.get(this, "combo", count) ); - postpone( 1.41f - count / 10f ); - return (int)(damage * (count - 2) / 5f); - - } else { - - postpone( 1.1f ); - return 0; } + } - + + public void miss(){ + misses++; + if (misses >= 2){ + detach(); + } + } + + @Override + public void detach() { + super.detach(); + ActionIndicator.clearAction(this); + } + @Override public boolean act() { - detach(); + comboTime-=TICK; + spend(TICK); + if (comboTime <= 0) { + detach(); + } return true; } @Override public String desc() { - return Messages.get(this, "desc") + - (count <= 2 ? - Messages.get(this, "notenough") : - Messages.get(this, "bonusdmg", ((count - 2) * 20f))); + return Messages.get(this, "desc"); + } + + private static final String COUNT = "count"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(COUNT, count); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + count = bundle.getInt( COUNT ); + if (count >= 2) ActionIndicator.setAction(this); + } + + @Override + public Image getIcon() { + Image icon; + if (((Hero)target).belongings.weapon != null){ + icon = new ItemSprite(Dungeon.hero.belongings.weapon); + } else { + icon = new ItemSprite(new Item(){ {image = ItemSpriteSheet.WEAPON; }}); + } + + if (count >= 10) icon.tint(0xFFFF0000); + else if (count >= 8)icon.tint(0xFFFFCC00); + else if (count >= 6)icon.tint(0xFFFFFF00); + else if (count >= 4)icon.tint(0xFFCCFF00); + else icon.tint(0xFF00FF00); + + return icon; + } + + @Override + public void doAction() { + ActionIndicator.clearAction(this); + //TODO } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 891b4a227..a947aeb4d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -78,7 +78,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; @@ -845,11 +844,6 @@ public class Hero extends Char { if (wep != null) wep.proc( this, enemy, damage ); switch (subClass) { - case GLADIATOR: - if (wep instanceof MeleeWeapon || wep == null) { - damage += Buff.affect( this, Combo.class ).hit( enemy, damage ); - } - break; case SNIPER: if (rangedWeapon != null) { Buff.prolong( this, SnipersMark.class, attackDelay() * 1.1f ).object = enemy.id(); @@ -1330,7 +1324,17 @@ public class Hero extends Char { AttackIndicator.target(enemy); - attack( enemy ); + boolean hit = attack( enemy ); + + if (subClass == HeroSubClass.GLADIATOR){ + if (hit) { + Buff.affect( this, Combo.class ).hit(); + } else { + Combo combo = buff(Combo.class); + if (combo != null) combo.miss(); + } + } + curAction = null; Invisibility.dispel(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 7fc2d18fe..d296bf8bb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Combo; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SnipersMark; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; @@ -131,6 +132,9 @@ public class Item implements Bundlable { curUser = hero; curItem = this; + + Combo combo = hero.buff(Combo.class); + if (combo != null) combo.detach(); if (action.equals( AC_DROP )) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties b/src/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties index e0d9537e5..9177d92a7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties +++ b/src/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties @@ -76,9 +76,7 @@ actors.buffs.chill.desc=Not quite frozen, but still much too cold.\n\nChilled ta actors.buffs.combo.name=Combo actors.buffs.combo.combo=%d hit combo! -actors.buffs.combo.desc=Through building momentum, the gladiator deals bonus damage.\n\nYour combo will keep building with quick attacks. The higher your combo gets, the faster your attacks will need to be. Failing to land a hit quickly enough will reset the combo. -actors.buffs.combo.notenough=\n\nYour combo has not built up enough to give you bonus damage yet. -actors.buffs.combo.bonusdmg=\n\nCurrent combo bonus damage: %f%%. +actors.buffs.combo.desc=TODO actors.buffs.corruption.name=Corrupted actors.buffs.corruption.desc=Corruption seeps into the essence of a being, twisting them against their former nature.\n\nCorrupted creatures will attack and aggravate their allies, and ignore their former enemies. Corruption is damaging as well, and will slowly cause its target to succumb.\n\nCorruption is permanent, its effects only end in death. diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties b/src/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties index ff476b7a2..dd69333d0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties +++ b/src/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties @@ -49,7 +49,7 @@ badges$badge.item_level_4=Item of level 12 acquired badges$badge.rare=All rare monsters slain badges$badge.victory=Amulet of Yendor obtained badges$badge.victory_all_classes=Amulet of Yendor obtained by Warrior, Mage, Rogue & Huntress -badges$badge.mastery_combo=7-hit combo +badges$badge.mastery_combo=10-hit combo badges$badge.potions_cooked_1=3 potions cooked badges$badge.potions_cooked_2=6 potions cooked badges$badge.potions_cooked_3=9 potions cooked @@ -85,4 +85,4 @@ journal$feature.wandmaker=Old wandmaker journal$feature.troll=Troll blacksmith journal$feature.imp=Ambitious imp -rankings$record.something=Killed by Something \ No newline at end of file +rankings$record.something=Killed by Something diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ActionIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ActionIndicator.java index 20888278c..5363f7f2c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ActionIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ActionIndicator.java @@ -70,8 +70,9 @@ public class ActionIndicator extends Tag { updateIcon(); } - public static void clearAction(){ - action = null; + public static void clearAction(Action action){ + if (ActionIndicator.action == action) + ActionIndicator.action = null; } public static void updateIcon(){