Skip to content

Commit

Permalink
Modified the calculate_value function to take into account caster/tar…
Browse files Browse the repository at this point in the history
…get being null
  • Loading branch information
Turtyo committed Jan 9, 2024
1 parent a6cc629 commit de79fb3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Cards/Effects/EffectBase.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ func _apply_status(status: StatusBase, caster: Entity, target: Entity) -> void:

func calculate_value(name: String, caster: Entity, target: Entity, value: int) -> int:
var modified_value: int = value
var caster_stats: EntityStats = caster.get_stats_component().get_stats()
modified_value = caster_stats.calculate_modified_value(name, modified_value, true)
var caster_stats: EntityStats = null
if caster != null:
caster_stats = caster.get_stats_component().get_stats()
modified_value = caster_stats.calculate_modified_value(name, modified_value, true)
# is_offense = true, caster attacks

var target_stats: EntityStats = target.get_stats_component().get_stats()
modified_value = target_stats.calculate_modified_value(name, modified_value, false)
var target_stats: EntityStats = null
if target != null:
target_stats = target.get_stats_component().get_stats()
modified_value = target_stats.calculate_modified_value(name, modified_value, false)
# is_offense = false, target defends

return modified_value

0 comments on commit de79fb3

Please sign in to comment.