/**
  * Heals a Hero's health OR magic OR both. If player is lucky enough they get boost to both stats.
  * Otherwise one or the other.
  */
 public StringBuilder triggerEffectGUI() {
   StringBuilder sb = new StringBuilder();
   Player p = getActivator();
   Hero beingHealed = p.getCharacter();
   randomize();
   Random rand = new Random(System.currentTimeMillis());
   int luck = rand.nextInt(100) + 1 + beingHealed.getLuck();
   if (luck > 75) {
     beingHealed.setCurrentHP(beingHealed.getCurrentHP() + statChange);
     beingHealed.setCurrentMP(beingHealed.getCurrentMP() + statChange2);
     sb.append(
         p.getCustomName()
             + " has gained "
             + statChange
             + " health and "
             + statChange2
             + " mana.\n");
   } else if (rand.nextBoolean()) {
     beingHealed.setCurrentHP(beingHealed.getCurrentHP() + statChange);
     sb.append(p.getCustomName() + " has gained " + statChange + " health.\n");
   } else {
     beingHealed.setCurrentMP(beingHealed.getCurrentMP() + statChange);
     sb.append(p.getCustomName() + " has gained " + statChange + " mana.\n");
   }
   return sb;
 }
 @Test
 public void testPoorVictimWontHaveNegativeGold() {
   Hero thief = player1.getCharacter();
   Hero victim = player2.getCharacter();
   int initGold = thief.getGold();
   victim.setGold(1);
   card.triggerEffect(player1, player2);
   assertEquals(initGold + 1, thief.getGold());
   assertEquals(0, victim.getGold());
 }
 /**
  * Heals a Hero's health OR magic OR both. If player is lucky enough they get boost to both stats.
  * Otherwise one or the other.
  */
 @Override
 public void triggerEffect() {
   Player p = getActivator();
   Hero beingHealed = p.getCharacter();
   randomize();
   Random rand = new Random(System.currentTimeMillis());
   int luck = rand.nextInt(100) + 1 + beingHealed.getLuck();
   if (luck > 75) {
     beingHealed.setCurrentHP(beingHealed.getCurrentHP() + statChange);
     beingHealed.setCurrentMP(beingHealed.getCurrentMP() + statChange2);
   } else if (rand.nextBoolean()) {
     beingHealed.setCurrentHP(beingHealed.getCurrentHP() + statChange);
   } else {
     beingHealed.setCurrentMP(beingHealed.getCurrentMP() + statChange);
   }
 }
 @Test
 public void testStealGold() {
   Hero thief = player1.getCharacter();
   Hero victim = player2.getCharacter();
   int thiefInitGold = thief.getGold();
   int victimInitGold = victim.getGold();
   card.triggerEffect(player1, player2);
   int diff = thief.getGold() - thiefInitGold;
   String msg = card.getMessage();
   msg =
       msg.replace(
           "Victim has just invested in Thief's ponzi scheme. As a result, Thief steals ", "");
   msg = msg.replace(" from Victim", "");
   assertEquals(diff, Integer.parseInt(msg));
   assertEquals(thiefInitGold + Integer.parseInt(msg), thief.getGold());
   assertEquals(Integer.parseInt(msg), victimInitGold - victim.getGold());
 }
 /**
  * Takes in Player class as a parameter. Fully restore current player's HP(MP if Ghost).
  *
  * @param affected
  */
 @Override
 public void triggerEffect(Player affected) {
   Hero hero = affected.getCharacter();
   if (hero.isGhost() == false) {
     hero.setCurrentHP(hero.getMaxHP());
   } else if (hero.isGhost() == true) {
     hero.setCurrentMP(hero.getMaxMP());
   }
   this.setMessage("You were kissed by a magic fairy. Restore HP to max.");
 }