示例#1
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if ((msg.amITarget(this)
           || (msg.targetMinor() == CMMsg.TYP_ADVANCE)
           || (msg.targetMinor() == CMMsg.TYP_RETREAT))
       && (!msg.source().isMonster())
       && (msg.source().curState().getHitPoints() < msg.source().maxState().getHitPoints())
       && (CMLib.dice().rollPercentage() == 1)
       && (CMLib.dice().rollPercentage() == 1)
       && (!CMSecurity.isDisabled(CMSecurity.DisFlag.AUTODISEASE))) {
     Ability A = null;
     if (CMLib.dice().rollPercentage() > 50) A = CMClass.getAbility("Disease_Chlamydia");
     else A = CMClass.getAbility("Disease_Malaria");
     if ((A != null) && (msg.source().fetchEffect(A.ID()) == null))
       A.invoke(msg.source(), msg.source(), true, 0);
   }
   if (msg.amITarget(this) && (msg.targetMinor() == CMMsg.TYP_DRINK)) {
     final MOB mob = msg.source();
     final boolean thirsty = mob.curState().getThirst() <= 0;
     final boolean full =
         !mob.curState().adjThirst(thirstQuenched(), mob.maxState().maxThirst(mob.baseWeight()));
     if (thirsty) mob.tell(L("You are no longer thirsty."));
     else if (full) mob.tell(L("You have drunk all you can."));
     if (CMLib.dice().rollPercentage() < 10) {
       Ability A = CMClass.getAbility("Disease_Malaria");
       if ((A != null) && (msg.source().fetchEffect(A.ID()) == null))
         A.invoke(msg.source(), msg.source(), true, 0);
     }
   }
   super.executeMsg(myHost, msg);
 }
示例#2
0
 public void executeMsg(Environmental myHost, CMMsg msg) {
   if ((msg.targetMinor() == CMMsg.TYP_EXPIRE) && (msg.target() instanceof Room)) {
     Room R = (Room) msg.target();
     if (R.getGridParent() == this) {
       if ((roomID().length() > 0) && (getArea() != null))
         getArea().delProperRoomnumber(getGridChildCode(R));
       DVector thisGridRooms = rooms;
       thisGridRooms.removeElement(R);
       Room R2 = null;
       for (int r = thisGridRooms.size() - 1; r >= 0; r--) {
         R2 = (Room) thisGridRooms.elementAt(r, 1);
         for (int d = Directions.NUM_DIRECTIONS() - 1; d >= 0; d--)
           if (R2.rawDoors()[d] == R) {
             R2.rawDoors()[d] = null;
             R2.setRawExit(d, null);
           }
       }
     }
   }
   super.executeMsg(myHost, msg);
 }
示例#3
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if (climbA != null) climbA.executeMsg(myHost, msg);
   super.executeMsg(myHost, msg);
 }