v2.0.0: added a weapon ability for the greataxe

This commit is contained in:
Evan Debenham
2022-12-06 13:41:45 -05:00
parent 31719db813
commit 6bce507669
2 changed files with 44 additions and 0 deletions

View File

@@ -1528,6 +1528,8 @@ items.weapon.melee.gloves.desc=These studded gloves don't provide any real prote
items.weapon.melee.greataxe.name=greataxe
items.weapon.melee.greataxe.stats_desc=This weapon is incredibly heavy.
items.weapon.melee.greataxe.ability_name=execute
items.weapon.melee.greataxe.ability_desc=The Duelist can _execute_ an enemy with a greataxe. This devastating blow is guaranteed to hit and deals +50% damage, but takes twice as long as a regular attack.
items.weapon.melee.greataxe.desc=Meant to be wielded over the shoulder, this titanic axe is as powerful as it is heavy.
items.weapon.melee.greatshield.name=greatshield

View File

@@ -22,7 +22,16 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
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.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback;
public class Greataxe extends MeleeWeapon {
@@ -45,4 +54,37 @@ public class Greataxe extends MeleeWeapon {
return STRReq(tier+1, lvl); //20 base strength req, up from 18
}
@Override
public String targetingPrompt() {
return Messages.get(this, "prompt");
}
@Override
protected void duelistAbility(Hero hero, Integer target) {
if (target == null) {
return;
}
Char enemy = Actor.findChar(target);
if (enemy == null || enemy == hero || hero.isCharmedBy(enemy) || !Dungeon.level.heroFOV[target]) {
GLog.w(Messages.get(this, "ability_no_target"));
return;
}
if (!hero.canAttack(enemy)){
GLog.w(Messages.get(this, "ability_bad_position"));
return;
}
hero.sprite.attack(enemy.pos, new Callback() {
@Override
public void call() {
if (hero.attack(enemy, 1.5f, 0, Char.INFINITE_ACCURACY)){
Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
}
onAbilityUsed(hero);
hero.spendAndNext(2*hero.attackDelay());
}
});
}
}