Search in sources :

Example 51 with Char

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

the class WandOfFrost method onZap.

@Override
protected void onZap(Ballistica bolt) {
    Heap heap = Dungeon.level.heaps.get(bolt.collisionPos);
    if (heap != null) {
        heap.freeze();
    }
    Char ch = Actor.findChar(bolt.collisionPos);
    if (ch != null) {
        int damage = damageRoll();
        if (ch.buff(Frost.class) != null) {
            // do nothing, can't affect a frozen target
            return;
        }
        if (ch.buff(Chill.class) != null) {
            // 7.5% less damage per turn of chill remaining
            float chill = ch.buff(Chill.class).cooldown();
            damage = (int) Math.round(damage * Math.pow(0.9f, chill));
        } else {
            ch.sprite.burst(0xFF99CCFF, level() / 2 + 2);
        }
        processSoulMark(ch, chargesPerCast());
        ch.damage(damage, this);
        if (ch.isAlive()) {
            if (Dungeon.level.water[ch.pos])
                Buff.prolong(ch, Chill.class, 4 + level());
            else
                Buff.prolong(ch, Chill.class, 2 + level());
        }
    } else {
        Dungeon.level.press(bolt.collisionPos, null, true);
    }
}
Also used : Chill(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Chill) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Frost(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost) Heap(com.shatteredpixel.shatteredpixeldungeon.items.Heap)

Example 52 with Char

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

the class WandOfRegrowth method onZap.

@Override
protected void onZap(Ballistica bolt) {
    // ignore tiles which can't have anything grow in them.
    for (Iterator<Integer> i = affectedCells.iterator(); i.hasNext(); ) {
        int c = Dungeon.level.map[i.next()];
        if (!(c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO || c == Terrain.GRASS || c == Terrain.HIGH_GRASS)) {
            i.remove();
        }
    }
    float numPlants, numDews, numPods, numStars;
    int chrgUsed = chargesPerCast();
    // numbers greater than n*100% means n guaranteed plants, e.g. 210% = 2 plants w/10% chance for 3 plants.
    // scales from 22% to 220%
    numPlants = 0.2f + chrgUsed * chrgUsed * 0.020f;
    // scales from 6.6% to 165%
    numDews = 0.05f + chrgUsed * chrgUsed * 0.016f;
    // scales from 3.3% to 135%
    numPods = 0.02f + chrgUsed * chrgUsed * 0.013f;
    // scales from 0.1% to 100%
    numStars = (chrgUsed * chrgUsed * chrgUsed / 5f) * 0.005f;
    placePlants(numPlants, numDews, numPods, numStars);
    for (int i : affectedCells) {
        int c = Dungeon.level.map[i];
        if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) {
            Level.set(i, Terrain.GRASS);
        }
        Char ch = Actor.findChar(i);
        if (ch != null) {
            processSoulMark(ch, chargesPerCast());
        }
        GameScene.add(Blob.seed(i, 10, Regrowth.class));
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char) Regrowth(com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth)

Example 53 with Char

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

the class MissileWeapon method onThrow.

@Override
protected void onThrow(int cell) {
    Char enemy = Actor.findChar(cell);
    if (enemy == null || enemy == curUser) {
        parent = null;
        super.onThrow(cell);
    } else {
        if (!curUser.shoot(enemy, this)) {
            rangedMiss(cell);
        } else {
            rangedHit(enemy, cell);
        }
    }
}
Also used : Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char)

Example 54 with Char

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

the class MissileWeapon method castDelay.

@Override
public float castDelay(Char user, int dst) {
    float delay = speedFactor(user);
    Char enemy = Actor.findChar(dst);
    if (enemy != null) {
        SnipersMark mark = user.buff(SnipersMark.class);
        if (mark != null) {
            if (mark.object == enemy.id()) {
                delay *= 0.5f;
            }
        }
    }
    return delay;
}
Also used : SnipersMark(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SnipersMark) Char(com.shatteredpixel.shatteredpixeldungeon.actors.Char)

Example 55 with Char

use of com.shatteredpixel.shatteredpixeldungeon.actors.Char 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)

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