public Weapon enchant() { Class<? extends Enchantment> oldEnchantment = enchantment != null ? enchantment.getClass() : null; Enchantment ench = Enchantment.random(); while (ench.getClass() == oldEnchantment) { ench = Enchantment.random(); } return enchant( ench ); }
@Override public boolean isUpgradable() { if (enchantment != null && enchantment.getClass() == Ancient.class) { return false; } return super.isUpgradable(); }
public Item upgrade( boolean enchant ) { if (enchantment != null) { if (!enchant && Random.Int( level ) > 0 && (enchantment.getClass() != Ancient.class)) { GLog.w( TXT_INCOMPATIBLE ); enchant( null ); } } else { if (enchant) { enchant( ); } } return super.upgrade(); }
@Override public void proc( Char attacker, Char defender, int damage ) { if (enchantment != null) { enchantment.proc( this, attacker, defender, damage ); } if (!levelKnown) { if (--hitsToKnow <= 0) { levelKnown = true; GLog.i( TXT_IDENTIFY, name(), toString() ); Badges.validateItemLevelAquired( this ); } } }
@Override public ItemSprite.Glowing glowing() { return enchantment != null ? enchantment.glowing() : null; }
@Override public String name() { return enchantment == null ? super.name() : enchantment.name(super.name()); }