From 07c3e9d500aa9bdb29710be92d8fbf8492e527fd Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 2 May 2021 17:02:18 -0400 Subject: [PATCH] v0.9.3: fixed cone AOEs stopping short in some cases --- .../shatteredpixeldungeon/actors/mobs/NewDM300.java | 2 +- .../items/potions/exotic/PotionOfDragonsBreath.java | 2 +- .../items/wands/WandOfFireblast.java | 5 +++-- .../shatteredpixeldungeon/items/wands/WandOfRegrowth.java | 5 +++-- .../shatteredpixeldungeon/mechanics/ConeAOE.java | 8 +------- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewDM300.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewDM300.java index b7ad10387..532fca944 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewDM300.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewDM300.java @@ -202,7 +202,7 @@ public class NewDM300 extends Mob { //try to fire gas at an enemy we can't reach if (turnsSinceLastAbility >= MIN_COOLDOWN){ //use a coneAOE to try and account for trickshotting angles - ConeAOE aim = new ConeAOE(new Ballistica(pos, enemy.pos, Ballistica.PROJECTILE), 30); + ConeAOE aim = new ConeAOE(new Ballistica(pos, enemy.pos, Ballistica.WONT_STOP), Float.POSITIVE_INFINITY, 30, Ballistica.STOP_SOLID); if (aim.cells.contains(enemy.pos)) { lastAbility = GAS; turnsSinceLastAbility = 0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java index 54e62e9a9..0c3da42b7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfDragonsBreath.java @@ -82,7 +82,7 @@ public class PotionOfDragonsBreath extends ExoticPotion { curUser.sprite.zap(cell); Sample.INSTANCE.play( Assets.Sounds.BURNING ); - final Ballistica bolt = new Ballistica(curUser.pos, cell, Ballistica.STOP_SOLID | Ballistica.IGNORE_SOFT_SOLID); + final Ballistica bolt = new Ballistica(curUser.pos, cell, Ballistica.WONT_STOP); int maxDist = 6; int dist = Math.min(bolt.dist, maxDist); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java index de291dcfc..434eda000 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java @@ -52,7 +52,8 @@ public class WandOfFireblast extends DamageWand { { image = ItemSpriteSheet.WAND_FIREBOLT; - collisionProperties = Ballistica.STOP_SOLID | Ballistica.IGNORE_SOFT_SOLID; + //only used for targeting, actual projectile logic is Ballistica.STOP_SOLID | Ballistica.IGNORE_SOFT_SOLID + collisionProperties = Ballistica.WONT_STOP; } //1x/2x/3x damage @@ -146,7 +147,7 @@ public class WandOfFireblast extends DamageWand { cone = new ConeAOE( bolt, maxDist, 30 + 20*chargesPerCast(), - collisionProperties | Ballistica.STOP_TARGET); + Ballistica.STOP_TARGET | Ballistica.STOP_SOLID | Ballistica.IGNORE_SOFT_SOLID); //cast to cells at the tip, rather than all cells, better performance. for (Ballistica ray : cone.rays){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java index e7d040d20..f74ad2476 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java @@ -60,7 +60,8 @@ public class WandOfRegrowth extends Wand { { image = ItemSpriteSheet.WAND_REGROWTH; - collisionProperties = Ballistica.STOP_SOLID; + //only used for targeting, actual projectile logic is Ballistica.STOP_SOLID + collisionProperties = Ballistica.WONT_STOP; } private int totChrgUsed = 0; @@ -238,7 +239,7 @@ public class WandOfRegrowth extends Wand { cone = new ConeAOE( bolt, maxDist, 20 + 10*chargesPerCast(), - collisionProperties | Ballistica.STOP_TARGET); + Ballistica.STOP_SOLID | Ballistica.STOP_TARGET); //cast to cells at the tip, rather than all cells, better performance. for (Ballistica ray : cone.rays){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ConeAOE.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ConeAOE.java index 0eef4066c..9f85a98b8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ConeAOE.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ConeAOE.java @@ -98,19 +98,13 @@ public class ConeAOE { } //cast a ray to each found cell, these make up the cone + //we don't add the core ray as its collision properties may differ from the cone for( int c : targetCells ){ Ballistica ray = new Ballistica(core.sourcePos, c, ballisticaParams); cells.addAll(ray.subPath(1, ray.dist)); rays.add(ray); } - //lastly add any cells in the core - for ( int c : core.subPath(1, core.dist)){ - if (Dungeon.level.trueDistance(core.sourcePos, c) <= maxDist){ - cells.add(c); - } - } - } }