use of com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon in project pixel-dungeon-remix by NYRDS.
the class Hero method attackProc.
@Override
public int attackProc(@NonNull Char enemy, int damage) {
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
if (wep != null) {
wep.proc(this, enemy, damage);
switch(subClass) {
case GLADIATOR:
if (wep instanceof MeleeWeapon) {
damage += Buff.affect(this, Combo.class).hit(enemy, damage);
}
break;
case BATTLEMAGE:
if (wep instanceof Wand) {
Wand wand = (Wand) wep;
if (wand.curCharges() < wand.maxCharges() && damage > 0) {
wand.curCharges(wand.curCharges() + 1);
QuickSlot.refresh();
ScrollOfRecharging.charge(this);
}
damage += wand.curCharges();
}
break;
case SNIPER:
if (rangedWeapon != null) {
Buff.prolong(enemy, SnipersMark.class, attackDelay() * 1.1f);
}
break;
case SHAMAN:
if (wep instanceof Wand) {
Wand wand = (Wand) wep;
if (wand.affectTarget()) {
if (Random.Int(4) == 0) {
wand.zap(enemy.getPos());
}
}
}
break;
default:
}
}
for (Item item : belongings) {
if (item instanceof IChaosItem && item.isEquipped(this)) {
((IChaosItem) item).ownerDoesDamage(this, damage);
}
}
return damage;
}
use of com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon in project pixel-dungeon by watabou.
the class Hero method attackProc.
@Override
public int attackProc(Char enemy, int damage) {
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
if (wep != null) {
wep.proc(this, enemy, damage);
switch(subClass) {
case GLADIATOR:
if (wep instanceof MeleeWeapon) {
damage += Buff.affect(this, Combo.class).hit(enemy, damage);
}
break;
case BATTLEMAGE:
if (wep instanceof Wand) {
Wand wand = (Wand) wep;
if (wand.curCharges >= wand.maxCharges) {
wand.use();
} else if (damage > 0) {
wand.curCharges++;
wand.updateQuickslot();
ScrollOfRecharging.charge(this);
}
damage += wand.curCharges;
}
case SNIPER:
if (rangedWeapon != null) {
Buff.prolong(this, SnipersMark.class, attackDelay() * 1.1f).object = enemy.id();
}
break;
default:
}
}
return damage;
}
use of com.watabou.pixeldungeon.items.weapon.melee.MeleeWeapon in project pixel-dungeon-remix by NYRDS.
the class ItemSlot method item.
public void item(Item item) {
if (item == null) {
active = false;
icon.setVisible(false);
emitter.setVisible(false);
emitter.on = false;
topLeft.setVisible(false);
topRight.setVisible(false);
bottomRight.setVisible(false);
return;
}
active = true;
icon.setVisible(true);
topLeft.setVisible(true);
topRight.setVisible(true);
bottomRight.setVisible(true);
icon.view(item);
if (item.emitter() != null) {
emitter.setVisible(true);
emitter.pour(item.emitter(), item.emitterInterval());
} else {
emitter.setVisible(false);
emitter.on = false;
}
topLeft.text(item.status());
boolean isArmor = item instanceof Armor;
boolean isWeapon = item instanceof Weapon;
if (isArmor || isWeapon) {
if (item.levelKnown || (isWeapon && !(item instanceof MeleeWeapon))) {
int str = isArmor ? ((Armor) item).STR : ((Weapon) item).STR;
topRight.text(Utils.format(TXT_STRENGTH, str));
if (str > Dungeon.hero.effectiveSTR()) {
topRight.hardlight(DEGRADED);
} else {
topRight.resetColor();
}
} else {
topRight.text(Utils.format(TXT_TYPICAL_STR, isArmor ? ((Armor) item).typicalSTR() : ((MeleeWeapon) item).typicalSTR()));
topRight.hardlight(WARNING);
}
topRight.measure();
} else {
topRight.text(null);
}
int level = item.visiblyUpgraded();
if (level != 0) {
bottomRight.text(Utils.format(TXT_LEVEL, level));
bottomRight.measure();
bottomRight.hardlight(level > 0 ? UPGRADED : DEGRADED);
} else {
bottomRight.text(null);
}
if (item instanceof Artifact) {
Artifact artifact = (Artifact) item;
String text = artifact.getText();
if (text != null) {
topLeft.text(artifact.getText());
topLeft.hardlight(artifact.getColor());
topLeft.setVisible(true);
topLeft.measure();
}
}
layout();
}
Aggregations