v2.0.0: added a duelist ability for the spear
This commit is contained in:
@@ -1604,6 +1604,8 @@ items.weapon.melee.scimitar.desc=A thick curved blade. Its shape allows for fast
|
|||||||
|
|
||||||
items.weapon.melee.spear.name=spear
|
items.weapon.melee.spear.name=spear
|
||||||
items.weapon.melee.spear.stats_desc=This is a rather slow weapon.\nThis weapon has extra reach.
|
items.weapon.melee.spear.stats_desc=This is a rather slow weapon.\nThis weapon has extra reach.
|
||||||
|
items.weapon.melee.spear.ability_name=spike
|
||||||
|
items.weapon.melee.spear.ability_desc=The duelist can use the tip of a spear to _spike_ an enemy that is in range but not adjacent. This deals -25% damage, but knocks the enemy back and is guaranteed to hit.
|
||||||
items.weapon.melee.spear.desc=A slender wooden rod tipped with sharpened iron.
|
items.weapon.melee.spear.desc=A slender wooden rod tipped with sharpened iron.
|
||||||
|
|
||||||
items.weapon.melee.sword.name=sword
|
items.weapon.melee.sword.name=sword
|
||||||
|
|||||||
-2
@@ -117,7 +117,5 @@ public class Rapier extends MeleeWeapon {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
super.duelistAbility(hero, target);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+56
@@ -22,7 +22,20 @@
|
|||||||
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.Vertigo;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||||
|
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;
|
||||||
|
|
||||||
public class Spear extends MeleeWeapon {
|
public class Spear extends MeleeWeapon {
|
||||||
|
|
||||||
@@ -42,4 +55,47 @@ public class Spear extends MeleeWeapon {
|
|||||||
lvl*Math.round(1.33f*(tier+1)); //+4 per level, up from +3
|
lvl*Math.round(1.33f*(tier+1)); //+4 per level, up from +3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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) || Dungeon.level.adjacent(hero.pos, enemy.pos)){
|
||||||
|
GLog.w(Messages.get(this, "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);
|
||||||
|
Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
|
||||||
|
|
||||||
|
if (enemy.isAlive()){
|
||||||
|
//trace a ballistica to our target (which will also extend past them
|
||||||
|
Ballistica trajectory = new Ballistica(hero.pos, enemy.pos, Ballistica.STOP_TARGET);
|
||||||
|
//trim it to just be the part that goes past them
|
||||||
|
trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE);
|
||||||
|
//knock them back along that ballistica
|
||||||
|
WandOfBlastWave.throwChar(enemy, trajectory, 1, true, false, hero.getClass());
|
||||||
|
}
|
||||||
|
hero.spendAndNext(hero.attackDelay());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user