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
+24 -8
View File
@@ -1,12 +1,28 @@
on :message, :npc_action do |player, message|
player_combat_state = get_combat_state player
player_combat_state.target = $world.npc_repository.get message.index
java_import 'org.apollo.game.message.impl.HintIconMessage'
unless player.attacking
player.start_action CombatAction.new(player)
end
on :message, :npc_action do |player, message|
target = $world.npc_repository.get message.index
# unless target.attacking
# target_combat_state = get_combat_state target
# target_combat_state.target = player
#
# target.start_action CombatAction.new(target)
# end
player_combat_state = get_combat_state player
player_combat_state.target = target
player.send HintIconMessage.for_npc(target.index)
player.walking_queue.clear
player.start_action CombatAction.new(player) unless player_combat_state.is_attacking?
end
on :message, :player_action do |player, message|
end
end
schedule 0 do |_task|
$world.player_repository.each { |player| player.attack_timer = player.attack_timer + 1 }
$world.npc_repository.each { |npc| npc.attack_timer = npc.attack_timer + 1 }
end