v2.0.0: added a weapon ability for the flail

This commit is contained in:
Evan Debenham
2022-12-07 16:26:28 -05:00
parent 0032a92b19
commit 69be76c7cf
5 changed files with 114 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

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

View File

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

View File

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