Search in sources :

Example 1 with MissileWeapon

use of com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon in project shattered-pixel-dungeon-gdx by 00-Evan.

the class GnollTrickster method createLoot.

@Override
protected Item createLoot() {
    MissileWeapon drop = (MissileWeapon) super.createLoot();
    // half quantity, rounded up
    drop.quantity((drop.quantity() + 1) / 2);
    return drop;
}
Also used : MissileWeapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)

Example 2 with MissileWeapon

use of com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Hero method attackSkill.

@Override
public int attackSkill(Char target) {
    KindOfWeapon wep = belongings.weapon;
    float accuracy = 1;
    if (wep instanceof MissileWeapon && rangedAttack && Dungeon.level.distance(pos, target.pos) == 1) {
        accuracy *= 0.5f;
    }
    if (wep != null) {
        return (int) (attackSkill * accuracy * wep.accuracyFactor(this));
    } else {
        return (int) (attackSkill * accuracy);
    }
}
Also used : KindOfWeapon(com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon) MissileWeapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)

Example 3 with MissileWeapon

use of com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Generator method randomMissile.

public static MissileWeapon randomMissile(int floorSet) {
    floorSet = (int) GameMath.gate(0, floorSet, floorSetTierProbs.length - 1);
    try {
        Category c = misTiers[Random.chances(floorSetTierProbs[floorSet])];
        MissileWeapon w = (MissileWeapon) c.classes[Random.chances(c.probs)].newInstance();
        w.random();
        return w;
    } catch (Exception e) {
        ShatteredPixelDungeon.reportException(e);
        return null;
    }
}
Also used : MissileWeapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)

Example 4 with MissileWeapon

use of com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon in project shattered-pixel-dungeon-gdx by 00-Evan.

the class ShopRoom method ChooseBag.

protected static Bag ChooseBag(Belongings pack) {
    // 0=pouch, 1=holder, 2=bandolier, 3=holster
    int[] bagItems = new int[4];
    // count up items in the main bag
    for (Item item : pack.backpack.items) {
        if (item instanceof Plant.Seed || item instanceof Runestone)
            bagItems[0]++;
        if (item instanceof Scroll)
            bagItems[1]++;
        if (item instanceof Potion)
            bagItems[2]++;
        if (item instanceof Wand || item instanceof MissileWeapon)
            bagItems[3]++;
    }
    // disqualify bags that have already been dropped
    if (Dungeon.LimitedDrops.VELVET_POUCH.dropped())
        bagItems[0] = -1;
    if (Dungeon.LimitedDrops.SCROLL_HOLDER.dropped())
        bagItems[1] = -1;
    if (Dungeon.LimitedDrops.POTION_BANDOLIER.dropped())
        bagItems[2] = -1;
    if (Dungeon.LimitedDrops.MAGICAL_HOLSTER.dropped())
        bagItems[3] = -1;
    // find the best bag to drop. This does give a preference to later bags, if counts are equal
    int bestBagIdx = 0;
    for (int i = 1; i <= 3; i++) {
        if (bagItems[bestBagIdx] <= bagItems[i]) {
            bestBagIdx = i;
        }
    }
    // drop it, or return nothing if no bag works
    if (bagItems[bestBagIdx] == -1)
        return null;
    switch(bestBagIdx) {
        case 0:
        default:
            Dungeon.LimitedDrops.VELVET_POUCH.drop();
            return new VelvetPouch();
        case 1:
            Dungeon.LimitedDrops.SCROLL_HOLDER.drop();
            return new ScrollHolder();
        case 2:
            Dungeon.LimitedDrops.POTION_BANDOLIER.drop();
            return new PotionBandolier();
        case 3:
            Dungeon.LimitedDrops.MAGICAL_HOLSTER.drop();
            return new MagicalHolster();
    }
}
Also used : Potion(com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion) Scroll(com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll) Wand(com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand) VelvetPouch(com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch) ScrollHolder(com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder) Runestone(com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone) Point(com.watabou.utils.Point) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Plant(com.shatteredpixel.shatteredpixeldungeon.plants.Plant) MagicalHolster(com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster) PotionBandolier(com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier) MissileWeapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)

Example 5 with MissileWeapon

use of com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Char method attack.

public boolean attack(Char enemy) {
    if (enemy == null || !enemy.isAlive())
        return false;
    boolean visibleFight = Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[enemy.pos];
    if (hit(this, enemy, false)) {
        int dr = enemy.drRoll();
        if (this instanceof Hero) {
            Hero h = (Hero) this;
            if (h.belongings.weapon instanceof MissileWeapon && h.subClass == HeroSubClass.SNIPER) {
                dr = 0;
            }
        }
        int dmg;
        Preparation prep = buff(Preparation.class);
        if (prep != null) {
            dmg = prep.damageRoll(this, enemy);
        } else {
            dmg = damageRoll();
        }
        int effectiveDamage = Math.max(dmg - dr, 0);
        effectiveDamage = attackProc(enemy, effectiveDamage);
        effectiveDamage = enemy.defenseProc(this, effectiveDamage);
        if (visibleFight) {
            Sample.INSTANCE.play(Assets.SND_HIT, 1, 1, Random.Float(0.8f, 1.25f));
        }
        if (enemy == Dungeon.hero) {
            Dungeon.hero.interrupt();
        }
        // This matters as defence procs can sometimes inflict self-damage, such as armor glyphs.
        if (!enemy.isAlive()) {
            return true;
        }
        // TODO: consider revisiting this and shaking in more cases.
        float shake = 0f;
        if (enemy == Dungeon.hero)
            shake = effectiveDamage / (enemy.HT / 4);
        if (shake > 1f)
            Camera.main.shake(GameMath.gate(1, shake, 5), 0.3f);
        enemy.damage(effectiveDamage, this);
        if (buff(FireImbue.class) != null)
            buff(FireImbue.class).proc(enemy);
        if (buff(EarthImbue.class) != null)
            buff(EarthImbue.class).proc(enemy);
        enemy.sprite.bloodBurstA(sprite.center(), effectiveDamage);
        enemy.sprite.flash();
        if (!enemy.isAlive() && visibleFight) {
            if (enemy == Dungeon.hero) {
                Dungeon.fail(getClass());
                GLog.n(Messages.capitalize(Messages.get(Char.class, "kill", name)));
            } else if (this == Dungeon.hero) {
                GLog.i(Messages.capitalize(Messages.get(Char.class, "defeat", enemy.name)));
            }
        }
        return true;
    } else {
        if (visibleFight) {
            String defense = enemy.defenseVerb();
            enemy.sprite.showStatus(CharSprite.NEUTRAL, defense);
            Sample.INSTANCE.play(Assets.SND_MISS);
        }
        return false;
    }
}
Also used : FireImbue(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FireImbue) Preparation(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Preparation) EarthImbue(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.EarthImbue) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) MissileWeapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)

Aggregations

MissileWeapon (com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)5 EarthImbue (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.EarthImbue)1 FireImbue (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FireImbue)1 Preparation (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Preparation)1 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)1 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)1 KindOfWeapon (com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon)1 MagicalHolster (com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster)1 PotionBandolier (com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier)1 ScrollHolder (com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder)1 VelvetPouch (com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch)1 Potion (com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion)1 Scroll (com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll)1 Runestone (com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone)1 Wand (com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand)1 Plant (com.shatteredpixel.shatteredpixeldungeon.plants.Plant)1 Point (com.watabou.utils.Point)1