java.lang.Object
com.cmiurca.saintseiyadeckbuilding.saintseiya.Card

public class Card extends Object
Card class, where the cards are created
Since:
2023-02-04
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor
    Card(int id)
    Constructeur par ID qui crée une carte à partir d'un fichier JSON qui contient les données de la carte.
    Card(Card card)
    Creates a new Card instance with the specified parameters.
    Card(String name, String category, int acquisitionCostInStrength, int acquisitionCostInCosmos, String rank, int id, int flameOfTheClock, int pointOfVictory, Effect effect, int strength, int cosmos, int care)
    Creates a new Card instance with the specified parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addCare(int careToAdd)
    Method to add care to the Card.
    void
    addCosmos(int cosmosToAdd)
    Method to add cosmos to the Card.
    void
    addStrength(int strengthToAdd)
    Method to add strength to the Card.
    void
    applyEffect(ArrayList<Card> card, ArrayList<Player> player, PlayMat playMat)
    Method to apply the effect of the Card
    createEffect(int id, String effectDescription)
    JSONParser parser = new JSONParser(); try { Object obj = parser.parse(new FileReader("./saint_seiya_cartes.json")); JSONArray cards = (JSONArray) obj; Iterator iterator = cards.iterator(); JSONObject card = (JSONObject)parser.parse(iterator.next()); while(iterator.hasNext() invalid input: '&'invalid input: '&' !card.get("id").equals(id + "")) { card = (JSONObject)parser.parse(iterator.next()); } System.out.print(card.get("nom")); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); }* /** CreateEffect method to create an effect from a card id and a description
    boolean
    Method to compare two cards
    int
    Getter for acquisitionCostInCosmos
    int
    Getter for acquisitionCostInStrength
    int
    Getter for care
    Getter for category
    int
    Getter for cosmos
    Getter for effect
    int
    Getter for flameOfTheClock
    int
    Getter for id
    Getter for name
    int
    Getter for pointOfVictory
    Getter for rank
    int
    Getter for strength
    void
    removeAcquisitionCostInCosmos(int acquisitionCostInCosmosToRemove)
    Method to remove acquisitionCostInCosmos to the Card
    void
    removeAcquisitionCostInStrength(int acquisitionCostInStrengthToRemove)
    Method to remove acquisitionCostInStrength to the Card
    void
    removeCare(int careToRemove)
    Method to remove care to the Card.
    void
    removeCosmos(int cosmosToRemove)
    Method to remove cosmos to the Card.
    void
    removeStrength(int strengthToRemove)
    Method to remove strength to the Card.
    void
    setAcquisitionCostInCosmos(int acquisitionCostInCosmos)
    Setter for acquisitionCostInCosmos
    void
    setAcquisitionCostInStrength(int acquisitionCostInStrength)
    Setter for acquisitionCostInStrength
    void
    setCare(int care)
    Setter for care
    void
    setCategory(String category)
    Setter for category
    void
    setCosmos(int cosmos)
    Setter for cosmos
    void
    setEffect(Effect effect)
    Setter for effect
    void
    setFlameOfTheClock(int flameOfTheClock)
    Setter for flameOfTheClock
    void
    setId(int id)
    Setter for id
    void
    Setter for name
    void
    setPointOfVictory(int pointOfVictory)
    Setter for pointOfVictory
    void
    Setter for rank
    void
    setStrength(int strength)
    Setter for strength
    Method to display the Card.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Card

      public Card()
      Default constructor
    • Card

      public Card(Card card)
      Creates a new Card instance with the specified parameters.
      Parameters:
      card - The card to copy.
    • Card

      public Card(String name, String category, int acquisitionCostInStrength, int acquisitionCostInCosmos, String rank, int id, int flameOfTheClock, int pointOfVictory, Effect effect, int strength, int cosmos, int care)
      Creates a new Card instance with the specified parameters.
      Parameters:
      name - The name of the Card.
      category - The category of the Card.
      acquisitionCostInStrength - The acquisition cost in strength required to acquire the Card.
      acquisitionCostInCosmos - The acquisition cost in cosmos required to acquire the Card.
      rank - The rank of the Card.
      id - The id of the Card.
      flameOfTheClock - The flame of the clock value of the Card.
      pointOfVictory - The point of victory value of the Card.
      effect - The effect of the Card.
      strength - The strength value of the Card.
      cosmos - The cosmos value of the Card.
      care - The care value of the Card.
    • Card

      public Card(int id)
      Constructeur par ID qui crée une carte à partir d'un fichier JSON qui contient les données de la carte.
      Parameters:
      id - L'identifiant de la carte.
  • Method Details

    • createEffect

      public Effect createEffect(int id, String effectDescription)
      JSONParser parser = new JSONParser(); try { Object obj = parser.parse(new FileReader("./saint_seiya_cartes.json")); JSONArray cards = (JSONArray) obj; Iterator iterator = cards.iterator(); JSONObject card = (JSONObject)parser.parse(iterator.next()); while(iterator.hasNext() invalid input: '&'invalid input: '&' !card.get("id").equals(id + "")) { card = (JSONObject)parser.parse(iterator.next()); } System.out.print(card.get("nom")); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); }* /** CreateEffect method to create an effect from a card id and a description
      Parameters:
      id -
      effectDescription -
      Returns:
      Effect
    • getName

      public String getName()
      Getter for name
      Returns:
      String name
    • getCategory

      public String getCategory()
      Getter for category
      Returns:
      String category
    • getAcquisitionCostInStrength

      public int getAcquisitionCostInStrength()
      Getter for acquisitionCostInStrength
      Returns:
      int acquisitionCostInStrength
    • getAcquisitionCostInCosmos

      public int getAcquisitionCostInCosmos()
      Getter for acquisitionCostInCosmos
      Returns:
      int acquisitionCostInCosmos
    • getRank

      public String getRank()
      Getter for rank
      Returns:
      String rank
    • getId

      public int getId()
      Getter for id
      Returns:
      int id
    • getFlameOfTheClock

      public int getFlameOfTheClock()
      Getter for flameOfTheClock
      Returns:
      int flameOfTheClock
    • getPointOfVictory

      public int getPointOfVictory()
      Getter for pointOfVictory
      Returns:
      int pointOfVictory
    • getEffect

      public Effect getEffect()
      Getter for effect
      Returns:
      Effect effect
    • getStrength

      public int getStrength()
      Getter for strength
      Returns:
      int strength
    • getCosmos

      public int getCosmos()
      Getter for cosmos
      Returns:
      int cosmos
    • getCare

      public int getCare()
      Getter for care
      Returns:
      int care
    • setName

      public void setName(String name)
      Setter for name
      Parameters:
      name - The name of the Card.
    • setCategory

      public void setCategory(String category)
      Setter for category
      Parameters:
      category - The category of the Card.
    • setAcquisitionCostInStrength

      public void setAcquisitionCostInStrength(int acquisitionCostInStrength)
      Setter for acquisitionCostInStrength
      Parameters:
      acquisitionCostInStrength - The acquisition cost in strength required to acquire the Card.
    • setAcquisitionCostInCosmos

      public void setAcquisitionCostInCosmos(int acquisitionCostInCosmos)
      Setter for acquisitionCostInCosmos
      Parameters:
      acquisitionCostInCosmos - The acquisition cost in cosmos required to acquire the Card.
    • setRank

      public void setRank(String rank)
      Setter for rank
      Parameters:
      rank - The rank of the Card.
    • setId

      public void setId(int id)
      Setter for id
      Parameters:
      id - The id of the Card.
    • setFlameOfTheClock

      public void setFlameOfTheClock(int flameOfTheClock)
      Setter for flameOfTheClock
      Parameters:
      flameOfTheClock - The flame of the clock value of the Card.
    • setPointOfVictory

      public void setPointOfVictory(int pointOfVictory)
      Setter for pointOfVictory
      Parameters:
      pointOfVictory - The point of victory value of the Card.
    • setEffect

      public void setEffect(Effect effect)
      Setter for effect
      Parameters:
      effect - The effect of the Card.
    • setStrength

      public void setStrength(int strength)
      Setter for strength
      Parameters:
      strength - The strength value of the Card.
    • setCosmos

      public void setCosmos(int cosmos)
      Setter for cosmos
      Parameters:
      cosmos - The cosmos value of the Card.
    • setCare

      public void setCare(int care)
      Setter for care
      Parameters:
      care - The care value of the Card.
    • toString

      public String toString()
      Method to display the Card.
      Overrides:
      toString in class Object
      Returns:
      String
    • equals

      public boolean equals(Object obj)
      Method to compare two cards
      Overrides:
      equals in class Object
      Parameters:
      obj - The card to compare
      Returns:
      boolean
    • addStrength

      public void addStrength(int strengthToAdd)
      Method to add strength to the Card.
      Parameters:
      strengthToAdd - The strength to add
    • addCosmos

      public void addCosmos(int cosmosToAdd)
      Method to add cosmos to the Card.
      Parameters:
      cosmosToAdd - The cosmos to add
    • addCare

      public void addCare(int careToAdd)
      Method to add care to the Card.
      Parameters:
      careToAdd - The care to add
    • removeStrength

      public void removeStrength(int strengthToRemove)
      Method to remove strength to the Card.
      Parameters:
      strengthToRemove - The strength to remove
    • removeCosmos

      public void removeCosmos(int cosmosToRemove)
      Method to remove cosmos to the Card.
      Parameters:
      cosmosToRemove - The cosmos to remove
    • removeCare

      public void removeCare(int careToRemove)
      Method to remove care to the Card.
      Parameters:
      careToRemove - The care to remove
    • removeAcquisitionCostInStrength

      public void removeAcquisitionCostInStrength(int acquisitionCostInStrengthToRemove)
      Method to remove acquisitionCostInStrength to the Card
      Parameters:
      acquisitionCostInStrengthToRemove - The acquisitionCostInStrength to remove
    • removeAcquisitionCostInCosmos

      public void removeAcquisitionCostInCosmos(int acquisitionCostInCosmosToRemove)
      Method to remove acquisitionCostInCosmos to the Card
      Parameters:
      acquisitionCostInCosmosToRemove - The acquisitionCostInCosmos to remove
    • applyEffect

      public void applyEffect(ArrayList<Card> card, ArrayList<Player> player, PlayMat playMat)
      Method to apply the effect of the Card
      Parameters:
      card - The card to apply the effect
      player - The player to apply the effect
      playMat - The playMat to apply the effect