예제 #1
0
	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 );
	}
예제 #2
0
	@Override
	public boolean isUpgradable() {
		if (enchantment != null && enchantment.getClass() == Ancient.class) {
			return false;
		}
		return super.isUpgradable();
	}
예제 #3
0
	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();
	}
예제 #4
0
	@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 );
			}
		}
	}
예제 #5
0
	@Override
	public ItemSprite.Glowing glowing() {
		return enchantment != null ? enchantment.glowing() : null;
	}
예제 #6
0
	@Override
	public String name() {
		return enchantment == null ? super.name() : enchantment.name(super.name());
	}