Example #1
0
 public static void cure(Thing t, int power) {
   Thing[] poisons = t.getFlaggedContents("IsPoison");
   boolean cured = false;
   for (int i = 0; i < poisons.length; i++) {
     Thing p = poisons[i];
     Game.warn("Poison.cure(): " + power);
     if (RPG.test(power, poisons.length * p.getStat("CureDifficulty"))) {
       p.remove();
       cured = true;
     }
   }
   if (cured) {
     t.message("You feel refreshed");
   }
 }
Example #2
0
    public boolean handle(Thing t, Event e) {
      int time = e.getStat("Time");

      // set actor
      Game.actor = t;

      // Game.warn("**poison action**");
      Thing h = t.holder();

      int dam = 0;
      int hits = RPG.po(time * t.getStat("Strength"), 1000000);
      for (int i = 0; i < hits; i++) {
        dam += Damage.inflict(h, t.getStat("Damage"), t.getString("DamageType"));
        // Game.warn("**poison damage**");
      }
      if (dam > 0) h.message(t.getString("DamageMessage"));

      // might be other effects....
      return false;
    }