Search in sources :

Example 1 with KindOfWeapon

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

the class Monk method attackProc.

@Override
public int attackProc(Char enemy, int damage) {
    damage = super.attackProc(enemy, damage);
    if (enemy == Dungeon.hero) {
        Hero hero = Dungeon.hero;
        KindOfWeapon weapon = hero.belongings.weapon;
        if (weapon != null && !(weapon instanceof Knuckles) && !(weapon instanceof Gauntlet) && !weapon.cursed) {
            if (hitsToDisarm == 0)
                hitsToDisarm = Random.NormalIntRange(4, 8);
            if (--hitsToDisarm == 0) {
                hero.belongings.weapon = null;
                Dungeon.quickslot.convertToPlaceholder(weapon);
                weapon.updateQuickslot();
                Dungeon.level.drop(weapon, hero.pos).sprite.drop();
                GLog.w(Messages.get(this, "disarm", weapon.name()));
            }
        }
    }
    return damage;
}
Also used : Knuckles(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Knuckles) Gauntlet(com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Gauntlet) Hero(com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero) KindOfWeapon(com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon)

Example 2 with KindOfWeapon

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

the class CursingTrap method curse.

public static void curse(Hero hero) {
    // items the trap wants to curse because it will create a more negative effect
    ArrayList<Item> priorityCurse = new ArrayList<>();
    // items the trap can curse if nothing else is available.
    ArrayList<Item> canCurse = new ArrayList<>();
    KindOfWeapon weapon = hero.belongings.weapon;
    if (weapon instanceof Weapon && !weapon.cursed && !(weapon instanceof Boomerang)) {
        if (((Weapon) weapon).enchantment == null)
            priorityCurse.add(weapon);
        else
            canCurse.add(weapon);
    }
    Armor armor = hero.belongings.armor;
    if (armor != null && !armor.cursed) {
        if (armor.glyph == null)
            priorityCurse.add(armor);
        else
            canCurse.add(armor);
    }
    KindofMisc misc1 = hero.belongings.misc1;
    if (misc1 != null) {
        canCurse.add(misc1);
    }
    KindofMisc misc2 = hero.belongings.misc2;
    if (misc2 != null) {
        canCurse.add(misc2);
    }
    Collections.shuffle(priorityCurse);
    Collections.shuffle(canCurse);
    int numCurses = Random.Int(2) == 0 ? 1 : 2;
    for (int i = 0; i < numCurses; i++) {
        if (!priorityCurse.isEmpty()) {
            curse(priorityCurse.remove(0));
        } else if (!canCurse.isEmpty()) {
            curse(canCurse.remove(0));
        }
    }
    EquipableItem.equipCursed(hero);
    GLog.n(Messages.get(CursingTrap.class, "curse"));
}
Also used : EquipableItem(com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem) Item(com.shatteredpixel.shatteredpixeldungeon.items.Item) Armor(com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor) KindofMisc(com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc) ArrayList(java.util.ArrayList) KindOfWeapon(com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon) Boomerang(com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang) KindOfWeapon(com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon) Weapon(com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon)

Example 3 with KindOfWeapon

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

the class Hero method damageRoll.

@Override
public int damageRoll() {
    KindOfWeapon wep = belongings.weapon;
    int dmg;
    if (wep != null) {
        dmg = wep.damageRoll(this) + RingOfForce.armedDamageBonus(this);
    } else {
        dmg = RingOfForce.damageRoll(this);
    }
    if (dmg < 0)
        dmg = 0;
    if (subClass == HeroSubClass.BERSERKER) {
        berserk = Buff.affect(this, Berserk.class);
        dmg = berserk.damageFactor(dmg);
    }
    return buff(Fury.class) != null ? (int) (dmg * 1.5f) : dmg;
}
Also used : KindOfWeapon(com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon) Berserk(com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Berserk)

Example 4 with KindOfWeapon

use of com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon 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 5 with KindOfWeapon

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

the class Hero method shoot.

public boolean shoot(Char enemy, MissileWeapon wep) {
    // temporarily set the hero's weapon to the missile weapon being used
    KindOfWeapon equipped = belongings.weapon;
    belongings.weapon = wep;
    rangedAttack = true;
    boolean result = attack(enemy);
    Invisibility.dispel();
    belongings.weapon = equipped;
    rangedAttack = false;
    return result;
}
Also used : KindOfWeapon(com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon)

Aggregations

KindOfWeapon (com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon)7 Hero (com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero)2 Item (com.shatteredpixel.shatteredpixeldungeon.items.Item)2 Knuckles (com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Knuckles)2 Berserk (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Berserk)1 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)1 EquipableItem (com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem)1 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)1 KindofMisc (com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc)1 Armor (com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor)1 Weapon (com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon)1 Gauntlet (com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Gauntlet)1 Boomerang (com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang)1 MissileWeapon (com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon)1 ArrayList (java.util.ArrayList)1