Show equipment in hover unit info
This commit is contained in:
@@ -249,7 +249,7 @@ func _create_hud() -> void:
|
||||
|
||||
cell_info_label = Label.new()
|
||||
cell_info_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
cell_info_label.custom_minimum_size = Vector2(420, 106)
|
||||
cell_info_label.custom_minimum_size = Vector2(420, 126)
|
||||
side_column.add_child(cell_info_label)
|
||||
|
||||
forecast_label = Label.new()
|
||||
@@ -337,7 +337,7 @@ func _create_hud() -> void:
|
||||
equip_menu.add_child(equip_list)
|
||||
|
||||
log_box = RichTextLabel.new()
|
||||
log_box.custom_minimum_size = Vector2(420, 170)
|
||||
log_box.custom_minimum_size = Vector2(420, 150)
|
||||
log_box.fit_content = false
|
||||
side_column.add_child(log_box)
|
||||
|
||||
@@ -1474,11 +1474,13 @@ func _update_cell_info() -> void:
|
||||
var unit: Dictionary = summary["unit"]
|
||||
if not unit.is_empty():
|
||||
var control_label := " Protected" if not bool(unit.get("controllable", true)) else ""
|
||||
text += "\n%s%s %s Lv.%d\nHP %d/%d MP %d/%d ATK %d DEF %d INT %d RNG %d-%d" % [
|
||||
text += "\n%s%s %s Lv.%d %s (%s)\nHP %d/%d MP %d/%d ATK %d DEF %d INT %d AGI %d\nMOV %d RNG %d-%d\nGear: %s" % [
|
||||
unit["name"],
|
||||
control_label,
|
||||
str(unit["team"]).capitalize(),
|
||||
unit["level"],
|
||||
str(unit.get("class", "Unit")),
|
||||
_format_move_type(str(unit.get("move_type", "foot"))),
|
||||
unit["hp"],
|
||||
unit["max_hp"],
|
||||
unit.get("mp", 0),
|
||||
@@ -1486,8 +1488,11 @@ func _update_cell_info() -> void:
|
||||
unit["atk"],
|
||||
unit["def"],
|
||||
unit.get("int", 0),
|
||||
unit.get("agi", 0),
|
||||
unit.get("move", 0),
|
||||
unit.get("min_range", 1),
|
||||
unit["range"]
|
||||
unit["range"],
|
||||
_format_hover_unit_equipment(unit)
|
||||
]
|
||||
var status_effects := state.get_status_effect_summary(unit["id"])
|
||||
if not status_effects.is_empty():
|
||||
@@ -3829,7 +3834,7 @@ func _format_unit_equipment(unit: Dictionary) -> String:
|
||||
var equipment := state.get_equipment_snapshot(unit["id"])
|
||||
var parts := []
|
||||
for slot in ["weapon", "armor", "accessory"]:
|
||||
var item_id := str(equipment.get(slot, ""))
|
||||
var item_id := _equipment_item_id(equipment, slot)
|
||||
if item_id.is_empty():
|
||||
parts.append("%s -" % slot.capitalize())
|
||||
else:
|
||||
@@ -3837,6 +3842,25 @@ func _format_unit_equipment(unit: Dictionary) -> String:
|
||||
return _join_strings(parts, ", ")
|
||||
|
||||
|
||||
func _format_hover_unit_equipment(unit: Dictionary) -> String:
|
||||
var equipment := state.get_equipment_snapshot(unit["id"])
|
||||
var parts := []
|
||||
for slot in ["weapon", "armor", "accessory"]:
|
||||
var item_id := _equipment_item_id(equipment, slot)
|
||||
if item_id.is_empty():
|
||||
parts.append("-")
|
||||
else:
|
||||
parts.append(_item_display_name(item_id))
|
||||
return _join_strings(parts, " / ")
|
||||
|
||||
|
||||
func _equipment_item_id(equipment: Dictionary, slot: String) -> String:
|
||||
var item_id = equipment.get(slot, "")
|
||||
if item_id == null:
|
||||
return ""
|
||||
return str(item_id)
|
||||
|
||||
|
||||
func _format_equipment_bonus_text(item: Dictionary) -> String:
|
||||
var parts := []
|
||||
var bonuses: Dictionary = item.get("bonuses", {})
|
||||
|
||||
Reference in New Issue
Block a user