v0.2.4: made potions susceptible to cold, refactored a bit of buff logic.
This commit is contained in:
@@ -20,14 +20,19 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
public class Frost extends FlavourBuff {
|
||||
|
||||
private static final String TXT_FREEZES = "%s freezes!";
|
||||
|
||||
private static final float DURATION = 5f;
|
||||
|
||||
@Override
|
||||
@@ -36,18 +41,35 @@ public class Frost extends FlavourBuff {
|
||||
|
||||
target.paralysed = true;
|
||||
Burning.detach( target, Burning.class );
|
||||
|
||||
if (target instanceof Hero) {
|
||||
|
||||
Hero hero = (Hero)target;
|
||||
Item item = hero.belongings.randomUnequipped();
|
||||
if (item instanceof MysteryMeat) {
|
||||
if (item instanceof Potion) {
|
||||
|
||||
item = item.detach( hero.belongings.backpack );
|
||||
GLog.w(TXT_FREEZES, item.toString());
|
||||
((Potion) item).shatter(hero.pos);
|
||||
|
||||
} else if (item instanceof MysteryMeat) {
|
||||
|
||||
item = item.detach( hero.belongings.backpack );
|
||||
FrozenCarpaccio carpaccio = new FrozenCarpaccio();
|
||||
if (!carpaccio.collect( hero.belongings.backpack )) {
|
||||
Dungeon.level.drop( carpaccio, target.pos ).sprite.drop();
|
||||
}
|
||||
GLog.w(TXT_FREEZES, item.toString());
|
||||
|
||||
}
|
||||
} else if (target instanceof Thief && ((Thief)target).item instanceof Potion) {
|
||||
|
||||
((Potion) ((Thief)target).item).shatter( target.pos );
|
||||
((Thief) target).item = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user