v2.0.0: implemented a weapon ability for the whip
This commit is contained in:
@@ -1654,6 +1654,8 @@ items.weapon.melee.warhammer.desc=Few creatures can withstand the crushing blow
|
|||||||
|
|
||||||
items.weapon.melee.whip.name=whip
|
items.weapon.melee.whip.name=whip
|
||||||
items.weapon.melee.whip.stats_desc=This weapon has tremendous reach.
|
items.weapon.melee.whip.stats_desc=This weapon has tremendous reach.
|
||||||
|
items.weapon.melee.whip.ability_name=lash
|
||||||
|
items.weapon.melee.whip.ability_desc=The Duelist can _lash_ all enemies around her with a whip. This ability performs a normal attack against all enemies currently within attack range.
|
||||||
items.weapon.melee.whip.desc=While the barbed length of rope at the end of this weapon deals poor damage, its reach cannot be matched.
|
items.weapon.melee.whip.desc=While the barbed length of rope at the end of this weapon deals poor damage, its reach cannot be matched.
|
||||||
|
|
||||||
items.weapon.melee.wornshortsword.name=worn shortsword
|
items.weapon.melee.wornshortsword.name=worn shortsword
|
||||||
|
|||||||
+44
@@ -22,7 +22,19 @@
|
|||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
import com.watabou.utils.Callback;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Whip extends MeleeWeapon {
|
public class Whip extends MeleeWeapon {
|
||||||
|
|
||||||
@@ -41,4 +53,36 @@ public class Whip extends MeleeWeapon {
|
|||||||
lvl*(tier); //+3 per level, down from +4
|
lvl*(tier); //+3 per level, down from +4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void duelistAbility(Hero hero, Integer target) {
|
||||||
|
|
||||||
|
ArrayList<Char> targets = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Char ch : Actor.chars()){
|
||||||
|
if (ch.alignment == Char.Alignment.ENEMY
|
||||||
|
&& !hero.isCharmedBy(ch)
|
||||||
|
&& Dungeon.level.heroFOV[ch.pos]
|
||||||
|
&& hero.canAttack(ch)){
|
||||||
|
targets.add(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targets.isEmpty()) {
|
||||||
|
GLog.w(Messages.get(this, "ability_no_target"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throwSound();
|
||||||
|
hero.sprite.attack(hero.pos, new Callback() {
|
||||||
|
@Override
|
||||||
|
public void call() {
|
||||||
|
for (Char ch : targets) {
|
||||||
|
hero.attack(ch);
|
||||||
|
}
|
||||||
|
hero.spendAndNext(hero.attackDelay());
|
||||||
|
onAbilityUsed(hero);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user