mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 08:39:27 +00:00
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:
@@ -1,20 +0,0 @@
|
||||
BOW_WIDGET_ID = 10
|
||||
BOW_SPECIAL_BAR_ID = 10
|
||||
#
|
||||
# create_weapon_class :longbow, widget: BOW_WIDGET_ID do
|
||||
# special_bar = BOW_SPECIAL_BAR_ID
|
||||
#
|
||||
#
|
||||
# add_style :accurate, speed: 6, range: 7
|
||||
# add_style :rapid, speed: 6, range: 7
|
||||
# add_style :long_range, speed: 6, range: 9
|
||||
# end
|
||||
#
|
||||
# create_weapon_class :shortbow, widget: BOW_WIDGET_ID do
|
||||
# special_bar = BOW_SPECIAL_BAR_ID
|
||||
#
|
||||
# add_style :accurate, speed: 4, range: 7
|
||||
# add_style :rapid, speed: 3, range: 7
|
||||
# add_style :long_range, speed: 4, range: 9
|
||||
# end
|
||||
#
|
||||
@@ -1,37 +0,0 @@
|
||||
DAGGER_WIDGET_ID = 89
|
||||
DAGGER_SPECIAL_CONFIG_ID = 12
|
||||
DAGGER_SPECIAL_BUTTON_ID = 10
|
||||
|
||||
create_weapon_class :dagger, widget: DAGGER_WIDGET_ID do
|
||||
default_speed 4
|
||||
|
||||
attack_bonuses crush: -4, magic: 1
|
||||
defence_bonuses magic: 1
|
||||
|
||||
add_style :accurate, attack_type: :stab, animation: 7041, button: 2
|
||||
add_style :aggressive, attack_type: :stab, animation: 7041, button: 3
|
||||
add_style :alt_aggressive, attack_type: :slash, animation: 7048, button: 4
|
||||
add_style :defensive, attack_type: :stab, 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
|
||||
default_speed 4
|
||||
special_bar DAGGER_SPECIAL_CONFIG_ID, DAGGER_SPECIAL_BUTTON_ID
|
||||
|
||||
attack_bonuses crush: -4, magic: 1
|
||||
defence_bonuses magic: 1
|
||||
|
||||
add_style :accurate, attack_type: :stab, animation: 402, button: 2
|
||||
add_style :aggressive, attack_type: :stab, animation: 402, button: 3
|
||||
add_style :alt_aggressive, attack_type: :slash, animation: 402, button: 4
|
||||
add_style :defensive, attack_type: :stab, animation: 402, button: 5
|
||||
end
|
||||
|
||||
create_weapon /(?:drag|dragon) dagger.*/, :dragon_dagger do
|
||||
set_special_attack energy_requirement: 25, animation: 1062, graphic: {id: 252, height: 100} do |source, target|
|
||||
damage! source, target, CombatUtil::calculate_hit(source, target)
|
||||
damage! source, target, CombatUtil::calculate_hit(source, target), 1
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
+6
-6
@@ -3,16 +3,16 @@ SCIMITAR_SPECIAL_BAR_CONFIG_ID = 21
|
||||
SCIMITAR_SPECIAL_BAR_BUTTON_ID = 21
|
||||
|
||||
create_weapon_class :scimitar, widget: SCIMITAR_WIDGET_ID do
|
||||
default_speed 4
|
||||
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
|
||||
|
||||
add_style :accurate, attack_type: :slash, animation: 390, button: 2
|
||||
add_style :aggressive, attack_type: :slash, animation: 390, button: 3
|
||||
add_style :alt_aggressive, attack_type: :stab, animation: 391, button: 4
|
||||
add_style :defensive, attack_type: :slash, animation: 390, button: 5
|
||||
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
|
||||
@@ -46,6 +46,6 @@ create_weapon :rune_scimitar do
|
||||
end
|
||||
|
||||
create_weapon :dragon_scimitar do
|
||||
attack_bonuses :stab => 8, slash: 67
|
||||
attack_bonuses stab: 8, slash: 67
|
||||
other_bonuses melee_strength: 66
|
||||
end
|
||||
+9
-9
@@ -1,9 +1,9 @@
|
||||
TWO_HANDED_SWORD_WIDGET_ID = 82
|
||||
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
|
||||
default_speed 7
|
||||
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
|
||||
@@ -11,10 +11,10 @@ create_weapon_class :two_handed_sword, widget: TWO_HANDED_SWORD_WIDGET_ID do
|
||||
attack_bonuses stab: -4, magic: -4
|
||||
defence_bonuses range: -1
|
||||
|
||||
add_style :accurate, attack_type: :slash, animation: 7041, button: 2
|
||||
add_style :aggressive, attack_type: :crush, animation: 7041, button: 3
|
||||
add_style :alt_aggressive, attack_type: :crush, animation: 7048, button: 4
|
||||
add_style :defensive, attack_type: :slash, animation: 7049, button: 5
|
||||
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
|
||||
@@ -51,7 +51,7 @@ create_weapon :dragon_2h_sword do
|
||||
attack_bonuses slash: 92, crush: 80
|
||||
other_bonuses melee_strength: 70
|
||||
|
||||
set_special_attack energy_requirement: 60, animation: 3157, graphic: 1225 do |source, target|
|
||||
damage! source, target, 5
|
||||
set_special_attack speed: 7, energy_requirement: 60, animation: 3157, graphic: 1225 do |_source, _target|
|
||||
damage!
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
@@ -1,11 +1,11 @@
|
||||
create_weapon_class :no_weapon, widget: 92 do
|
||||
default_speed 4
|
||||
defaults speed: 4, animation: 422
|
||||
|
||||
add_style :accurate, animation: 422, block_animation: 424
|
||||
add_style :aggressive, animation: 423, block_animation: 424
|
||||
add_style :defensive, animation: 422, block_animation: 424
|
||||
style :accurate, button: 2
|
||||
style :aggressive, animation: 423, button: 3
|
||||
style :defensive, button: 4
|
||||
end
|
||||
|
||||
create_weapon :unarmed, :no_weapon, named: true do
|
||||
# Todo factor out empty blocks
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user