v2.1.1: added checks for knockback and teleporting on-hit enemies
This commit is contained in:
@@ -340,6 +340,7 @@ public class Combo extends Buff implements ActionIndicator.Action {
|
||||
break;
|
||||
}
|
||||
|
||||
int oldPos = enemy.pos;
|
||||
if (hero.attack(enemy, dmgMulti, dmgBonus, Char.INFINITE_ACCURACY)){
|
||||
//special on-hit effects
|
||||
switch (moveBeingUsed) {
|
||||
@@ -360,7 +361,9 @@ public class Combo extends Buff implements ActionIndicator.Action {
|
||||
dist--;
|
||||
}
|
||||
}
|
||||
WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false, hero);
|
||||
if (enemy.pos == oldPos) {
|
||||
WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false, hero);
|
||||
}
|
||||
break;
|
||||
case PARRY:
|
||||
hit(enemy);
|
||||
|
||||
@@ -561,11 +561,12 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
|
||||
AttackIndicator.target(enemy);
|
||||
boolean empowered = Buff.affect(hero, MonkEnergy.class).abilitiesEmpowered(hero);
|
||||
|
||||
int oldPos = enemy.pos;
|
||||
if (hero.attack(enemy, empowered ? 4.5f : 3f, 0, Char.INFINITE_ACCURACY)){
|
||||
Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
|
||||
}
|
||||
|
||||
if (enemy.isAlive()){
|
||||
if (enemy.isAlive() && oldPos == enemy.pos){
|
||||
//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
|
||||
|
||||
@@ -94,6 +94,8 @@ import com.watabou.utils.Callback;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ElementalStrike extends ArmorAbility {
|
||||
@@ -201,6 +203,7 @@ public class ElementalStrike extends ArmorAbility {
|
||||
|
||||
if (enemy != null){
|
||||
AttackIndicator.target(enemy);
|
||||
oldEnemyPos = enemy.pos;
|
||||
if (hero.attack(enemy, 1, 0, Char.INFINITE_ACCURACY)) {
|
||||
Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
|
||||
}
|
||||
@@ -347,6 +350,8 @@ public class ElementalStrike extends ArmorAbility {
|
||||
}
|
||||
}
|
||||
|
||||
private int oldEnemyPos;
|
||||
|
||||
//effects that affect the characters within the cone AOE
|
||||
private void perCharEffect(ConeAOE cone, Hero hero, Char primaryTarget, Weapon.Enchantment ench) {
|
||||
|
||||
@@ -389,8 +394,18 @@ public class ElementalStrike extends ArmorAbility {
|
||||
|
||||
//*** Elastic ***
|
||||
} else if (ench instanceof Elastic){
|
||||
//TODO sort affected by distance first? So further ones get knocked back first
|
||||
|
||||
//sorts affected from furthest to closest
|
||||
Collections.sort(affected, new Comparator<Char>() {
|
||||
@Override
|
||||
public int compare(Char a, Char b) {
|
||||
return Dungeon.level.distance(hero.pos, a.pos) - Dungeon.level.distance(hero.pos, b.pos);
|
||||
}
|
||||
});
|
||||
|
||||
for (Char ch : affected){
|
||||
if (ch == primaryTarget && oldEnemyPos != primaryTarget.pos) continue;
|
||||
|
||||
Ballistica aim = new Ballistica(hero.pos, ch.pos, Ballistica.WONT_STOP);
|
||||
int knockback = Math.round(5*powerMulti);
|
||||
WandOfBlastWave.throwChar(ch,
|
||||
|
||||
@@ -88,8 +88,9 @@ public class Spear extends MeleeWeapon {
|
||||
public void call() {
|
||||
wep.beforeAbilityUsed(hero, enemy);
|
||||
AttackIndicator.target(enemy);
|
||||
int oldPos = enemy.pos;
|
||||
if (hero.attack(enemy, dmgMulti, 0, Char.INFINITE_ACCURACY)) {
|
||||
if (enemy.isAlive()){
|
||||
if (enemy.isAlive() && enemy.pos == oldPos){
|
||||
//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
|
||||
|
||||
Reference in New Issue
Block a user