Record Class Weapon
java.lang.Object
java.lang.Record
idlab.colonyops.model.entities.inventory.Weapon
- Record Components:
type- the weapon's behaviour profiledamage- HP removed from the target per hit, before armour mitigationrange- the maximum Chebyshev distance at which the weapon can hit a targetunlimitedUse-trueif the weapon never runs out of uses (e.g. the Energy Sword), in which caseusesLeft()is not decrementedusesLeft- remaining shots before the weapon is depleted, ignored whenunlimitedUseistruemaxUses- the weapon's uses capacity, restored e.g. by the Ammo Pack consumable
public record Weapon(WeaponType type, int damage, int range, boolean unlimitedUse, int usesLeft, int maxUses)
extends Record
A weapon held in a squad member's weapon slot. Exact stats depend on the colony's tech
research and are subject to balance changes.
-
Constructor Summary
ConstructorsConstructorDescriptionWeapon(WeaponType type, int damage, int range, boolean unlimitedUse, int usesLeft, int maxUses) Creates an instance of aWeaponrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintdamage()Returns the value of thedamagerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intmaxUses()Returns the value of themaxUsesrecord component.intrange()Returns the value of therangerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.booleanReturns the value of theunlimitedUserecord component.intusesLeft()Returns the value of theusesLeftrecord component.
-
Constructor Details
-
Weapon
public Weapon(WeaponType type, int damage, int range, boolean unlimitedUse, int usesLeft, int maxUses) Creates an instance of aWeaponrecord class.- Parameters:
type- the value for thetyperecord componentdamage- the value for thedamagerecord componentrange- the value for therangerecord componentunlimitedUse- the value for theunlimitedUserecord componentusesLeft- the value for theusesLeftrecord componentmaxUses- the value for themaxUsesrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
type
-
damage
-
range
-
unlimitedUse
public boolean unlimitedUse()Returns the value of theunlimitedUserecord component.- Returns:
- the value of the
unlimitedUserecord component
-
usesLeft
-
maxUses
-