Files
apollo/data/plugins/combat/bonuses.rb
T
Gary Tierney 348e5cc8dc Build a framework for a maintainable combat plugin
* Uses a hierarchy of WeaponClasses -> Weapons for performing attacks,
  with WeaponClass having a set of styles and associated Attacks for
  those styles. Weapons and their classes are built with an easy to use
  and clean DSL.

* Adds a BonusContainer mixin, so that Equipment, Weapons, and
  WeaponClasses can all have their own set of bonuses which apply to the
  player.

* Allows attacks to be queued to the Mobs CombatState instance from
  external code, allowing e.g., NPCs or auto-cast to queue attacks to be
  executed.
2016-02-29 21:27:17 +00:00

44 lines
1.0 KiB
Ruby

module Combat
# A module for units which can have their own bonuses. E.G., weapons, equipment, ammo.
module BonusContainer
def attack_bonus(type)
@attack_bonuses[type]
end
def defence_bonus(type)
@defence_bonuses[type]
end
def other_bonus(type)
@other_bonuses[type]
end
def other_bonuses(melee_strength: 0, ranged_strength: 0, prayer: 0)
@other_bonuses = {
:melee_strength => melee_strength,
:ranged_strength => ranged_strength,
:prayer => prayer
}
end
def defence_bonuses(stab: 0, slash: 0, crush: 0, magic: 0, range: 0)
@defence_bonuses = {
:stab => stab,
:slash => slash,
:crush => crush,
:magic => magic,
:range => range
}
end
def attack_bonuses(stab: 0, slash: 0, crush: 0, magic: 0, range: 0)
@attack_bonuses = {
:stab => stab,
:slash => slash,
:crush => crush,
:magic => magic,
:range => range
}
end
end
end