v0.8.2d: adjusted door opening logic on fireblast, fixes bugs
This commit is contained in:
parent
d4968a7e01
commit
49ed3e4f8b
|
@ -32,6 +32,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ConeAOE;
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ConeAOE;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
@ -80,12 +82,12 @@ 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_TERRAIN | Ballistica.OPEN_DOORS);
|
final Ballistica bolt = new Ballistica(curUser.pos, cell, Ballistica.STOP_TERRAIN | Ballistica.IGNORE_DOORS);
|
||||||
|
|
||||||
int maxDist = 6;
|
int maxDist = 6;
|
||||||
int dist = Math.min(bolt.dist, maxDist);
|
int dist = Math.min(bolt.dist, maxDist);
|
||||||
|
|
||||||
final ConeAOE cone = new ConeAOE(bolt, 6, 60, Ballistica.STOP_TERRAIN | Ballistica.STOP_TARGET | Ballistica.OPEN_DOORS );
|
final ConeAOE cone = new ConeAOE(bolt, 6, 60, Ballistica.STOP_TERRAIN | Ballistica.STOP_TARGET | Ballistica.IGNORE_DOORS );
|
||||||
|
|
||||||
//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){
|
||||||
|
@ -111,6 +113,12 @@ public class PotionOfDragonsBreath extends ExoticPotion {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//knock doors open
|
||||||
|
if (Dungeon.level.map[cell] == Terrain.DOOR){
|
||||||
|
Level.set(cell, Terrain.OPEN_DOOR);
|
||||||
|
GameScene.updateMap(cell);
|
||||||
|
}
|
||||||
|
|
||||||
//only ignite cells directly near caster if they are flammable
|
//only ignite cells directly near caster if they are flammable
|
||||||
if (Dungeon.level.adjacent(bolt.sourcePos, cell) && !Dungeon.level.flamable[cell]){
|
if (Dungeon.level.adjacent(bolt.sourcePos, cell) && !Dungeon.level.flamable[cell]){
|
||||||
adjacentCells.add(cell);
|
adjacentCells.add(cell);
|
||||||
|
|
|
@ -34,6 +34,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ConeAOE;
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ConeAOE;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
@ -50,7 +52,7 @@ public class WandOfFireblast extends DamageWand {
|
||||||
{
|
{
|
||||||
image = ItemSpriteSheet.WAND_FIREBOLT;
|
image = ItemSpriteSheet.WAND_FIREBOLT;
|
||||||
|
|
||||||
collisionProperties = Ballistica.STOP_TERRAIN | Ballistica.OPEN_DOORS;
|
collisionProperties = Ballistica.STOP_TERRAIN | Ballistica.IGNORE_DOORS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//1x/2x/3x damage
|
//1x/2x/3x damage
|
||||||
|
@ -77,6 +79,12 @@ public class WandOfFireblast extends DamageWand {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//knock doors open
|
||||||
|
if (Dungeon.level.map[cell] == Terrain.DOOR){
|
||||||
|
Level.set(cell, Terrain.OPEN_DOOR);
|
||||||
|
GameScene.updateMap(cell);
|
||||||
|
}
|
||||||
|
|
||||||
//only ignite cells directly near caster if they are flammable
|
//only ignite cells directly near caster if they are flammable
|
||||||
if (Dungeon.level.adjacent(bolt.sourcePos, cell) && !Dungeon.level.flamable[cell]){
|
if (Dungeon.level.adjacent(bolt.sourcePos, cell) && !Dungeon.level.flamable[cell]){
|
||||||
adjacentCells.add(cell);
|
adjacentCells.add(cell);
|
||||||
|
|
|
@ -24,9 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.mechanics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -44,7 +42,7 @@ public class Ballistica {
|
||||||
public static final int STOP_TARGET = 1; //ballistica will stop at the target cell
|
public static final int STOP_TARGET = 1; //ballistica will stop at the target cell
|
||||||
public static final int STOP_CHARS = 2; //ballistica will stop on first char hit
|
public static final int STOP_CHARS = 2; //ballistica will stop on first char hit
|
||||||
public static final int STOP_TERRAIN = 4; //ballistica will stop on solid terrain
|
public static final int STOP_TERRAIN = 4; //ballistica will stop on solid terrain
|
||||||
public static final int OPEN_DOORS = 8; //ballistica will open doors instead of colliding
|
public static final int IGNORE_DOORS = 8; //ballistica will ignore doors instead of colliding
|
||||||
|
|
||||||
public static final int PROJECTILE = STOP_TARGET | STOP_CHARS | STOP_TERRAIN;
|
public static final int PROJECTILE = STOP_TARGET | STOP_CHARS | STOP_TERRAIN;
|
||||||
|
|
||||||
|
@ -59,7 +57,7 @@ public class Ballistica {
|
||||||
(params & STOP_TARGET) > 0,
|
(params & STOP_TARGET) > 0,
|
||||||
(params & STOP_CHARS) > 0,
|
(params & STOP_CHARS) > 0,
|
||||||
(params & STOP_TERRAIN) > 0,
|
(params & STOP_TERRAIN) > 0,
|
||||||
(params & OPEN_DOORS) > 0);
|
(params & IGNORE_DOORS) > 0);
|
||||||
|
|
||||||
if (collisionPos != null) {
|
if (collisionPos != null) {
|
||||||
dist = path.indexOf(collisionPos);
|
dist = path.indexOf(collisionPos);
|
||||||
|
@ -72,7 +70,7 @@ public class Ballistica {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void build( int from, int to, boolean stopTarget, boolean stopChars, boolean stopTerrain, boolean openDoors ) {
|
private void build( int from, int to, boolean stopTarget, boolean stopChars, boolean stopTerrain, boolean ignoreDoors ) {
|
||||||
int w = Dungeon.level.width();
|
int w = Dungeon.level.width();
|
||||||
|
|
||||||
int x0 = from % w;
|
int x0 = from % w;
|
||||||
|
@ -123,15 +121,12 @@ public class Ballistica {
|
||||||
|
|
||||||
path.add(cell);
|
path.add(cell);
|
||||||
|
|
||||||
if (openDoors && collisionPos == null && Dungeon.level.map[cell] == Terrain.DOOR){
|
|
||||||
Level.set(cell, Terrain.OPEN_DOOR);
|
|
||||||
GameScene.updateMap(cell);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((stopTerrain && cell != sourcePos && Dungeon.level.solid[cell])
|
if ((stopTerrain && cell != sourcePos && Dungeon.level.solid[cell])
|
||||||
|| (cell != sourcePos && stopChars && Actor.findChar( cell ) != null)
|
|| (cell != sourcePos && stopChars && Actor.findChar( cell ) != null)
|
||||||
|| (cell == to && stopTarget)){
|
|| (cell == to && stopTarget)){
|
||||||
collide(cell);
|
if (!ignoreDoors || Dungeon.level.map[cell] != Terrain.DOOR) {
|
||||||
|
collide(cell); //only collide if this isn't a door, or we aren't ignoring doors
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cell += stepA;
|
cell += stepA;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user