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,37 @@
DAGGER_WIDGET_ID = 89
DAGGER_SPECIAL_CONFIG_ID = 12
DAGGER_SPECIAL_BUTTON_ID = 10
create_weapon_class :dagger, widget: DAGGER_WIDGET_ID do
defaults speed: 4, animation: 7041, attack_type: :stab
attack_bonuses crush: -4, magic: 1
defence_bonuses magic: 1
style :accurate, button: 2
style :aggressive, button: 3
style :alt_aggressive, attack_type: :slash, animation: 7048, button: 4
style :defensive, animation: 7049, button: 5
end
# Need a separate WeaponClass for the dragon dagger because
# of the differing animations
create_weapon_class :dragon_dagger, widget: DAGGER_WIDGET_ID do
defaults speed: 4, animation: 402, attack_type: :stab
special_bar DAGGER_SPECIAL_CONFIG_ID, DAGGER_SPECIAL_BUTTON_ID
attack_bonuses crush: -4, magic: 1
defence_bonuses magic: 1
style :accurate, button: 2
style :aggressive, button: 3
style :alt_aggressive, attack_type: :slash, button: 4
style :defensive, button: 5
end
create_weapon /(?:drag|dragon) dagger.*/, :dragon_dagger do
set_special_attack speed: 4, energy_requirement: 25, animation: 1062, graphic: { id: 252, height: 100 } do
damage! delay: 0
damage! delay: 1
end
end
@@ -0,0 +1,9 @@
create_weapon :granite_maul do
attack_bonuses slash: 92, crush: 80
other_bonuses melee_strength: 70
set_special_attack speed: 0, energy_requirement: 60, animation: 3157, graphic: 1225 do |_source, _target|
damage! delay: 0
damage! delay: 1
end
end
@@ -0,0 +1,51 @@
SCIMITAR_WIDGET_ID = 81
SCIMITAR_SPECIAL_BAR_CONFIG_ID = 21
SCIMITAR_SPECIAL_BAR_BUTTON_ID = 21
create_weapon_class :scimitar, widget: SCIMITAR_WIDGET_ID do
defaults speed: 4, animation: 390, attack_type: :slash
special_bar SCIMITAR_SPECIAL_BAR_CONFIG_ID, SCIMITAR_SPECIAL_BAR_BUTTON_ID
attack_bonuses crush: -2
defence_bonuses slash: -1
style :accurate, button: 2
style :aggressive, button: 3
style :alt_aggressive, attack_type: :stab, animation: 391, button: 4
style :defensive, button: 5
end
create_weapon :iron_scimitar do
attack_bonuses stab: 2, slash: 10
other_bonuses melee_strength: 9
end
create_weapon :steel_scimitar do
attack_bonuses stab: 3, slash: 15
other_bonuses melee_strength: 14
end
create_weapon /(black|white) scimitar/ do
attack_bonuses stab: 4, slash: 19
other_bonuses melee_strength: 14
end
create_weapon :mithril_scimitar do
attack_bonuses stab: 5, slash: 21
other_bonuses melee_strength: 20
end
create_weapon :adamant_scimitar do
attack_bonuses stab: 6, slash: 29
other_bonuses melee_strength: 28
end
create_weapon :rune_scimitar do
attack_bonuses stab: 7, slash: 45
other_bonuses melee_strength: 44
end
create_weapon :dragon_scimitar do
attack_bonuses stab: 8, slash: 67
other_bonuses melee_strength: 66
end
@@ -0,0 +1,57 @@
TWO_HANDED_SWORD_WIDGET_ID = 82
TWO_HANDED_SWORD_SPECIAL_CONFIG_ID = 12
TWO_HANDED_SWORD_SPECIAL_BUTTON_ID = 10
create_weapon_class :two_handed_sword, widget: TWO_HANDED_SWORD_WIDGET_ID do
defaults speed: 7, animation: 7041, attack_type: :slash
special_bar TWO_HANDED_SWORD_SPECIAL_CONFIG_ID, TWO_HANDED_SWORD_SPECIAL_BUTTON_ID
animations stand: 7047, walk: 7046, run: 7039, idle_turn: 7044, turn_around: 7044, turn_left: 7043, turn_right: 7044
attack_bonuses stab: -4, magic: -4
defence_bonuses range: -1
style :accurate, button: 2
style :aggressive, attack_type: :crush, button: 3
style :alt_aggressive, attack_type: :crush, animation: 7048, button: 4
style :defensive, animation: 7049, button: 5
end
create_weapon :iron_2h_sword do
attack_bonuses slash: 13, crush: 10
other_bonuses melee_strength: 14
end
create_weapon :steel_2h_sword do
attack_bonuses slash: 21, crush: 16
other_bonuses melee_strength: 22
end
create_weapon /(?:black|white) 2h sword/ do
attack_bonuses slash: 27, crush: 21
other_bonuses melee_strength: 26
end
create_weapon :mithril_2h_sword do
attack_bonuses slash: 30, crush: 24
other_bonuses melee_strength: 26
end
create_weapon :adamant_2h_sword do
attack_bonuses slash: 43, crush: 30
other_bonuses melee_strength: 31
end
create_weapon :rune_2h_sword do
attack_bonuses slash: 69, crush: 50
other_bonuses melee_strength: 70
end
create_weapon :dragon_2h_sword do
attack_bonuses slash: 92, crush: 80
other_bonuses melee_strength: 70
set_special_attack speed: 7, energy_requirement: 60, animation: 3157, graphic: 1225 do |_source, _target|
damage!
end
end