Add initial combat spell support

This commit is contained in:
Steve Soltys
2016-01-27 12:32:55 -05:00
committed by Gary Tierney
parent 9f47fae6a9
commit ec248a185b
9 changed files with 238 additions and 38 deletions
+19 -3
View File
@@ -1,7 +1,7 @@
java_import 'org.apollo.game.message.impl.HintIconMessage'
on :message, :npc_action do |player, message|
target = $world.npc_repository.get message.index
target = $world.npc_repository.get message.index
# unless target.attacking
# target_combat_state = get_combat_state target
@@ -10,12 +10,28 @@ on :message, :npc_action do |player, message|
# target.start_action CombatAction.new(target)
# end
player_combat_state = player.get_combat_state
player_combat_state = player.get_combat_state
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?
player.start_action CombatAction.new(player)
end
on :message, :magic_on_mob do |player, message|
target = $world.npc_repository.get(message.index)
player_combat_state = player.get_combat_state
player_combat_state.target = target
spellbook = spellbook_for(message.interface_id)
spell = spell_for(spellbook, message.spell_id)
player.walking_queue.clear
player.start_action CombatAction.new(player)
magic_attack = MagicAttack.new(spell)
player_combat_state.queue_attack(magic_attack)
end
on :message, :player_action do |player, message|