v0.3.5: fixed thrown weapons trigger traps incorrectly while time was frozen

This commit is contained in:
Evan Debenham 2016-03-25 02:04:18 -04:00
parent 7301217975
commit 4bc69be53e
2 changed files with 20 additions and 22 deletions

View File

@ -286,11 +286,11 @@ public class TimekeepersHourglass extends Artifact {
presses.add(cell);
}
public void triggerPresses(){
private void triggerPresses(){
for (int cell : presses)
Dungeon.level.press(cell, null);
presses = new ArrayList<Integer>();
presses = new ArrayList<>();
}
@Override
@ -304,7 +304,6 @@ public class TimekeepersHourglass extends Artifact {
@Override
public void detach(){
triggerPresses();
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0]))
mob.sprite.remove(CharSprite.State.PARALYSED);
GameScene.freezeEmitters = false;
@ -313,6 +312,7 @@ public class TimekeepersHourglass extends Artifact {
updateQuickslot();
super.detach();
activeBuff = null;
triggerPresses();
}
private static final String PRESSES = "presses";

View File

@ -60,20 +60,21 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
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.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.HighGrass;
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.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
@ -842,13 +843,6 @@ public abstract class Level implements Bundlable {
}
return;
}
TimekeepersHourglass.timeFreeze timeFreeze = null;
if (ch != null)
timeFreeze = ch.buff(TimekeepersHourglass.timeFreeze.class);
boolean frozen = timeFreeze != null;
Trap trap = null;
@ -878,22 +872,26 @@ public abstract class Level implements Bundlable {
Door.enter( cell );
break;
}
if (trap != null && !frozen) {
if (ch == Dungeon.hero)
Dungeon.hero.interrupt();
TimekeepersHourglass.timeFreeze timeFreeze = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class);
trap.trigger();
if (trap != null) {
if (timeFreeze == null) {
} else if (trap != null && frozen){
if (ch == Dungeon.hero)
Dungeon.hero.interrupt();
Sample.INSTANCE.play(Assets.SND_TRAP);
trap.trigger();
discover(cell);
} else {
timeFreeze.setDelayedPress( cell );
Sample.INSTANCE.play(Assets.SND_TRAP);
discover(cell);
timeFreeze.setDelayedPress(cell);
}
}
Plant plant = plants.get( cell );