Search in sources :

Example 16 with Hero

use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.

the class ScrollOfCurse method doRead.

@SuppressWarnings("unchecked")
@Override
protected void doRead() {
    Invisibility.dispel(getCurUser());
    if (getCurUser() instanceof Hero) {
        Hero hero = getCurUser();
        hero.getSprite().emitter().burst(ShadowParticle.CURSE, 6);
        Sample.INSTANCE.play(Assets.SND_CURSED);
        Class<? extends FlavourBuff> buffClass = (Class<? extends FlavourBuff>) Random.oneOf(badBuffs);
        Buff.prolong(hero, buffClass, 10);
        if (getCurUser().belongings.armor != null) {
            getCurUser().belongings.armor.cursed = true;
        }
        if (getCurUser().belongings.weapon != null) {
            getCurUser().belongings.weapon.cursed = true;
        }
        if (getCurUser().belongings.ring1 != null) {
            getCurUser().belongings.ring1.cursed = true;
        }
        if (getCurUser().belongings.ring2 != null) {
            getCurUser().belongings.ring2.cursed = true;
        }
    }
    setKnown();
    getCurUser().spendAndNext(TIME_TO_READ);
}
Also used : Hero(com.watabou.pixeldungeon.actors.hero.Hero) FlavourBuff(com.watabou.pixeldungeon.actors.buffs.FlavourBuff)

Example 17 with Hero

use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.

the class SummoningSpell method cast.

@Override
public boolean cast(@NonNull Char chr) {
    if (chr instanceof Hero) {
        Hero hero = (Hero) chr;
        if (isSummoningLimitReached(hero)) {
            GLog.w(getLimitWarning(getSummonLimit()));
            return false;
        }
        hero.spend(castTime);
        hero.busy();
        hero.getSprite().zap(hero.getPos());
    }
    if (!super.cast(chr)) {
        return false;
    }
    Level level = Dungeon.level;
    int spawnPos = level.getEmptyCellNextTo(chr.getPos());
    Wound.hit(chr);
    Buff.detach(chr, Sungrass.Health.class);
    if (level.cellValid(spawnPos)) {
        Mob pet = getSummonMob();
        if (chr instanceof Hero) {
            Hero hero = (Hero) chr;
            pet = Mob.makePet(pet, hero);
        } else if (chr instanceof Mob) {
            Mob mob = (Mob) chr;
            pet.setFraction(mob.fraction());
        } else {
            pet.setFraction(Fraction.DUNGEON);
        }
        pet.setPos(spawnPos);
        level.spawnMob(pet);
    }
    castCallback(chr);
    return true;
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) Hero(com.watabou.pixeldungeon.actors.hero.Hero) Level(com.watabou.pixeldungeon.levels.Level) Sungrass(com.watabou.pixeldungeon.plants.Sungrass)

Example 18 with Hero

use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.

the class AirElemental method attackProc.

@Override
public int attackProc(@NonNull Char enemy, int damage) {
    Ballistica.cast(getPos(), enemy.getPos(), true, false);
    Char ch;
    for (int i = 1; i < maxDistance; i++) {
        int c = Ballistica.trace[i];
        if ((ch = Actor.findChar(c)) != null && ch instanceof Hero) {
            int next = Ballistica.trace[i + 1];
            if ((Dungeon.level.passable[next] || Dungeon.level.avoid[next]) && Actor.findChar(next) == null) {
                ch.move(next);
                ch.getSprite().move(ch.getPos(), next);
                Dungeon.observe();
                ch.getSprite().emitter().burst(WindParticle.FACTORY, 5);
                ch.getSprite().burst(0xFF99FFFF, 3);
                Sample.INSTANCE.play(Assets.SND_MELD);
            } else {
                return damage * 2;
            }
        }
    }
    return damage;
}
Also used : Char(com.watabou.pixeldungeon.actors.Char) Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Example 19 with Hero

use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.

the class Trap method stepOn.

@Override
public boolean stepOn(Char chr) {
    interact(chr);
    if (chr instanceof Hero) {
        Hero hero = (Hero) chr;
        hero.interrupt();
    }
    return true;
}
Also used : Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Example 20 with Hero

use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.

the class Mob method ressurrect.

public void ressurrect(Char parent) {
    int spawnPos = Dungeon.level.getEmptyCellNextTo(parent.getPos());
    Mob new_mob;
    try {
        new_mob = this.getClass().newInstance();
    } catch (Exception e) {
        throw new TrackedRuntimeException("resurrect issue");
    }
    if (Dungeon.level.cellValid(spawnPos)) {
        new_mob.setPos(spawnPos);
        Dungeon.level.spawnMob(new_mob);
        if (parent instanceof Hero) {
            Mob.makePet(new_mob, (Hero) parent);
            Actor.addDelayed(new Pushing(new_mob, parent.getPos(), new_mob.getPos()), -1);
        }
    }
}
Also used : TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException) Pushing(com.watabou.pixeldungeon.effects.Pushing) Hero(com.watabou.pixeldungeon.actors.hero.Hero) JSONException(org.json.JSONException) TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException)

Aggregations

Hero (com.watabou.pixeldungeon.actors.hero.Hero)44 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)8 Item (com.watabou.pixeldungeon.items.Item)8 Char (com.watabou.pixeldungeon.actors.Char)6 Gold (com.watabou.pixeldungeon.items.Gold)5 EquipableItem (com.watabou.pixeldungeon.items.EquipableItem)4 BlackSkull (com.nyrds.pixeldungeon.items.necropolis.BlackSkull)2 Fire (com.watabou.pixeldungeon.actors.blobs.Fire)2 Barkskin (com.watabou.pixeldungeon.actors.buffs.Barkskin)2 Shadows (com.watabou.pixeldungeon.actors.buffs.Shadows)2 Thief (com.watabou.pixeldungeon.actors.mobs.Thief)2 Dewdrop (com.watabou.pixeldungeon.items.Dewdrop)2 KindOfWeapon (com.watabou.pixeldungeon.items.KindOfWeapon)2 MysteryMeat (com.watabou.pixeldungeon.items.food.MysteryMeat)2 Herbalism (com.watabou.pixeldungeon.items.rings.RingOfHerbalism.Herbalism)2 RingOfSatiety (com.watabou.pixeldungeon.items.rings.RingOfSatiety)2 Knuckles (com.watabou.pixeldungeon.items.weapon.melee.Knuckles)2 Level (com.watabou.pixeldungeon.levels.Level)2 SuppressLint (android.annotation.SuppressLint)1 TrackedRuntimeException (com.nyrds.android.util.TrackedRuntimeException)1