v0.9.3: fixed cone AOEs stopping short in some cases

This commit is contained in:
Evan Debenham 2021-05-02 17:02:18 -04:00
parent 161851aa64
commit 07c3e9d500
5 changed files with 9 additions and 13 deletions

View File

@ -202,7 +202,7 @@ public class NewDM300 extends Mob {
//try to fire gas at an enemy we can't reach //try to fire gas at an enemy we can't reach
if (turnsSinceLastAbility >= MIN_COOLDOWN){ if (turnsSinceLastAbility >= MIN_COOLDOWN){
//use a coneAOE to try and account for trickshotting angles //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)) { if (aim.cells.contains(enemy.pos)) {
lastAbility = GAS; lastAbility = GAS;
turnsSinceLastAbility = 0; turnsSinceLastAbility = 0;

View File

@ -82,7 +82,7 @@ public class PotionOfDragonsBreath extends ExoticPotion {
curUser.sprite.zap(cell); curUser.sprite.zap(cell);
Sample.INSTANCE.play( Assets.Sounds.BURNING ); 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 maxDist = 6;
int dist = Math.min(bolt.dist, maxDist); int dist = Math.min(bolt.dist, maxDist);

View File

@ -52,7 +52,8 @@ public class WandOfFireblast extends DamageWand {
{ {
image = ItemSpriteSheet.WAND_FIREBOLT; 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 //1x/2x/3x damage
@ -146,7 +147,7 @@ public class WandOfFireblast extends DamageWand {
cone = new ConeAOE( bolt, cone = new ConeAOE( bolt,
maxDist, maxDist,
30 + 20*chargesPerCast(), 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. //cast to cells at the tip, rather than all cells, better performance.
for (Ballistica ray : cone.rays){ for (Ballistica ray : cone.rays){

View File

@ -60,7 +60,8 @@ public class WandOfRegrowth extends Wand {
{ {
image = ItemSpriteSheet.WAND_REGROWTH; 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; private int totChrgUsed = 0;
@ -238,7 +239,7 @@ public class WandOfRegrowth extends Wand {
cone = new ConeAOE( bolt, cone = new ConeAOE( bolt,
maxDist, maxDist,
20 + 10*chargesPerCast(), 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. //cast to cells at the tip, rather than all cells, better performance.
for (Ballistica ray : cone.rays){ for (Ballistica ray : cone.rays){

View File

@ -98,19 +98,13 @@ public class ConeAOE {
} }
//cast a ray to each found cell, these make up the cone //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 ){ for( int c : targetCells ){
Ballistica ray = new Ballistica(core.sourcePos, c, ballisticaParams); Ballistica ray = new Ballistica(core.sourcePos, c, ballisticaParams);
cells.addAll(ray.subPath(1, ray.dist)); cells.addAll(ray.subPath(1, ray.dist));
rays.add(ray); 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);
}
}
} }
} }