v2.0.0: gave the glaive the spear's spike ability
This commit is contained in:
@@ -1516,6 +1516,8 @@ items.weapon.melee.gauntlet.desc=This massive gauntlet is made of crimson fabric
|
||||
|
||||
items.weapon.melee.glaive.name=glaive
|
||||
items.weapon.melee.glaive.stats_desc=This is a rather slow weapon.\nThis weapon has extra reach.
|
||||
items.weapon.melee.glaive.ability_name=spike
|
||||
items.weapon.melee.glaive.ability_desc=The duelist can use the tip of a glaive to _spike_ an enemy that is in range but not adjacent. This deals -33% damage, but knocks the enemy back and is guaranteed to hit.
|
||||
items.weapon.melee.glaive.desc=A massive polearm consisting of a sword blade on the end of a pole.
|
||||
|
||||
items.weapon.melee.gloves.name=studded gloves
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class Glaive extends MeleeWeapon {
|
||||
@@ -42,4 +44,14 @@ public class Glaive extends MeleeWeapon {
|
||||
lvl*Math.round(1.33f*(tier+1)); //+8 per level, up from +6
|
||||
}
|
||||
|
||||
@Override
|
||||
public String targetingPrompt() {
|
||||
return Messages.get(this, "prompt");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void duelistAbility(Hero hero, Integer target) {
|
||||
Spear.spikeAbility(hero, target, 0.67f, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -122,6 +122,11 @@ public class MeleeWeapon extends Weapon {
|
||||
return targetingPrompt() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int targetingPos(Hero user, int dst) {
|
||||
return dst; //weapon abilities do not use projectile logic, no autoaim
|
||||
}
|
||||
|
||||
//TODO make abstract
|
||||
protected void duelistAbility( Hero hero, Integer target ){}
|
||||
|
||||
|
||||
@@ -62,26 +62,30 @@ public class Spear extends MeleeWeapon {
|
||||
|
||||
@Override
|
||||
protected void duelistAbility(Hero hero, Integer target) {
|
||||
Spear.spikeAbility(hero, target, 0.75f, this);
|
||||
}
|
||||
|
||||
public static void spikeAbility(Hero hero, Integer target, float dmgMulti, MeleeWeapon wep){
|
||||
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"));
|
||||
GLog.w(Messages.get(wep, "ability_no_target"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hero.canAttack(enemy) || Dungeon.level.adjacent(hero.pos, enemy.pos)){
|
||||
GLog.w(Messages.get(this, "ability_bad_position"));
|
||||
GLog.w(Messages.get(wep, "ability_bad_position"));
|
||||
return;
|
||||
}
|
||||
|
||||
hero.sprite.attack(enemy.pos, new Callback() {
|
||||
@Override
|
||||
public void call() {
|
||||
hero.attack(enemy, 0.75f, 0, Char.INFINITE_ACCURACY);
|
||||
onAbilityUsed(hero);
|
||||
hero.attack(enemy, dmgMulti, 0, Char.INFINITE_ACCURACY);
|
||||
wep.onAbilityUsed(hero);
|
||||
Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
|
||||
|
||||
if (enemy.isAlive()){
|
||||
@@ -95,7 +99,6 @@ public class Spear extends MeleeWeapon {
|
||||
hero.spendAndNext(hero.attackDelay());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user