Swap effects to abilities
This commit is contained in:
@@ -2218,6 +2218,7 @@ func _advance_ability_targeting() -> void:
|
||||
|
||||
## Highlight valid ability targets in blue.
|
||||
func _highlight_ability_targets(action: Dictionary) -> void:
|
||||
print("[Highlighter]: action:: ", action)
|
||||
var target_sel : Dictionary = action.get("target", {})
|
||||
var type_ : String = target_sel.get("type", "Unit")
|
||||
var ownership : String = target_sel.get("ownership", "Any")
|
||||
@@ -2232,7 +2233,7 @@ func _highlight_ability_targets(action: Dictionary) -> void:
|
||||
if _tile_passes_filters(tx, ty, filters):
|
||||
_add_highlight(tx, ty, HI_BLUE)
|
||||
return
|
||||
|
||||
|
||||
# Unit-type target — highlight the board position of each matching unit.
|
||||
var include_enemy : bool = ownership in ["Enemy", "Any"]
|
||||
var include_friendly : bool = ownership in ["Owner", "Ally", "Any"]
|
||||
@@ -2257,6 +2258,8 @@ func _highlight_ability_targets(action: Dictionary) -> void:
|
||||
src_pos_ab = Game.get_unit_by_id(_ability_unit_id).get("position", {})
|
||||
|
||||
for u: Dictionary in targets:
|
||||
if type_ == "Spirit" || type_ == "ArchSpirit" || type_ == "SpiritToken" || type_ == "Ruin":
|
||||
if u.get("cardType", "").to_lower() != type_.to_lower() : continue
|
||||
var pos : Dictionary = u.get("position", {})
|
||||
if pos.is_empty(): continue
|
||||
if not _unit_passes_filters(u, filters): continue
|
||||
@@ -2495,7 +2498,6 @@ func _on_hand_card_clicked(iid: String, _panel: PanelContainer) -> void:
|
||||
|
||||
# Repentance / Instinct — may have an active ability requiring unit target selection.
|
||||
if card.get("cardType", "") in ["Repentance", "Instinct"]:
|
||||
print("GAMESCREEN: I AM A REPENT OR INSTINCT")
|
||||
# Deselect: same card clicked again.
|
||||
if (_mode == Mode.ABILITY_TARGET and _ability_card_id == iid) or \
|
||||
(_mode == Mode.CARD_FROM_HAND and _sel_card_id == iid):
|
||||
@@ -2504,29 +2506,24 @@ func _on_hand_card_clicked(iid: String, _panel: PanelContainer) -> void:
|
||||
if _mode in [Mode.CARD_FROM_HAND, Mode.TERRAMORPHA_SELECT] or \
|
||||
(_mode == Mode.ABILITY_TARGET and not _ability_card_id.is_empty()):
|
||||
_set_mode(Mode.NONE)
|
||||
# Parse effectsJson for the first Active ability.
|
||||
var abs_raw : String = card.get("effectsJson", "")
|
||||
print("GAMESCREEN: card", card)
|
||||
# Parse abilitiesJson for the first Active ability.
|
||||
var abs_raw : String = card.get("abilitiesJson", "")
|
||||
if not abs_raw.is_empty():
|
||||
print("GAMESCREEN: Not Empty")
|
||||
var parsed_variant : Array = JSON.parse_string(abs_raw)
|
||||
if parsed_variant is Array:
|
||||
print("GAMESCREEN: Is Array")
|
||||
var parsed : Array = _normalize_keys(parsed_variant)
|
||||
for ab_var: Variant in parsed:
|
||||
print("GAMESCREEN: ab_var parsed")
|
||||
if not (ab_var is Dictionary): continue
|
||||
var ab : Dictionary = ab_var
|
||||
if ab.get("type", "") != "active": continue
|
||||
if ab.get("type", "").to_lower() != "active" :
|
||||
continue
|
||||
# Extract target-side activation conditions.
|
||||
var tgt_conds : Array = []
|
||||
for cv: Variant in ab.get("activationconditions", []):
|
||||
print("GAMESCREEN: cv block")
|
||||
if not (cv is Dictionary): continue
|
||||
var cd : Dictionary = cv
|
||||
if cd.get("subject", "") == "target":
|
||||
tgt_conds.append(cd)
|
||||
print("GAMESCREEN: Supposed to enter Target here")
|
||||
# Enter unit-target selection mode.
|
||||
_ability_card_id = iid
|
||||
_ability_unit_id = ""
|
||||
@@ -2537,10 +2534,8 @@ func _on_hand_card_clicked(iid: String, _panel: PanelContainer) -> void:
|
||||
_ability_targets = []
|
||||
_ability_cur_action_idx = 0
|
||||
_sel_card_id = iid
|
||||
print("GAMESCREEN: Setting Mode: ", Mode.ABILITY_TARGET)
|
||||
_set_mode(Mode.ABILITY_TARGET)
|
||||
_clear_highlights()
|
||||
print("GAMESCREEN: Calling Start bility targeting")
|
||||
_start_ability_targeting()
|
||||
return
|
||||
# No active ability — channel immediately.
|
||||
|
||||
Reference in New Issue
Block a user