Search in sources :

Example 6 with Hero

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

the class WndTradeItem method sell.

private void sell(Item item) {
    Hero hero = Dungeon.hero;
    if (item.isEquipped(hero) && !((EquipableItem) item).doUnequip(hero, false)) {
        return;
    }
    item.detachAll(hero.belongings.backpack);
    int price = item.price();
    new Gold(price).doPickUp(hero);
    GLog.i(TXT_SOLD, item.name(), price);
}
Also used : Gold(com.watabou.pixeldungeon.items.Gold) Hero(com.watabou.pixeldungeon.actors.hero.Hero) EquipableItem(com.watabou.pixeldungeon.items.EquipableItem)

Example 7 with Hero

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

the class Weakness method attachTo.

@Override
public boolean attachTo(Char target) {
    if (super.attachTo(target)) {
        Hero hero = (Hero) target;
        hero.belongings.discharge();
        return true;
    } else {
        return false;
    }
}
Also used : Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Example 8 with Hero

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

the class Dungeon method init.

public static void init() {
    gameId = String.valueOf(SystemTime.now());
    challenges = PixelDungeon.challenges();
    Scroll.initLabels();
    Potion.initColors();
    Wand.initWoods();
    Ring.initGems();
    Statistics.reset();
    Journal.reset();
    depth = 0;
    gold(0);
    potionOfStrength = 0;
    scrollsOfUpgrade = 0;
    arcaneStyli = 0;
    dewVial = true;
    transmutation = Random.IntRange(6, 14);
    chapters = new HashSet<>();
    Ghost.Quest.reset();
    WandMaker.Quest.reset();
    Blacksmith.Quest.reset();
    Imp.Quest.reset();
    ScarecrowNPC.Quest.reset();
    AzuterronNPC.Quest.reset();
    CagedKobold.Quest.reset();
    PlagueDoctorNPC.Quest.reset();
    Room.shuffleTypes();
    hero = new Hero(difficulty);
    Badges.reset();
    heroClass.initHero(hero);
    hero.levelId = DungeonGenerator.getEntryLevel();
    SaveUtils.deleteLevels(heroClass);
}
Also used : Hero(com.watabou.pixeldungeon.actors.hero.Hero)

Example 9 with Hero

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

the class Web method evolve.

@Override
protected void evolve() {
    for (int i = 0; i < getLength(); i++) {
        int offv = cur[i] > 0 ? cur[i] - 1 : 0;
        off[i] = offv;
        if (offv > 0) {
            volume += offv;
            Char ch = Actor.findChar(i);
            boolean rootable = false;
            if (ch != null) {
                rootable = true;
                if (ch instanceof Hero) {
                    if (((Hero) ch).belongings.armor instanceof SpiderArmor) {
                        rootable = false;
                    }
                }
            }
            if (rootable) {
                Buff.prolong(ch, Roots.class, TICK);
            }
        }
    }
}
Also used : Char(com.watabou.pixeldungeon.actors.Char) Hero(com.watabou.pixeldungeon.actors.hero.Hero) SpiderArmor(com.nyrds.pixeldungeon.items.common.armor.SpiderArmor)

Example 10 with Hero

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

the class Buff method applyToCarriedItems.

protected void applyToCarriedItems(itemAction action) {
    if (target instanceof Hero) {
        Hero hero = (Hero) target;
        int n = 1;
        if (hero.getDifficulty() >= 3) {
            n = 5;
        }
        for (int i = 0; i < n; i++) {
            Item item = hero.belongings.randomUnequipped();
            if (item == null) {
                continue;
            }
            Item srcItem = item.detach(hero.belongings.backpack);
            item = action.act(srcItem);
            if (item == srcItem) {
                // item unaffected by buff
                collectOrDropItem(item);
                continue;
            }
            String actionText = null;
            if (item == null) {
                actionText = action.actionText(srcItem);
                action.carrierFx();
            } else {
                if (!item.equals(srcItem)) {
                    actionText = action.actionText(srcItem);
                    collectOrDropItem(item);
                    action.carrierFx();
                }
            }
            if (actionText != null) {
                GLog.w(actionText);
            }
        }
    } else if (target instanceof Thief) {
        if (((Thief) target).item == null) {
            return;
        }
        ((Thief) target).item = action.act(((Thief) target).item);
        action.carrierFx();
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Thief(com.watabou.pixeldungeon.actors.mobs.Thief) Hero(com.watabou.pixeldungeon.actors.hero.Hero)

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