@Override protected void onEvtAttacked(Creature attacker, int damage) { super.onEvtAttacked(attacker, damage); OrfenInstance actor = getActor(); if (actor.isCastingNow()) { return; } double distance = actor.getDistance(attacker); // if(attacker.isMuted() &&) if (distance > 300 && distance < 1000 && _damSkills.length > 0 && Rnd.chance(10)) { Functions.npcSay( actor, MsgOnRecall[Rnd.get(MsgOnRecall.length - 1)].sprintf(attacker.getName())); teleToLocation(attacker, Location.findFrontPosition(actor, attacker, 0, 50)); Skill r_skill = _damSkills[Rnd.get(_damSkills.length)]; if (canUseSkill(r_skill, attacker, -1)) { addTaskAttack(attacker, r_skill, 1000000); } } else if (_paralyze.length > 0 && Rnd.chance(20)) { Skill r_skill = _paralyze[Rnd.get(_paralyze.length)]; if (canUseSkill(r_skill, attacker, -1)) { addTaskAttack(attacker, r_skill, 1000000); } } }
@Override public void onDeath(Creature actor, Creature killer) { if (getOrderByTargetName(actor.getName()) != null && !actor.getName().equals(killer.getName())) { final Order order = getOrderByTargetName(actor.getName()); Functions.addItem(killer.getPlayer(), order.getItemId(), order.getItemCount()); Announcements.getInstance() .announceToAll( new CustomMessage( "scripts.events.Hitman.AnnounceKill", killer.getPlayer(), killer.getName(), actor.getName(), order.getItemCount(), ItemFunctions.createItem(order.getItemId()).getTemplate().getName()) .toString()); if (order.getKillsCount() > 1) order.decrementKillsCount(); else { _orderMap.remove(World.getPlayer(order.getOwner()).getObjectId()); _inList.remove((Object) World.getPlayer(order.getOwner()).getObjectId()); deleteFromDatabase(actor.getName()); } } }
@Override protected void onEvtSeeSpell(Skill skill, Creature caster) { super.onEvtSeeSpell(skill, caster); OrfenInstance actor = getActor(); if (actor.isCastingNow()) { return; } double distance = actor.getDistance(caster); if (_damSkills.length > 0 && skill.getEffectPoint() > 0 && distance < 1000 && Rnd.chance(20)) { Functions.npcSay(actor, MsgOnRecall[Rnd.get(MsgOnRecall.length)].sprintf(caster.getName())); teleToLocation(caster, Location.findFrontPosition(actor, caster, 0, 50)); Skill r_skill = _damSkills[Rnd.get(_damSkills.length)]; if (canUseSkill(r_skill, caster, -1)) { addTaskAttack(caster, r_skill, 1000000); } } }