Fix clientside spell cast events. (cast success will need to be sent to clients later.)

This commit is contained in:
Relintai 2020-05-06 21:51:47 +02:00
parent 0c1ac31224
commit 39827852b3

View File

@ -80,8 +80,11 @@ func _cast_starts(info : SpellCastInfo) -> void:
r.current_value -= resource_cost.cost
info.caster.notification_scast(SpellEnums.NOTIFICATION_CAST_FINISHED, info)
info.caster.notification_scast(SpellEnums.NOTIFICATION_CAST_SUCCESS, info)
info.caster.notification_ccast(SpellEnums.NOTIFICATION_CAST_FINISHED, info)
if info.target:
info.target.notification_scast(SpellEnums.NOTIFICATION_CAST_FINISHED_TARGET, info)
@ -107,6 +110,8 @@ func _cast_finishs(info : SpellCastInfo) -> void:
info.caster.notification_scast(SpellEnums.NOTIFICATION_CAST_FINISHED, info)
info.caster.notification_scast(SpellEnums.NOTIFICATION_CAST_SUCCESS, info)
info.caster.notification_ccast(SpellEnums.NOTIFICATION_CAST_FINISHED, info)
if is_instance_valid(info.target):
info.target.notification_scast(SpellEnums.NOTIFICATION_CAST_FINISHED_TARGET, info)
@ -119,14 +124,10 @@ func _cast_finishs(info : SpellCastInfo) -> void:
handle_gcd(info)
func _son_cast_player_moved(info):
if !cast_can_move_while_casting:
info.caster.cast_fails()
func _son_spell_hit(info):
handle_effect(info)
func handle_effect(info : SpellCastInfo) -> void:
if target_type == SPELL_TARGET_TYPE_TARGET:
@ -229,16 +230,16 @@ func remove_spell_cast_effect(info : SpellCastInfo) -> void:
if basic_spell_effect.spell_cast_effect_right_hand != null:
info.caster.get_character_skeleton().right_hand_attach_point.remove_effect(basic_spell_effect.spell_cast_effect_right_hand)
func _con_spell_cast_started(info):
func _notification_ccast(what, info):
if what == SpellEnums.NOTIFICATION_CAST_STARTED:
add_spell_cast_effect(info)
func _con_spell_cast_failed(info):
elif what == SpellEnums.NOTIFICATION_CAST_FAILED:
remove_spell_cast_effect(info)
func _con_spell_cast_interrupted(info):
elif what == SpellEnums.NOTIFICATION_CAST_FINISHED:
remove_spell_cast_effect(info)
func _con_spell_cast_success(info):
elif what == SpellEnums.NOTIFICATION_CAST_INTERRUPTED:
remove_spell_cast_effect(info)
elif what == SpellEnums.NOTIFICATION_CAST_SUCCESS:
remove_spell_cast_effect(info)
if not is_instance_valid(info.target):
@ -253,3 +254,6 @@ func _con_spell_cast_success(info):
if bse.root_spell_cast_finish_effect != null:
info.target.get_character_skeleton().root_attach_point.add_effect_timed(bse.root_spell_cast_finish_effect, bse.root_spell_cast_finish_effect_time)
func _son_spell_hit(info):
handle_effect(info)