Search in sources :

Example 1 with Char

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

the class WandOfBlastWave method onZap.

@Override
protected void onZap(Ballistica bolt) {
    Sample.INSTANCE.play(Assets.SND_BLAST);
    BlastWave.blast(bolt.collisionPos);
    int damage = damageRoll();
    // presses all tiles in the AOE first
    for (int i : PathFinder.NEIGHBOURS9) {
        Dungeon.level.press(bolt.collisionPos + i, Actor.findChar(bolt.collisionPos + i), true);
    }
    // throws other chars around the center.
    for (int i : PathFinder.NEIGHBOURS8) {
        Char ch = Actor.findChar(bolt.collisionPos + i);
        if (ch != null) {
            processSoulMark(ch, chargesPerCast());
            ch.damage(Math.round(damage * 0.667f), this);
            if (ch.isAlive()) {
                Ballistica trajectory = new Ballistica(ch.pos, ch.pos + i, Ballistica.MAGIC_BOLT);
                int strength = 1 + Math.round(level() / 2f);
                throwChar(ch, trajectory, strength);
            }
        }
    }
    // throws the char at the center of the blast
    Char ch = Actor.findChar(bolt.collisionPos);
    if (ch != null) {
        processSoulMark(ch, chargesPerCast());
        ch.damage(damage, this);
        if (ch.isAlive() && bolt.path.size() > bolt.dist + 1) {
            Ballistica trajectory = new Ballistica(ch.pos, bolt.path.get(bolt.dist + 1), Ballistica.MAGIC_BOLT);
            int strength = level() + 3;
            throwChar(ch, trajectory, strength);
        }
    }
    if (!curUser.isAlive()) {
        Dungeon.fail(getClass());
        GLog.n(Messages.get(this, "ondeath"));
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Ballistica(com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica)

Example 2 with Char

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

the class WandOfFireblast method onZap.

@Override
protected void onZap(Ballistica bolt) {
    for (int cell : affectedCells) {
        // ignore caster cell
        if (cell == bolt.sourcePos) {
            continue;
        }
        // only ignite cells directly near caster if they are flammable
        if (!Dungeon.level.adjacent(bolt.sourcePos, cell) || Dungeon.level.flamable[cell]) {
            GameScene.add(Blob.seed(cell, 1 + chargesPerCast(), Fire.class));
        }
        Char ch = Actor.findChar(cell);
        if (ch != null) {
            processSoulMark(ch, chargesPerCast());
            ch.damage(damageRoll(), this);
            Buff.affect(ch, Burning.class).reignite(ch);
            switch(chargesPerCast()) {
                case 1:
                    // no effects
                    break;
                case 2:
                    Buff.affect(ch, Cripple.class, 4f);
                    break;
                case 3:
                    Buff.affect(ch, Paralysis.class, 4f);
                    break;
            }
        }
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Fire(com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire) Burning(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning)

Example 3 with Char

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

the class WandOfLightning method arc.

private void arc(Char ch) {
    affected.add(ch);
    int dist;
    if (Dungeon.level.water[ch.pos] && !ch.flying)
        dist = 2;
    else
        dist = 1;
    PathFinder.buildDistanceMap(ch.pos, BArray.not(Dungeon.level.solid, null), dist);
    for (int i = 0; i < PathFinder.distance.length; i++) {
        if (PathFinder.distance[i] < Integer.MAX_VALUE) {
            Char n = Actor.findChar(i);
            if (n == Dungeon.hero && PathFinder.distance[i] > 1)
                // the hero is only zapped if they are adjacent
                continue;
            else if (n != null && !affected.contains(n)) {
                arcs.add(new Lightning.Arc(ch.sprite.center(), n.sprite.center()));
                arc(n);
            }
        }
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char)

Example 4 with Char

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

the class WandOfPrismaticLight method onZap.

@Override
protected void onZap(Ballistica beam) {
    Char ch = Actor.findChar(beam.collisionPos);
    if (ch != null) {
        processSoulMark(ch, chargesPerCast());
        affectTarget(ch);
    }
    affectMap(beam);
    if (Dungeon.level.viewDistance < 6) {
        if (Dungeon.isChallenged(Challenges.DARKNESS)) {
            Buff.prolong(curUser, Light.class, 2f + level());
        } else {
            Buff.prolong(curUser, Light.class, 10f + level() * 5);
        }
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char)

Example 5 with Char

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

the class WandOfMagicMissile method onZap.

@Override
protected void onZap(Ballistica bolt) {
    Char ch = Actor.findChar(bolt.collisionPos);
    if (ch != null) {
        processSoulMark(ch, chargesPerCast());
        ch.damage(damageRoll(), this);
        ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2);
    } else {
        Dungeon.level.press(bolt.collisionPos, null, true);
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char)

Aggregations

Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)65 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)13 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)13 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)8 Callback (com.watabou.utils.Callback)8 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)7 Ballistica (com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica)5 ArrayList (java.util.ArrayList)4 Actor (com.shatteredpixel.shatteredpixeldungeon.actors.Actor)3 Fire (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire)3 Buff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff)3 Burning (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning)3 Frost (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost)3 Bleeding (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding)2 Chill (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Chill)2 Paralysis (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis)2 Lightning (com.shatteredpixel.shatteredpixeldungeon.effects.Lightning)2 Blob (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob)1 CorrosiveGas (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.CorrosiveGas)1 Regrowth (com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth)1