Record Class LootAction

java.lang.Object
java.lang.Record
idlab.colonyops.model.actions.LootAction
Record Components:
targetEntityId - the identifier of the defeated entity to loot
lootWeapon - whether to pick up the target's weapon
lootResources - the resources to take from the target's crate, by type
All Implemented Interfaces:
Action

public record LootAction(String targetEntityId, boolean lootWeapon, Map<ResourceType, Integer> lootResources) extends Record implements Action
Loot a defeated (dead) entity at the squad member's current location, picking up its weapon and/or the resources remaining in its crate. Corpses remain lootable for a limited number of turns after death.
  • Constructor Details

    • LootAction

      public LootAction(String targetEntityId, boolean lootWeapon, Map<ResourceType, Integer> lootResources)
      Creates an instance of a LootAction record class.
      Parameters:
      targetEntityId - the value for the targetEntityId record component
      lootWeapon - the value for the lootWeapon record component
      lootResources - the value for the lootResources record component
  • Method Details

    • 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.
    • targetEntityId

      public String targetEntityId()
      Returns the value of the targetEntityId record component.
      Returns:
      the value of the targetEntityId record component
    • lootWeapon

      public boolean lootWeapon()
      Returns the value of the lootWeapon record component.
      Returns:
      the value of the lootWeapon record component
    • lootResources

      public Map<ResourceType, Integer> lootResources()
      Returns the value of the lootResources record component.
      Returns:
      the value of the lootResources record component