Record Class TechNode

java.lang.Object
java.lang.Record
net.chen.legacyLand.nation.tech.TechNode

public record TechNode(String id, String lineId, int tier, String displayName, String description, int cost, List<String> prerequisites, Map<String,Double> effects) extends Record
科技节点定义(从 tech.yml 加载)
  • Constructor Details

    • TechNode

      public TechNode(String id, String lineId, int tier, String displayName, String description, int cost, List<String> prerequisites, Map<String,Double> effects)
      Creates an instance of a TechNode record class.
      Parameters:
      id - the value for the id record component
      lineId - the value for the lineId record component
      tier - the value for the tier record component
      displayName - the value for the displayName record component
      description - the value for the description record component
      cost - the value for the cost record component
      prerequisites - the value for the prerequisites record component
      effects - the value for the effects record component
  • Method Details

    • hasEffect

      public boolean hasEffect(String key)
      检查某个效果键是否存在
    • getEffect

      public double getEffect(String key)
      获取效果值,不存在返回 0
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • lineId

      public String lineId()
      Returns the value of the lineId record component.
      Returns:
      the value of the lineId record component
    • tier

      public int tier()
      Returns the value of the tier record component.
      Returns:
      the value of the tier record component
    • displayName

      public String displayName()
      Returns the value of the displayName record component.
      Returns:
      the value of the displayName record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • cost

      public int cost()
      Returns the value of the cost record component.
      Returns:
      the value of the cost record component
    • prerequisites

      public List<String> prerequisites()
      Returns the value of the prerequisites record component.
      Returns:
      the value of the prerequisites record component
    • effects

      public Map<String,Double> effects()
      Returns the value of the effects record component.
      Returns:
      the value of the effects record component