v2.4.0: fixed elastic enchant and spike ability competing with eachother
This commit is contained in:
@@ -39,6 +39,7 @@ public class Pushing extends Actor {
|
|||||||
private int to;
|
private int to;
|
||||||
|
|
||||||
private Effect effect;
|
private Effect effect;
|
||||||
|
private Char ch;
|
||||||
|
|
||||||
private Callback callback;
|
private Callback callback;
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ public class Pushing extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Pushing( Char ch, int from, int to ) {
|
public Pushing( Char ch, int from, int to ) {
|
||||||
|
this.ch = ch;
|
||||||
sprite = ch.sprite;
|
sprite = ch.sprite;
|
||||||
this.from = from;
|
this.from = from;
|
||||||
this.to = to;
|
this.to = to;
|
||||||
@@ -86,6 +88,15 @@ public class Pushing extends Actor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean pushingExistsForChar(Char ch) {
|
||||||
|
for (Actor a : all()){
|
||||||
|
if (a instanceof Pushing && ((Pushing)a).ch == ch){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public class Effect extends Visual {
|
public class Effect extends Visual {
|
||||||
|
|
||||||
private static final float DELAY = 0.15f;
|
private static final float DELAY = 0.15f;
|
||||||
|
|||||||
+3
-1
@@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
|
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
@@ -101,8 +102,9 @@ public class Spear extends MeleeWeapon {
|
|||||||
wep.beforeAbilityUsed(hero, enemy);
|
wep.beforeAbilityUsed(hero, enemy);
|
||||||
AttackIndicator.target(enemy);
|
AttackIndicator.target(enemy);
|
||||||
int oldPos = enemy.pos;
|
int oldPos = enemy.pos;
|
||||||
|
//do not push if enemy has moved, or another push is active (e.g. elastic)
|
||||||
if (hero.attack(enemy, dmgMulti, dmgBoost, Char.INFINITE_ACCURACY)) {
|
if (hero.attack(enemy, dmgMulti, dmgBoost, Char.INFINITE_ACCURACY)) {
|
||||||
if (enemy.isAlive() && enemy.pos == oldPos){
|
if (enemy.isAlive() && enemy.pos == oldPos && !Pushing.pushingExistsForChar(enemy)){
|
||||||
//trace a ballistica to our target (which will also extend past them
|
//trace a ballistica to our target (which will also extend past them
|
||||||
Ballistica trajectory = new Ballistica(hero.pos, enemy.pos, Ballistica.STOP_TARGET);
|
Ballistica trajectory = new Ballistica(hero.pos, enemy.pos, Ballistica.STOP_TARGET);
|
||||||
//trim it to just be the part that goes past them
|
//trim it to just be the part that goes past them
|
||||||
|
|||||||
Reference in New Issue
Block a user