Class Weapon

All Implemented Interfaces:
EquipListener, TurnListener, UseListener, WeaponImpl, Killer, Cloneable, Iterable<String>, Serializable
Direct Known Subclasses:
BreakableWeapon, DummyWeapon

public class Weapon extends Item implements WeaponImpl
  • Constructor Details

    • Weapon

      public Weapon(String name, String clazz, String subclass, Map<String,String> attributes)
      Creates a new weapon item.
      Parameters:
      name - Name of the item.
      clazz - Class of item.
      subclass - Subclass of item.
      attributes - Weapon attributes (such as attack). May be empty or `null`.
    • Weapon

      public Weapon(Weapon item)
      Copy constructor.
      Parameters:
      item - Item to be copied.
  • Method Details

    • onAttackAttempt

      public void onAttackAttempt(RPEntity target, RPEntity attacker)
      Description copied from interface: WeaponImpl
      Action when item is used as a weapon.
      Specified by:
      onAttackAttempt in interface WeaponImpl
      Parameters:
      target - Entity targeted by attacker.
      attacker - Attacking entity.
    • onAttackSuccess

      public void onAttackSuccess(RPEntity target, RPEntity attacker, int damage)
      Description copied from interface: WeaponImpl
      Action when item is used as a weapon.
      Specified by:
      onAttackSuccess in interface WeaponImpl
      Parameters:
      target - Entity targeted by attacker.
      attacker - Attacking entity.
      damage - Amount of damage resulting from attack.