package module.item.instance.chapter0;

import module.character.api.ICharacter;
import module.character.constants.CAttribute.attribute;
import module.character.constants.CStatus.status;
import module.item.AbstractWeapon;
import module.server.PlayerServer;

public class Speaker extends AbstractWeapon{

	public Speaker(){
		this("¤jÁn¤½", "speaker");
		this.setDescription("¥i¥H§âÁn­µ©ñ¤jªº¤jÁn¤½¡A¤u¦aºÊ¤u¥²³Æ¥Î«~¡C");
		this.setWeaponType(WeaponType.AMPLIFIER);
		
		this.hitRatio = 0.8;
		this.statMap.put(status.WEAPON_ATTACK, 8);
	}
	
	public Speaker(String chiName, String engName) {
		super(chiName, engName);
	}

	@Override
	public void onAttack(ICharacter src, ICharacter target) {
		int ddd = PlayerServer.getRandom().nextInt(10);
		if (ddd >= 5){
			String msg = String.format("%s¦]¬°¾_°Ê¦ÓÃz¥X¨ë¦Õªº°ª­µ¡AÅý%s¤Q¤ÀÃø¨ü!\n", 
					this.getChiName(), target.getChiName());
			int damage = PlayerServer.getRandom().nextInt(5) + 1;
			msg += target.getChiName() + "¨ü¨ì¤F" + damage + "ÂI¶Ë®`¡C\n";
			target.setCurrentAttribute(attribute.HP, 
					target.getCurrentAttribute(attribute.HP) - damage);
			src.getAtRoom().informRoom(msg);
		}
	}

}
