コード例 #1
0
ファイル: Combat.java プロジェクト: xayaz/nightgamesmod
 public void intervene(Character intruder, Character assist) {
   Character target;
   if (p1 == assist) {
     target = p2;
   } else {
     target = p1;
   }
   if (target.resist3p(this, intruder, assist)) {
     target.gainXP(20 + target.lvlBonus(intruder));
     intruder.gainXP(10 + intruder.lvlBonus(target));
     intruder.getArousal().empty();
     if (intruder.has(Trait.insatiable)) {
       intruder.getArousal().restore((int) (intruder.getArousal().max() * 0.2D));
     }
     target.undress(this);
     intruder.defeated(target);
     intruder.defeated(assist);
   } else {
     intruder.intervene3p(this, target, assist);
     assist.victory3p(this, target, intruder);
     phase = 2;
     if (!(p1.human() || p2.human() || intruder.human())) {
       end();
     } else if (intruder.human()) {
       Global.gui().watchCombat(this);
     }
   }
   updateMessage();
 }
コード例 #2
0
ファイル: Combat.java プロジェクト: xayaz/nightgamesmod
 public void go() {
   phase = 0;
   if (p1.mostlyNude() && !p2.mostlyNude()) {
     p1.emote(Emotion.nervous, 20);
   }
   if (p2.mostlyNude() && !p1.mostlyNude()) {
     p2.emote(Emotion.nervous, 20);
   }
   if (!(p1.human() || p2.human())) {
     automate();
   }
   updateMessage();
 }
コード例 #3
0
ファイル: Combat.java プロジェクト: xayaz/nightgamesmod
 public void act(Character c, Skill action, String choice) {
   if (c == p1) {
     p1act = action;
   }
   if (c == p2) {
     p2act = action;
   }
   action.choice = choice;
   if (p1act == null) {
     p1.act(this);
   } else if (p2act == null) {
     p2.act(this);
   } else if (p1act != null && p2act != null) {
     clear();
     if (p1.human() || p2.human()) {
       Global.gui().clearText();
     }
     p1act = checkWorship(p1, p2, p1act);
     p2act = checkWorship(p2, p1, p2act);
     if (Global.isDebugOn(DebugFlags.DEBUG_SCENE)) {
       System.out.println(p1.name() + " uses " + p1act.getLabel(this));
       System.out.println(p2.name() + " uses " + p2act.getLabel(this));
     }
     if (p1.pet != null && p2.pet != null) {
       petbattle(p1.pet, p2.pet);
     } else if (p1.pet != null) {
       p1.pet.act(this, p2);
     } else if (p2.pet != null) {
       p2.pet.act(this, p1);
     }
     useSkills();
     this.write("<br>");
     p1.eot(this, p2, p2act);
     p2.eot(this, p1, p1act);
     checkStamina(p1);
     checkStamina(p2);
     getStance().decay(this);
     getStance().checkOngoing(this);
     phase = 0;
     if (!(p1.human() || p2.human())) {
       timer++;
       turn();
     }
     updateMessage();
   }
 }
コード例 #4
0
ファイル: Combat.java プロジェクト: xayaz/nightgamesmod
 public void clear() {
   message = "";
   updateMessage();
 }
コード例 #5
0
ファイル: Combat.java プロジェクト: xayaz/nightgamesmod
  public void turn() {
    if (p1.checkLoss() && p2.checkLoss()) {
      state = eval();
      p1.evalChallenges(this, null);
      p2.evalChallenges(this, null);
      p2.draw(this, state);
      phase = 2;
      updateMessage();
      winner = Optional.of(Global.noneCharacter());
      if (!(p1.human() || p2.human())) {
        end();
      }
      return;
    }
    if (p1.checkLoss()) {
      state = eval();
      p1.evalChallenges(this, p2);
      p2.evalChallenges(this, p2);
      p2.victory(this, state);
      doVictory(p2, p1);
      winner = Optional.of(p2);
      phase = 2;
      updateMessage();
      if (!(p1.human() || p2.human())) {
        end();
      }
      return;
    }
    if (p2.checkLoss()) {
      state = eval();
      p1.evalChallenges(this, p1);
      p2.evalChallenges(this, p1);
      p1.victory(this, state);
      doVictory(p1, p2);
      winner = Optional.of(p1);
      phase = 2;
      updateMessage();
      if (!(p1.human() || p2.human())) {
        end();
      }
      return;
    }
    if (!p1.human() && !p2.human() && timer > 15) {
      if (p1.getArousal().get() > p2.getArousal().get()) {
        state = eval();
        if (Global.isDebugOn(DebugFlags.DEBUG_SCENE)) {
          System.out.println(p2.name() + " victory over " + p1.name());
        }
        p2.victory(this, state);
        doVictory(p2, p1);
        phase = 2;
        updateMessage();
        if (!(p1.human() || p2.human())) {
          end();
        }
        return;
      } else if (p1.getArousal().get() < p2.getArousal().get()) {
        state = eval();
        if (Global.isDebugOn(DebugFlags.DEBUG_SCENE)) {
          System.out.println(p1.name() + " victory over " + p2.name());
        }
        p1.victory(this, state);
        doVictory(p1, p2);
        phase = 2;
        updateMessage();
        if (!(p2.human() || p1.human())) {
          end();
        }
        return;
      } else {
        state = eval();
        if (Global.isDebugOn(DebugFlags.DEBUG_SCENE)) {
          System.out.println(p2.name() + " draw with " + p1.name());
        }
        p2.draw(this, state);
        phase = 2;
        updateMessage();
        if (!(p1.human() || p2.human())) {
          end();
        }
        return;
      }
    }
    Character player;
    Character other;
    if (p1.human()) {
      player = p1;
      other = p2;
    } else {
      player = p2;
      other = p1;
    }
    phase = 1;
    p1.regen(this);
    p2.regen(this);
    message =
        other.describe(player.get(Attribute.Perception), this)
            + "<p>"
            + Global.capitalizeFirstLetter(getStance().describe())
            + "<p>"
            + player.describe(other.get(Attribute.Perception), this)
            + "<p>";
    if ((p1.human() || p2.human()) && !Global.checkFlag(Flag.noimage)) {
      Global.gui().clearImage();
      Global.gui().displayImage(imagePath, images.get(imagePath));
    }
    p1act = null;
    p2act = null;
    p1.act(this);

    if (Global.random(3) == 0 && (p1.human() || p2.human())) {
      NPC commenter = (NPC) getOther(Global.getPlayer());
      Optional<String> comment = commenter.getComment(this);
      if (comment.isPresent()) {
        write(
            commenter,
            "<i>\"" + Global.format(comment.get(), commenter, Global.getPlayer()) + "\"</i>");
      }
    }

    updateAndClearMessage();
  }