Search in sources :

Example 11 with Buff

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

the class Char method resist.

// returns percent effectiveness after resistances
// TODO currently resistances reduce effectiveness by a static 50%, and do not stack.
public float resist(Class effect) {
    HashSet<Class> resists = new HashSet<>(resistances);
    for (Property p : properties()) {
        resists.addAll(p.resistances());
    }
    for (Buff b : buffs()) {
        resists.addAll(b.resistances());
    }
    float result = 1f;
    for (Class c : resists) {
        if (c.isAssignableFrom(effect)) {
            result *= 0.5f;
        }
    }
    return result * RingOfElements.resist(this, effect);
}
Also used : HeroSubClass(com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass) Buff(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff) HashSet(java.util.HashSet)

Example 12 with Buff

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

the class Hero method actDescend.

private boolean actDescend(HeroAction.Descend action) {
    int stairs = action.dst;
    if (pos == stairs && pos == Dungeon.level.exit) {
        curAction = null;
        Buff buff = buff(TimekeepersHourglass.timeFreeze.class);
        if (buff != null)
            buff.detach();
        InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
        Game.switchScene(InterlevelScene.class);
        return false;
    } else if (getCloser(stairs)) {
        return true;
    } else {
        ready();
        return false;
    }
}
Also used : TimekeepersHourglass(com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass) Buff(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff) FlavourBuff(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff)

Example 13 with Buff

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

the class BuffIndicator method layout.

@Override
protected void layout() {
    ArrayList<Buff> newBuffs = new ArrayList<>();
    for (Buff buff : ch.buffs()) {
        if (buff.icon() != NONE) {
            newBuffs.add(buff);
        }
    }
    // remove any icons no longer present
    for (Buff buff : buffIcons.keySet().toArray(new Buff[0])) {
        if (!newBuffs.contains(buff)) {
            Image icon = buffIcons.get(buff).icon;
            icon.origin.set(SIZE / 2);
            add(icon);
            add(new AlphaTweener(icon, 0, 0.6f) {

                @Override
                protected void updateValues(float progress) {
                    super.updateValues(progress);
                    image.scale.set(1 + 5 * progress);
                }

                @Override
                protected void onComplete() {
                    image.killAndErase();
                }
            });
            buffIcons.get(buff).destroy();
            remove(buffIcons.get(buff));
            buffIcons.remove(buff);
        }
    }
    // add new icons
    for (Buff buff : newBuffs) {
        if (!buffIcons.containsKey(buff)) {
            BuffIcon icon = new BuffIcon(buff);
            add(icon);
            buffIcons.put(buff, icon);
        }
    }
    // layout
    int pos = 0;
    for (BuffIcon icon : buffIcons.values()) {
        icon.updateIcon();
        icon.setRect(x + pos * (SIZE + 2), y, 9, 12);
        pos++;
    }
}
Also used : ArrayList(java.util.ArrayList) AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener) Buff(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff) WndInfoBuff(com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoBuff) Image(com.watabou.noosa.Image)

Aggregations

Buff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff)13 FlavourBuff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff)5 TimekeepersHourglass (com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass)4 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)3 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)2 Awareness (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness)1 Corruption (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption)1 MindVision (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision)1 PinCushion (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion)1 SoulMark (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SoulMark)1 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)1 HeroSubClass (com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass)1 Bee (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee)1 King (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.King)1 Mimic (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic)1 Piranha (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Piranha)1 Statue (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue)1 Swarm (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Swarm)1 Wraith (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith)1 Yog (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Yog)1