Search in sources :

Example 16 with Hero

use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.

the class TeleportationTrap method activate.

@Override
public void activate() {
    CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
    Sample.INSTANCE.play(Assets.SND_TELEPORT);
    Char ch = Actor.findChar(pos);
    if (ch instanceof Hero) {
        ScrollOfTeleportation.teleportHero((Hero) ch);
    } else if (ch != null) {
        int count = 10;
        int pos;
        do {
            pos = Dungeon.level.randomRespawnCell();
            if (count-- <= 0) {
                break;
            }
        } while (pos == -1);
        if (pos == -1 || Dungeon.bossLevel()) {
            GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
        } else {
            ch.pos = pos;
            if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING) {
                ((Mob) ch).state = ((Mob) ch).WANDERING;
            }
            ch.sprite.place(ch.pos);
            ch.sprite.visible = Dungeon.level.heroFOV[pos];
        }
    }
    Heap heap = Dungeon.level.heaps.get(pos);
    if (heap != null) {
        int cell = Dungeon.level.randomRespawnCell();
        Item item = heap.pickUp();
        if (cell != -1) {
            Dungeon.level.drop(item, cell);
        }
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 17 with Hero

use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Fadeleaf method activate.

@Override
public void activate() {
    Char ch = Actor.findChar(pos);
    if (ch instanceof Hero) {
        ScrollOfTeleportation.teleportHero((Hero) ch);
        ((Hero) ch).curAction = null;
    } else if (ch instanceof Mob && !ch.properties().contains(Char.Property.IMMOVABLE)) {
        int count = 10;
        int newPos;
        do {
            newPos = Dungeon.level.randomRespawnCell();
            if (count-- <= 0) {
                break;
            }
        } while (newPos == -1);
        if (newPos != -1 && !Dungeon.bossLevel()) {
            ch.pos = newPos;
            if (((Mob) ch).state == ((Mob) ch).HUNTING)
                ((Mob) ch).state = ((Mob) ch).WANDERING;
            ch.sprite.place(ch.pos);
            ch.sprite.visible = Dungeon.level.heroFOV[ch.pos];
        }
    }
    if (Dungeon.level.heroFOV[pos]) {
        CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)

Example 18 with Hero

use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Plant method trigger.

public void trigger() {
    Char ch = Actor.findChar(pos);
    if (ch instanceof Hero) {
        ((Hero) ch).interrupt();
        if (((Hero) ch).subClass == HeroSubClass.WARDEN) {
            Buff.affect(ch, Barkskin.class).level(ch.HT / 3);
        }
    }
    wither();
    activate();
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) Barkskin(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin)

Example 19 with Hero

use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Dirk method damageRoll.

@Override
public int damageRoll(Char owner) {
    if (owner instanceof Hero) {
        Hero hero = (Hero) owner;
        Char enemy = hero.enemy();
        if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
            // deals 67% toward max to max on surprise, instead of min to max.
            int diff = max() - min();
            int damage = imbue.damageFactor(Random.NormalIntRange(min() + Math.round(diff * 0.67f), max()));
            int exStr = hero.STR() - STRReq();
            if (exStr > 0) {
                damage += Random.IntRange(0, exStr);
            }
            return damage;
        }
    }
    return super.damageRoll(owner);
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)

Example 20 with Hero

use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.

the class ThrowingKnife method damageRoll.

@Override
public int damageRoll(Char owner) {
    if (owner instanceof Hero) {
        Hero hero = (Hero) owner;
        if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
            // deals 75% toward max to max on surprise, instead of min to max.
            int diff = max() - min();
            int damage = imbue.damageFactor(Random.NormalIntRange(min() + Math.round(diff * 0.75f), max()));
            damage = Math.round(damage * RingOfSharpshooting.damageMultiplier(hero));
            int exStr = hero.STR() - STRReq();
            if (exStr > 0 && hero.heroClass == HeroClass.HUNTRESS) {
                damage += Random.IntRange(0, exStr);
            }
            return damage;
        }
    }
    return super.damageRoll(owner);
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)

Aggregations

Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)25 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)9 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)9 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)8 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)5 ArrayList (java.util.ArrayList)4 Thief (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief)3 Barkskin (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin)2 EquipableItem (com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem)2 Gold (com.shatteredpixel.shatteredpixeldungeon.items.Gold)2 KindOfWeapon (com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon)2 MysteryMeat (com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat)2 Knuckles (com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Knuckles)2 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)1 Awareness (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness)1 Bleeding (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding)1 Buff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff)1 EarthImbue (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.EarthImbue)1 FireImbue (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FireImbue)1 MindVision (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision)1