Add ranged combat support

* Clean up the CombatAction and Attack code to make it easier to use for
  range.

* Add collision detection to the distance checks before attacking in the
  CombatAction.

* Create a Ruby DSL for defining projectile types and fix the
  ProjectileUpdateOperation so it uses the correct position offset.

* Fix the packet structure of the HintIconMessageEncoder.
This commit is contained in:
Gary Tierney
2016-01-03 22:24:43 +00:00
parent f80ea82ce7
commit 3082fade1d
35 changed files with 741 additions and 433 deletions
@@ -0,0 +1,25 @@
BOW_WIDGET_ID = 77
BOW_SPECIAL_CONFIG_ID = 10
BOW_SPECIAL_BUTTON_ID = 8
create_weapon_class :shortbow, widget: BOW_WIDGET_ID, type: :ranged do
defaults animation: 426
special_bar BOW_SPECIAL_CONFIG_ID, BOW_SPECIAL_BUTTON_ID
style :accurate, speed: 4, range: 7, button: 2
style :rapid, speed: 3, range: 7, button: 3
style :long_range, speed: 4, range: 9, button: 4
end
create_weapon :shortbow
create_weapon_class :longbow, widget: BOW_WIDGET_ID, type: :ranged do
defaults animation: 426
special_bar BOW_SPECIAL_CONFIG_ID, BOW_SPECIAL_BUTTON_ID
style :accurate, speed: 6, range: 7, button: 2
style :rapid, speed: 6, range: 7, button: 3
style :long_range, speed: 6, range: 9, button: 4
end
create_weapon :longbow
@@ -0,0 +1,11 @@
CROSSBOW_WIDGET_ID = 79
create_weapon_class :crossbow, widget: CROSSBOW_WIDGET_ID, type: :ranged do
defaults animation: 426, speed: 6, range: 7
style :accurate, range: 7, button: 2
style :rapid, speed: 5, button: 3
style :long_range, range: 9, button: 4
end
create_weapon /rune c'bow/, :crossbow
@@ -0,0 +1,8 @@
create_projectile_type :msb, start_height: 41, end_height: 37, delay: 31, speed: 3, slope: 15, radius: 8
create_weapon :magic_shortbow do
set_special_attack speed: 3, range: 7, energy_requirement: 60, animation: 1074, graphic: { id: 256, height: 100 } do
range_damage! projectile: 249, projectile_type: PROJECTILE_TYPES[:msb]
range_damage! projectile: 249, projectile_type: PROJECTILE_TYPES[:msb], projectile_graphic: 256, delay: 1
end
end