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;
}
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"));
}
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;
}
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);
}
}
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;
}
Aggregations