Esempio n. 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);
 }
Esempio n. 2
0
 protected void cloneFix(Room E) {
   super.cloneFix(E);
   if (E instanceof StdThinGrid) {
     descriptions = (Vector) ((StdThinGrid) E).descriptions.clone();
     displayTexts = (Vector) ((StdThinGrid) E).displayTexts.clone();
     gridexits = (Vector) ((StdThinGrid) E).gridexits.clone();
   }
 }
Esempio n. 3
0
 public void destroy() {
   super.destroy();
   Room R = null;
   for (int i = rooms.size() - 1; i >= 0; i--) {
     R = (Room) rooms.elementAt(i, 1);
     if (R != null) R.destroy();
   }
   rooms.clear();
   descriptions = new Vector(1);
   displayTexts = new Vector(1);
   gridexits = new Vector(1);
 }
Esempio n. 4
0
 public void setDisplayText(String newDisplayText) {
   super.setDisplayText(newDisplayText);
   displayTexts = new Vector();
   int x = newDisplayText.toUpperCase().indexOf("<P>");
   while (x >= 0) {
     String s = newDisplayText.substring(0, x).trim();
     if (s.length() > 0) displayTexts.addElement(s);
     newDisplayText = newDisplayText.substring(x + 3).trim();
     x = newDisplayText.toUpperCase().indexOf("<P>");
   }
   if (newDisplayText.length() > 0) displayTexts.addElement(newDisplayText);
 }
Esempio n. 5
0
 public void setDescription(String newDescription) {
   super.setDescription(newDescription);
   descriptions = new Vector();
   int x = newDescription.toUpperCase().indexOf("<P>");
   while (x >= 0) {
     String s = newDescription.substring(0, x).trim();
     if (s.length() > 0) descriptions.addElement(s);
     newDescription = newDescription.substring(x + 3).trim();
     x = newDescription.toUpperCase().indexOf("<P>");
   }
   if (newDescription.length() > 0) descriptions.addElement(newDescription);
 }
Esempio n. 6
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);
 }
Esempio n. 7
0
 @Override
 public void recoverPhyStats() {
   super.recoverPhyStats();
   if (climbA != null) climbA.affectPhyStats(this, phyStats());
 }
Esempio n. 8
0
 @Override
 public void executeMsg(final Environmental myHost, final CMMsg msg) {
   if (climbA != null) climbA.executeMsg(myHost, msg);
   super.executeMsg(myHost, msg);
 }