v2.0.0: the rapier can now lunge out of the hero's FOV
This commit is contained in:
+31
-21
@@ -72,22 +72,25 @@ public class Rapier extends MeleeWeapon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Char enemy = Actor.findChar(target);
|
Char enemy = Actor.findChar(target);
|
||||||
if (enemy == null || enemy == hero || hero.isCharmedBy(enemy) || !Dungeon.level.heroFOV[target]){
|
//duelist can lunge out of her FOV, but this wastes the ability instead of cancelling if there is no target
|
||||||
GLog.w(Messages.get(this, "ability_no_target"));
|
if (Dungeon.level.heroFOV[target]) {
|
||||||
return;
|
if (enemy == null || enemy == hero || hero.isCharmedBy(enemy)) {
|
||||||
|
GLog.w(Messages.get(this, "ability_no_target"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dungeon.level.distance(hero.pos, enemy.pos) != 2){
|
if (Dungeon.level.distance(hero.pos, target) != 2){
|
||||||
GLog.w(Messages.get(this, "ability_bad_position"));
|
GLog.w(Messages.get(this, "ability_bad_position"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lungeCell = -1;
|
int lungeCell = -1;
|
||||||
for (int i : PathFinder.NEIGHBOURS8){
|
for (int i : PathFinder.NEIGHBOURS8){
|
||||||
if (Dungeon.level.adjacent(hero.pos + i, enemy.pos)
|
if (Dungeon.level.adjacent(hero.pos + i, target)
|
||||||
&& Actor.findChar(hero.pos+i) == null
|
&& Actor.findChar(hero.pos+i) == null
|
||||||
&& Dungeon.level.passable[hero.pos+i]){
|
&& Dungeon.level.passable[hero.pos+i]){
|
||||||
if (lungeCell == -1 || Dungeon.level.trueDistance(hero.pos + i, enemy.pos) < Dungeon.level.trueDistance(lungeCell, enemy.pos)){
|
if (lungeCell == -1 || Dungeon.level.trueDistance(hero.pos + i, target) < Dungeon.level.trueDistance(lungeCell, target)){
|
||||||
lungeCell = hero.pos + i;
|
lungeCell = hero.pos + i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,23 +113,30 @@ public class Rapier extends MeleeWeapon {
|
|||||||
hero.pos = dest;
|
hero.pos = dest;
|
||||||
Dungeon.level.occupyCell(hero);
|
Dungeon.level.occupyCell(hero);
|
||||||
|
|
||||||
hero.sprite.attack(enemy.pos, new Callback() {
|
if (enemy != null) {
|
||||||
@Override
|
hero.sprite.attack(enemy.pos, new Callback() {
|
||||||
public void call() {
|
@Override
|
||||||
//+3+lvl damage, equivalent to +67% damage, but more consistent
|
public void call() {
|
||||||
beforeAbilityUsed(hero);
|
//+3+lvl damage, equivalent to +67% damage, but more consistent
|
||||||
AttackIndicator.target(enemy);
|
beforeAbilityUsed(hero);
|
||||||
if (hero.attack(enemy, 1f, augment.damageFactor(3 + level()), Char.INFINITE_ACCURACY)){
|
AttackIndicator.target(enemy);
|
||||||
Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
|
if (hero.attack(enemy, 1f, augment.damageFactor(3 + level()), Char.INFINITE_ACCURACY)) {
|
||||||
if (!enemy.isAlive()){
|
Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
|
||||||
onAbilityKill(hero);
|
if (!enemy.isAlive()) {
|
||||||
|
onAbilityKill(hero);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
hero.spendAndNext(hero.attackDelay());
|
||||||
|
Invisibility.dispel();
|
||||||
|
afterAbilityUsed(hero);
|
||||||
}
|
}
|
||||||
hero.spendAndNext(hero.attackDelay());
|
});
|
||||||
Invisibility.dispel();
|
} else {
|
||||||
afterAbilityUsed(hero);
|
beforeAbilityUsed(hero);
|
||||||
}
|
GLog.w(Messages.get(Rapier.class, "ability_no_target"));
|
||||||
});
|
hero.spendAndNext(hero.speed());
|
||||||
|
afterAbilityUsed(hero);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user