Example #1
0
  public boolean okMessage(final Environmental myHost, final CMMsg msg) {
    if (!super.okMessage(myHost, msg)) return false;

    if ((affected == null) || (!(affected instanceof MOB))) return true;

    MOB mob = (MOB) affected;
    if (msg.amISource(mob)
        && (msg.targetMinor() == CMMsg.TYP_DAMAGE)
        && (msg.tool() instanceof Weapon)
        && (msg.tool() == naturalWeapon))
      msg.setValue(msg.value() + naturalWeapon.basePhyStats().damage() + super.getXLEVELLevel(mob));
    return true;
  }
Example #2
0
 public boolean tick(Tickable ticking, int tickID) {
   if (!super.tick(ticking, tickID)) return false;
   if ((tickID == Tickable.TICKID_MOB) && (affected != null) && (affected instanceof MOB)) {
     MOB mob = (MOB) affected;
     if ((mob.isInCombat())
         && (CMLib.flags().aliveAwakeMobileUnbound(mob, true))
         && (mob.rangeToTarget() == 0)
         && (mob.charStats().getBodyPart(Race.BODY_HAND) > 1)
         && (!anyWeapons(mob))) {
       if (CMLib.dice().rollPercentage() > 95) helpProficiency(mob, 0);
       if ((naturalWeapon == null) || (naturalWeapon.amDestroyed())) {
         naturalWeapon = CMClass.getWeapon("GenWeapon");
         naturalWeapon.setName("a knife hand");
         naturalWeapon.setWeaponType(Weapon.TYPE_PIERCING);
         naturalWeapon.basePhyStats().setDamage(7);
         naturalWeapon.recoverPhyStats();
       }
       CMLib.combat().postAttack(mob, mob.getVictim(), naturalWeapon);
     }
   }
   return true;
 }