@Override public float accuracyFactor( Char owner ) { int encumbrance = 0; if( owner instanceof Hero ){ encumbrance = STRReq() - ((Hero)owner).STR(); } if (hasEnchant(Wayward.class, owner)) encumbrance = Math.max(2, encumbrance+2); float ACC = this.ACC; return encumbrance > 0 ? (float)(ACC / Math.pow( 1.5, encumbrance )) : ACC; }
@Override public int attackSkill( Char target ) { return (int)((9 + Dungeon.depth) * weapon.accuracyFactor(this)); }
@Override public ArrayList<String> actions( Hero hero ) { ArrayList<String> actions = super.actions( hero ); actions.remove( AC_EQUIP ); return actions; }
public abstract int STRReq(int lvl);
@Override protected void onItemSelected( Item item ) { if (item instanceof SpiritBow){ if (((SpiritBow) item).enchantment == null){ ((Weapon)item).enchant(); } } else if (item instanceof Weapon) { ((Weapon) item).upgrade(true); } else { ((Armor) item).upgrade(true); } GLog.p( Messages.get(this, "infuse", item.name()) ); Badges.validateItemLevelAquired(item); curUser.sprite.emitter().start(Speck.factory(Speck.UP), 0.2f, 3); Enchanting.show(curUser, item); }
private Weapon changeWeapon( MeleeWeapon w ) { Weapon n; Category c = Generator.wepTiers[w.tier-1]; do { try { n = (MeleeWeapon)c.classes[Random.chances(c.probs)].newInstance(); } catch (Exception e) { ShatteredPixelDungeon.reportException(e); return null; } } while (Challenges.isItemBlocked(n) || n.getClass() == w.getClass()); int level = w.level(); if (level > 0) { n.upgrade( level ); } else if (level < 0) { n.degrade( -level ); } n.enchantment = w.enchantment; n.levelKnown = w.levelKnown; n.cursedKnown = w.cursedKnown; n.cursed = w.cursed; n.augment = w.augment; return n; }
@Override public int damageRoll() { return weapon.damageRoll(this); }
public Weapon enchant() { Class<? extends Enchantment> oldEnchantment = enchantment != null ? enchantment.getClass() : null; Enchantment ench = Enchantment.random( oldEnchantment ); return enchant( ench ); }
public boolean canSurpriseAttack(){ if (belongings.weapon == null || !(belongings.weapon instanceof Weapon)) return true; if (STR() < ((Weapon)belongings.weapon).STRReq()) return false; if (belongings.weapon instanceof Flail) return false; return true; }
if (w.hasCurseEnchant()){ w.enchant(null); procced = true;
@Override public boolean collect(Bag container) { if (container instanceof MagicalHolster) holster = true; return super.collect(container); }
@Override public boolean doPickUp(Hero hero) { parent = null; return super.doPickUp(hero); }
@Override protected boolean canAttack(Char enemy) { return super.canAttack(enemy) || weapon.canReach(this, enemy.pos); }
@Override public int drRoll() { return Random.NormalIntRange(0, Dungeon.depth + weapon.defenseFactor(this)); }
@Override protected void onItemSelected( Item item ) { if (item instanceof SpiritBow){ if (((SpiritBow) item).enchantment == null){ ((Weapon)item).enchant(); } } else if (item instanceof Weapon) { ((Weapon) item).upgrade(true); } else { ((Armor) item).upgrade(true); } GLog.p( Messages.get(this, "infuse", item.name()) ); Badges.validateItemLevelAquired(item); curUser.sprite.emitter().start(Speck.factory(Speck.UP), 0.2f, 3); Enchanting.show(curUser, item); }