v2.0.0: fixed magical attacks causing crashes due to changing enemy ref

This commit is contained in:
Evan Debenham
2023-03-06 13:28:54 -05:00
parent 1ef2f4aec7
commit 6a62d54d0f
5 changed files with 7 additions and 0 deletions

View File

@@ -149,6 +149,7 @@ public abstract class Elemental extends Mob {
spend( 1f );
Invisibility.dispel(this);
Char enemy = this.enemy;
if (hit( this, enemy, true )) {
rangedProc( enemy );

View File

@@ -112,6 +112,7 @@ public abstract class Shaman extends Mob {
spend( 1f );
Invisibility.dispel(this);
Char enemy = this.enemy;
if (hit( this, enemy, true )) {
if (Random.Int( 2 ) == 0) {

View File

@@ -105,6 +105,7 @@ public class Warlock extends Mob implements Callback {
spend( TIME_TO_ZAP );
Invisibility.dispel(this);
Char enemy = this.enemy;
if (hit( this, enemy, true )) {
//TODO would be nice for this to work on ghost/statues too
if (enemy == Dungeon.hero && Random.Int( 2 ) == 0) {

View File

@@ -314,6 +314,7 @@ public abstract class YogFist extends Mob {
spend( 1f );
Invisibility.dispel(this);
Char enemy = this.enemy;
if (hit( this, enemy, true )) {
Buff.affect( enemy, Roots.class, 3f );
@@ -471,6 +472,7 @@ public abstract class YogFist extends Mob {
spend( 1f );
Invisibility.dispel(this);
Char enemy = this.enemy;
if (hit( this, enemy, true )) {
enemy.damage( Random.NormalIntRange(10, 20), new LightBeam() );
@@ -536,6 +538,7 @@ public abstract class YogFist extends Mob {
spend( 1f );
Invisibility.dispel(this);
Char enemy = this.enemy;
if (hit( this, enemy, true )) {
enemy.damage( Random.NormalIntRange(10, 20), new DarkBolt() );

View File

@@ -331,6 +331,7 @@ public class WandOfWarding extends Wand {
//always hits
int dmg = Random.NormalIntRange( 2 + wandLevel, 8 + 4*wandLevel );
Char enemy = this.enemy;
enemy.damage( dmg, this );
if (enemy.isAlive()){
Wand.wandProc(enemy, wandLevel, 1);