package com.vampirehemophile.ghosts.util;

import com.vampirehemophile.ghosts.entities.Pawn;
import com.vampirehemophile.ghosts.entities.Player;

/**
 * Provides a simple factory for quickly making new pawns.
 */
public class PawnFactory {

  /**
   * Makes Pawn from corresponding char type.
   *
   * @param c pawn's type.
   * @return the created pawn or null if type is unknown.
   */
  public static Pawn makePawn(char c) {
    Pawn g = new Pawn(true);
    Pawn e = new Pawn(false);

    if (c == g.charIcon()) {
      return g;
    } else if (c == e.charIcon()) {
      return e;
    }
    return null;
  }

  /**
   * Makes Pawn from corresponding char type.
   *
   * @param p the player to whom the pawn belongs.
   * @param c pawn's type.
   * @return the created pawn or null if type is unknown.
   */
  public static Pawn makePawn(Player p, char c) {
    Pawn g1 = new Pawn(true);
    Pawn e1 = new Pawn(false);

    Pawn g = new Pawn(p, true);
    Pawn e = new Pawn(p, false);

    if (c == g1.charIcon()) {
      return g;
    } else if (c == e1.charIcon()) {
      return e;
    }
    return null;
  }
}

@@ -1109,11 +1109,440 @@
 ull;%0A  %7D
+%0A%0A  /**%0A   * Creates a new good and aggressive pawn.%0A   *%0A   * @param p this pawn's player.%0A   * @return the created pawn.%0A   */%0A  public static Pawn makeGoodPawn(Player p) %7B%0A    return new Pawn(p, true, true);%0A  %7D%0A%0A  /**%0A   * Creates a new evil and aggressive pawn.%0A   *%0A   * @param p this pawn's player.%0A   * @return the created pawn.%0A   */%0A  public static Pawn makeEvilPawn(Player p) %7B%0A    return new Pawn(p, false, true);%0A  %7D
 %0A%7D%0A

Add pawn factory functions