v0.3.5: fixed thrown weapons trigger traps incorrectly while time was frozen
This commit is contained in:
parent
7301217975
commit
4bc69be53e
|
@ -286,11 +286,11 @@ public class TimekeepersHourglass extends Artifact {
|
||||||
presses.add(cell);
|
presses.add(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void triggerPresses(){
|
private void triggerPresses(){
|
||||||
for (int cell : presses)
|
for (int cell : presses)
|
||||||
Dungeon.level.press(cell, null);
|
Dungeon.level.press(cell, null);
|
||||||
|
|
||||||
presses = new ArrayList<Integer>();
|
presses = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -304,7 +304,6 @@ public class TimekeepersHourglass extends Artifact {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detach(){
|
public void detach(){
|
||||||
triggerPresses();
|
|
||||||
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0]))
|
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0]))
|
||||||
mob.sprite.remove(CharSprite.State.PARALYSED);
|
mob.sprite.remove(CharSprite.State.PARALYSED);
|
||||||
GameScene.freezeEmitters = false;
|
GameScene.freezeEmitters = false;
|
||||||
|
@ -313,6 +312,7 @@ public class TimekeepersHourglass extends Artifact {
|
||||||
updateQuickslot();
|
updateQuickslot();
|
||||||
super.detach();
|
super.detach();
|
||||||
activeBuff = null;
|
activeBuff = null;
|
||||||
|
triggerPresses();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String PRESSES = "presses";
|
private static final String PRESSES = "presses";
|
||||||
|
|
|
@ -60,20 +60,21 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
|
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.HighGrass;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.features.HighGrass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.*;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.WornTrap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.noosa.Group;
|
import com.watabou.noosa.Group;
|
||||||
|
@ -843,13 +844,6 @@ public abstract class Level implements Bundlable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimekeepersHourglass.timeFreeze timeFreeze = null;
|
|
||||||
|
|
||||||
if (ch != null)
|
|
||||||
timeFreeze = ch.buff(TimekeepersHourglass.timeFreeze.class);
|
|
||||||
|
|
||||||
boolean frozen = timeFreeze != null;
|
|
||||||
|
|
||||||
Trap trap = null;
|
Trap trap = null;
|
||||||
|
|
||||||
switch (map[cell]) {
|
switch (map[cell]) {
|
||||||
|
@ -879,22 +873,26 @@ public abstract class Level implements Bundlable {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trap != null && !frozen) {
|
TimekeepersHourglass.timeFreeze timeFreeze = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class);
|
||||||
|
|
||||||
|
if (trap != null) {
|
||||||
|
if (timeFreeze == null) {
|
||||||
|
|
||||||
if (ch == Dungeon.hero)
|
if (ch == Dungeon.hero)
|
||||||
Dungeon.hero.interrupt();
|
Dungeon.hero.interrupt();
|
||||||
|
|
||||||
trap.trigger();
|
trap.trigger();
|
||||||
|
|
||||||
} else if (trap != null && frozen){
|
} else {
|
||||||
|
|
||||||
Sample.INSTANCE.play(Assets.SND_TRAP);
|
Sample.INSTANCE.play(Assets.SND_TRAP);
|
||||||
|
|
||||||
discover(cell);
|
discover(cell);
|
||||||
|
|
||||||
timeFreeze.setDelayedPress( cell );
|
timeFreeze.setDelayedPress(cell);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Plant plant = plants.get( cell );
|
Plant plant = plants.get( cell );
|
||||||
if (plant != null) {
|
if (plant != null) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user