public void executeMsg(final Environmental myHost, final CMMsg msg) { if (msg.source().riding() == this) { CMLib.commands().handleHygenicMessage(msg, 0, PlayerStats.HYGIENE_WATERCLEAN); } if (msg.amITarget(this)) { MOB mob = msg.source(); switch (msg.targetMinor()) { case CMMsg.TYP_DRINK: amountOfLiquidRemaining -= amountOfThirstQuenched; boolean thirsty = mob.curState().getThirst() <= 0; boolean full = !mob.curState() .adjThirst(amountOfThirstQuenched, mob.maxState().maxThirst(mob.baseWeight())); if (thirsty) mob.tell("You are no longer thirsty."); else if (full) mob.tell("You have drunk all you can."); if (disappearsAfterDrinking) { destroy(); return; } break; case CMMsg.TYP_FILL: if ((msg.tool() != null) && (msg.tool() instanceof Drink)) { Drink thePuddle = (Drink) msg.tool(); int amountToTake = amountTakenToFillMe(thePuddle); thePuddle.setLiquidRemaining(thePuddle.liquidRemaining() - amountToTake); if (amountOfLiquidRemaining <= 0) setLiquidType(thePuddle.liquidType()); if (((long) amountOfLiquidRemaining + (long) amountToTake) <= (long) Integer.MAX_VALUE) amountOfLiquidRemaining += amountToTake; if (amountOfLiquidRemaining > amountOfLiquidHeld) amountOfLiquidRemaining = amountOfLiquidHeld; if ((amountOfLiquidRemaining <= 0) && (disappearsAfterDrinking)) { destroy(); return; } } break; default: break; } } super.executeMsg(myHost, msg); }
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"; }