Search in sources :

Example 1 with Bee

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

the class Honeypot method shatter.

public Item shatter(Char owner, int pos) {
    if (Dungeon.level.heroFOV[pos]) {
        Sample.INSTANCE.play(Assets.SND_SHATTER);
        Splash.at(pos, 0xffd500, 5);
    }
    int newPos = pos;
    if (Actor.findChar(pos) != null) {
        ArrayList<Integer> candidates = new ArrayList<Integer>();
        boolean[] passable = Dungeon.level.passable;
        for (int n : PathFinder.NEIGHBOURS4) {
            int c = pos + n;
            if (passable[c] && Actor.findChar(c) == null) {
                candidates.add(c);
            }
        }
        newPos = candidates.size() > 0 ? Random.element(candidates) : -1;
    }
    if (newPos != -1) {
        Bee bee = new Bee();
        bee.spawn(Dungeon.depth);
        bee.setPotInfo(pos, owner);
        bee.HP = bee.HT;
        bee.pos = newPos;
        GameScene.add(bee);
        Actor.addDelayed(new Pushing(bee, pos, newPos), -1f);
        bee.sprite.alpha(0);
        bee.sprite.parent.add(new AlphaTweener(bee.sprite, 1, 0.15f));
        Sample.INSTANCE.play(Assets.SND_BEE);
        return new ShatteredPot().setBee(bee);
    } else {
        return this;
    }
}
Also used : Bee(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee) Pushing(com.shatteredpixel.shatteredpixeldungeon.effects.Pushing) ArrayList(java.util.ArrayList) AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener)

Example 2 with Bee

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

the class SecretHoneypotRoom method paint.

@Override
public void paint(Level level) {
    Painter.fill(level, this, Terrain.WALL);
    Painter.fill(level, this, 1, Terrain.EMPTY);
    Point brokenPotPos = center();
    brokenPotPos.x = (brokenPotPos.x + entrance().x) / 2;
    brokenPotPos.y = (brokenPotPos.y + entrance().y) / 2;
    Honeypot.ShatteredPot pot = new Honeypot.ShatteredPot();
    level.drop(pot, level.pointToCell(brokenPotPos));
    Bee bee = new Bee();
    bee.spawn(Dungeon.depth);
    bee.HP = bee.HT;
    bee.pos = level.pointToCell(brokenPotPos);
    level.mobs.add(bee);
    pot.setBee(bee);
    bee.setPotInfo(level.pointToCell(brokenPotPos), null);
    placeItem(new Honeypot(), level);
    placeItem(Random.Int(3) == 0 ? new Bomb.DoubleBomb() : new Bomb(), level);
    if (Random.Int(2) == 0) {
        placeItem(new Bomb(), level);
    }
    entrance().set(Door.Type.HIDDEN);
}
Also used : Bee(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee) Point(com.watabou.utils.Point) Bomb(com.shatteredpixel.shatteredpixeldungeon.items.Bomb) Honeypot(com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)

Example 3 with Bee

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

the class WandOfCorruption method onZap.

@Override
protected void onZap(Ballistica bolt) {
    Char ch = Actor.findChar(bolt.collisionPos);
    if (ch != null) {
        if (!(ch instanceof Mob)) {
            return;
        }
        Mob enemy = (Mob) ch;
        float corruptingPower = 2 + level();
        // base enemy resistance is usually based on their exp, but in special cases it is based on other criteria
        float enemyResist = 1 + enemy.EXP;
        if (ch instanceof Mimic || ch instanceof Statue) {
            enemyResist = 1 + Dungeon.depth;
        } else if (ch instanceof Piranha || ch instanceof Bee) {
            enemyResist = 1 + Dungeon.depth / 2f;
        } else if (ch instanceof Wraith) {
            // this is so low because wraiths are always at max hp
            enemyResist = 0.5f + Dungeon.depth / 8f;
        } else if (ch instanceof Yog.BurningFist || ch instanceof Yog.RottingFist) {
            enemyResist = 1 + 30;
        } else if (ch instanceof Yog.Larva || ch instanceof King.Undead) {
            enemyResist = 1 + 5;
        } else if (ch instanceof Swarm) {
            // child swarms don't give exp, so we force this here.
            enemyResist = 1 + 3;
        }
        // 100% health: 3x resist   75%: 2.1x resist   50%: 1.5x resist   25%: 1.1x resist
        enemyResist *= 1 + 2 * Math.pow(enemy.HP / (float) enemy.HT, 2);
        // debuffs placed on the enemy reduce their resistance
        for (Buff buff : enemy.buffs()) {
            if (MAJOR_DEBUFFS.containsKey(buff.getClass()))
                enemyResist *= MAJOR_DEBUFF_WEAKEN;
            else if (MINOR_DEBUFFS.containsKey(buff.getClass()))
                enemyResist *= MINOR_DEBUFF_WEAKEN;
            else if (buff.type == Buff.buffType.NEGATIVE)
                enemyResist *= MINOR_DEBUFF_WEAKEN;
        }
        // cannot re-corrupt or doom an enemy, so give them a major debuff instead
        if (enemy.buff(Corruption.class) != null || enemy.buff(Doom.class) != null) {
            enemyResist = corruptingPower * .99f;
        }
        if (corruptingPower > enemyResist) {
            corruptEnemy(enemy);
        } else {
            float debuffChance = corruptingPower / enemyResist;
            if (Random.Float() < debuffChance) {
                debuffEnemy(enemy, MAJOR_DEBUFFS);
            } else {
                debuffEnemy(enemy, MINOR_DEBUFFS);
            }
        }
        processSoulMark(ch, chargesPerCast());
    } else {
        Dungeon.level.press(bolt.collisionPos, null, true);
    }
}
Also used : Mob(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob) Bee(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee) Mimic(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic) Piranha(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Piranha) FlavourBuff(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff) Buff(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff) Yog(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Yog) Swarm(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Swarm) King(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.King) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Statue(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue) Wraith(com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith)

Aggregations

Bee (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee)3 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)1 Buff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff)1 FlavourBuff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff)1 King (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.King)1 Mimic (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic)1 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)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 Pushing (com.shatteredpixel.shatteredpixeldungeon.effects.Pushing)1 Bomb (com.shatteredpixel.shatteredpixeldungeon.items.Bomb)1 Honeypot (com.shatteredpixel.shatteredpixeldungeon.items.Honeypot)1 AlphaTweener (com.watabou.noosa.tweeners.AlphaTweener)1 Point (com.watabou.utils.Point)1 ArrayList (java.util.ArrayList)1