v0.7.1: added a safety check to sniper's mark

This commit is contained in:
Evan Debenham 2018-12-07 23:01:17 -05:00
parent 5157b83394
commit 5ae7b2df9d

View File

@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
@ -88,7 +89,10 @@ public class SnipersMark extends FlavourBuff implements ActionIndicator.Action {
@Override @Override
public void doAction() { public void doAction() {
SpiritBow bow = Dungeon.hero.belongings.getItem(SpiritBow.class); Hero hero = Dungeon.hero;
if (hero == null) return;
SpiritBow bow = hero.belongings.getItem(SpiritBow.class);
if (bow == null) return; if (bow == null) return;
SpiritBow.SpiritArrow arrow = bow.knockArrow(); SpiritBow.SpiritArrow arrow = bow.knockArrow();
@ -99,7 +103,7 @@ public class SnipersMark extends FlavourBuff implements ActionIndicator.Action {
bow.sniperSpecial = true; bow.sniperSpecial = true;
arrow.cast(Dungeon.hero, QuickSlotButton.autoAim(ch, arrow)); arrow.cast(hero, QuickSlotButton.autoAim(ch, arrow));
detach(); detach();
} }