示例#1
0
  public String healthText(MOB viewer, MOB mob) {
    double pct = (CMath.div(mob.curState().getHitPoints(), mob.maxState().getHitPoints()));

    if (pct < .10) return "^r" + mob.displayName(viewer) + "^r is facing a cold death!^N";
    else if (pct < .20) return "^r" + mob.displayName(viewer) + "^r is covered in blood.^N";
    else if (pct < .30)
      return "^r" + mob.displayName(viewer) + "^r is bleeding badly from lots of wounds.^N";
    else if (pct < .40)
      return "^y" + mob.displayName(viewer) + "^y has numerous bloody wounds and gashes.^N";
    else if (pct < .50)
      return "^y" + mob.displayName(viewer) + "^y has some bloody wounds and gashes.^N";
    else if (pct < .60) return "^p" + mob.displayName(viewer) + "^p has a few bloody wounds.^N";
    else if (pct < .70) return "^p" + mob.displayName(viewer) + "^p is cut and bruised heavily.^N";
    else if (pct < .80)
      return "^g" + mob.displayName(viewer) + "^g has some minor cuts and bruises.^N";
    else if (pct < .90)
      return "^g" + mob.displayName(viewer) + "^g has a few bruises and scratched scales.^N";
    else if (pct < .99) return "^g" + mob.displayName(viewer) + "^g has a few small bruises.^N";
    else return "^c" + mob.displayName(viewer) + "^c is in perfect health.^N";
  }