v2.1.0: combo strike now has a visible buff icon

This commit is contained in:
Evan Debenham
2023-05-05 17:55:47 -04:00
parent f5371ae83f
commit daf129ab92
6 changed files with 93 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -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.

View File

@@ -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);

View File

@@ -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<ComboStrikeTracker> 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);
}
}
}
}

View File

@@ -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;