Add manual campaign checkpoint saves
This commit is contained in:
@@ -225,7 +225,7 @@ func _normalized_battle_conditions(source) -> Dictionary:
|
||||
func _normalized_briefing(source) -> Dictionary:
|
||||
if typeof(source) != TYPE_DICTIONARY:
|
||||
return {}
|
||||
var result := source.duplicate(true)
|
||||
var result: Dictionary = source.duplicate(true)
|
||||
var lines := []
|
||||
for line in result.get("lines", []):
|
||||
lines.append(str(line))
|
||||
@@ -668,7 +668,7 @@ func get_damage_preview(attacker_id: String, target_id: String) -> Dictionary:
|
||||
return {}
|
||||
|
||||
var damage := calculate_damage(attacker, target)
|
||||
var target_hp_after := max(0, int(target["hp"]) - damage)
|
||||
var target_hp_after: int = maxi(0, int(target["hp"]) - damage)
|
||||
var counter_damage := 0
|
||||
var attacker_hp_after := int(attacker["hp"])
|
||||
var hit_chance := calculate_hit_chance(attacker, target)
|
||||
@@ -679,7 +679,7 @@ func get_damage_preview(attacker_id: String, target_id: String) -> Dictionary:
|
||||
if counter_in_range:
|
||||
counter_damage = calculate_damage(target, attacker)
|
||||
counter_hit_chance = calculate_hit_chance(target, attacker)
|
||||
attacker_hp_after = max(0, int(attacker["hp"]) - counter_damage)
|
||||
attacker_hp_after = maxi(0, int(attacker["hp"]) - counter_damage)
|
||||
return {
|
||||
"attacker_id": attacker_id,
|
||||
"target_id": target_id,
|
||||
@@ -884,7 +884,7 @@ func _format_support_effects(skill: Dictionary) -> String:
|
||||
if not _is_supported_status_stat(stat) or amount == 0:
|
||||
continue
|
||||
var sign := "+" if amount > 0 else ""
|
||||
var duration := max(1, int(effect.get("duration_turns", 1)))
|
||||
var duration: int = maxi(1, int(effect.get("duration_turns", 1)))
|
||||
var duration_text := "next phase" if duration == 1 else "%d phases" % duration
|
||||
parts.append("%s %s%d until %s" % [stat.to_upper(), sign, amount, duration_text])
|
||||
if parts.is_empty():
|
||||
@@ -1557,13 +1557,13 @@ func _skill_range_pair(skill: Dictionary) -> Dictionary:
|
||||
return _normalized_skill_range(1, 1)
|
||||
if typeof(value) != TYPE_INT and typeof(value) != TYPE_FLOAT:
|
||||
return _normalized_skill_range(1, 1)
|
||||
var scalar := max(0, int(value))
|
||||
var scalar: int = maxi(0, int(value))
|
||||
return _normalized_skill_range(scalar, scalar)
|
||||
|
||||
|
||||
func _normalized_skill_range(min_range: int, max_range: int) -> Dictionary:
|
||||
var safe_min := max(0, min_range)
|
||||
var safe_max := max(safe_min, max_range)
|
||||
var safe_min: int = maxi(0, min_range)
|
||||
var safe_max: int = maxi(safe_min, max_range)
|
||||
return {"min": safe_min, "max": safe_max}
|
||||
|
||||
|
||||
@@ -1616,7 +1616,7 @@ func _item_range_pair(item: Dictionary) -> Dictionary:
|
||||
return _normalized_skill_range(0, 1)
|
||||
if typeof(value) != TYPE_INT and typeof(value) != TYPE_FLOAT:
|
||||
return _normalized_skill_range(0, 1)
|
||||
var scalar := max(0, int(value))
|
||||
var scalar: int = maxi(0, int(value))
|
||||
return _normalized_skill_range(scalar, scalar)
|
||||
|
||||
|
||||
@@ -1787,13 +1787,13 @@ func _attack_range_pair_from_value(value) -> Dictionary:
|
||||
return _normalized_attack_range_pair(1, 1)
|
||||
if typeof(value) != TYPE_INT and typeof(value) != TYPE_FLOAT:
|
||||
return _normalized_attack_range_pair(1, 1)
|
||||
var scalar := max(1, int(value))
|
||||
var scalar: int = maxi(1, int(value))
|
||||
return _normalized_attack_range_pair(scalar, scalar)
|
||||
|
||||
|
||||
func _normalized_attack_range_pair(min_range: int, max_range: int) -> Dictionary:
|
||||
var safe_min := max(1, min_range)
|
||||
var safe_max := max(safe_min, max_range)
|
||||
var safe_min: int = maxi(1, min_range)
|
||||
var safe_max: int = maxi(safe_min, max_range)
|
||||
return {"min": safe_min, "max": safe_max}
|
||||
|
||||
|
||||
@@ -2262,8 +2262,8 @@ func _unit_reaches_tile(condition: Dictionary) -> bool:
|
||||
|
||||
|
||||
func _unit_matches_condition_ids(unit: Dictionary, unit_ids, officer_ids) -> bool:
|
||||
var has_unit_filter := typeof(unit_ids) == TYPE_ARRAY and not unit_ids.is_empty()
|
||||
var has_officer_filter := typeof(officer_ids) == TYPE_ARRAY and not officer_ids.is_empty()
|
||||
var has_unit_filter: bool = typeof(unit_ids) == TYPE_ARRAY and not unit_ids.is_empty()
|
||||
var has_officer_filter: bool = typeof(officer_ids) == TYPE_ARRAY and not officer_ids.is_empty()
|
||||
if not has_unit_filter and not has_officer_filter:
|
||||
return true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user