Record Class PoliticalSystem

java.lang.Object
java.lang.Record
net.chen.legacyLand.nation.politics.PoliticalSystem

public record PoliticalSystem(String id, String displayName, String description, List<String> roleNames, Map<String,Double> effects, Map<String,Object> customEffects) extends Record
政治体制 - 从配置文件加载的政体定义
  • Constructor Details

    • PoliticalSystem

      public PoliticalSystem(String id, String displayName, String description, List<String> roleNames, Map<String,Double> effects, Map<String,Object> customEffects)
      Creates an instance of a PoliticalSystem record class.
      Parameters:
      id - the value for the id record component
      displayName - the value for the displayName record component
      description - the value for the description record component
      roleNames - the value for the roleNames record component
      effects - the value for the effects record component
      customEffects - the value for the customEffects record component
  • Method Details

    • getTaxEfficiency

      public double getTaxEfficiency()
      获取税收效率倍率
    • getMilitaryStrength

      public double getMilitaryStrength()
      获取军事力量倍率
    • getMaxAllianceModifier

      public int getMaxAllianceModifier()
      获取最大同盟数量修正
    • getMaxTownModifier

      public int getMaxTownModifier()
      获取城镇最大数量修正
    • getTreasuryIncome

      public double getTreasuryIncome()
      获取国库收入倍率
    • getWarCooldownModifier

      public double getWarCooldownModifier()
      获取战争冷却时间倍率
    • getEffect

      public double getEffect(String key, double defaultValue)
      获取指定效果值
      Parameters:
      key - 效果键名
      defaultValue - 默认值
      Returns:
      效果值
    • isRoleAllowed

      public boolean isRoleAllowed(NationRole role)
      检查该政体下是否允许指定角色
    • getAllowedRoles

      public List<NationRole> getAllowedRoles()
      获取该政体下允许的 NationRole 列表
    • getLeaderRole

      public NationRole getLeaderRole()
      获取该政体的领袖角色
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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
    • 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
    • roleNames

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

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

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