diff --git a/code/game/objects/items/tcg/tcg_machines.dm b/code/game/objects/items/tcg/tcg_machines.dm index 0c54f41e1e6..49a03133327 100644 --- a/code/game/objects/items/tcg/tcg_machines.dm +++ b/code/game/objects/items/tcg/tcg_machines.dm @@ -3,10 +3,11 @@ #define RESOLVE_X 12 #define DEFAULT_POWER_COLOR "#af2323" #define DEFAULT_RESOLVE_COLOR "#3492d0" +#define DEFAULT_MODIFIED_COLOR "#1db327" /obj/machinery/trading_card_holder name = "card slot" - desc = "a slot for placing Tactical Game Cards." + desc = "A slot for placing Tactical Game Cards." icon = 'icons/obj/toys/tcgmisc.dmi' icon_state = "card_holder_inactive" use_power = NO_POWER_USE @@ -17,13 +18,14 @@ var/datum/card/card_template ///Reference to holographic currently active holographic summon var/obj/structure/trading_card_summon/current_summon + ///Color of the holograms produced. + var/team_color = "#77abff" var/summon_offset_x = 0 var/summon_offset_y = 1 - var/summon_type = /obj/structure/trading_card_summon /obj/machinery/trading_card_holder/attackby(obj/item/I, mob/user) - if(istype(I, /obj/item/tcgcard) && current_card == null) + if(istype(I, /obj/item/tcgcard) && current_summon == null) current_card = I card_template = current_card.extract_datum() if(card_template.cardtype == "Creature") @@ -32,26 +34,28 @@ to_chat(user, span_notice("You put the [current_card] card in [src].")) icon_state = "card_holder_active" update_appearance() - current_summon = new summon_type(locate(x + summon_offset_x, y + summon_offset_y, z)) + current_summon = new(locate(x + summon_offset_x, y + summon_offset_y, z)) current_summon.template = card_template current_summon.card_ref = current_card + current_summon.team_color = team_color current_summon.load_model() else to_chat(user, span_notice("The [src] smartly rejects the non-creature card.")) current_card = null - return..() + return ..() else - return..() + return ..() GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) /obj/machinery/trading_card_holder/attack_hand(mob/user) - if(current_card) + if(current_summon) var/list/choices = GLOB.tcgcard_machine_radial_choices if(!length(choices)) choices = GLOB.tcgcard_machine_radial_choices = list( "Pickup" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_pickup"), "Tap" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_tap"), + "Mark" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_mark"), "Modify" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_modify"), ) var/choice = show_radial_menu(user, src, choices, custom_check = CALLBACK(src, PROC_REF(check_menu), user), require_near = TRUE, tooltips = TRUE) @@ -59,24 +63,44 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) return COMPONENT_CANCEL_ATTACK_CHAIN switch(choice) if("Tap") - current_summon.update_tapped(current_card) + current_summon.update_tapped() if("Pickup") - user.put_in_hands(current_card) - to_chat(user, span_notice("You take the [current_card] card out of [src].")) - current_card = null + if(current_card) + user.put_in_hands(current_card) + to_chat(user, span_notice("You take the [current_card] card out of [src].")) + current_card = null + else + to_chat(user, span_notice("The blank card dematerializes.")) card_template = null icon_state = "card_holder_inactive" update_appearance() if(current_summon) qdel(current_summon) + current_summon = null if("Modify") current_summon.modify_stats(user) + if("Mark") + current_summon.update_marked() if(null) return else to_chat(user, span_warning("[src] is empty!")) add_fingerprint(user) - return..() + return ..() + +/obj/machinery/trading_card_holder/attack_hand_secondary(mob/user) + if(isnull(current_summon)) + var/card_name = tgui_input_text(user, "Insert card name", "Blank Card Naming", "blank card", MAX_NAME_LEN) + if(isnull(card_name)) + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN + current_summon = new /obj/structure/trading_card_summon/blank(locate(x + summon_offset_x, y + summon_offset_y, z)) + icon_state = "card_holder_active" + current_summon.name = card_name + current_summon.team_color = team_color + current_summon.load_model() + else + to_chat(user, span_notice("The [src] already contains a card.")) + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN /obj/machinery/trading_card_holder/proc/check_menu(mob/living/user) if(!istype(user)) @@ -95,11 +119,14 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) if(card_template) . += span_notice("There is currently a [card_template.name] card inserted.") else - . += span_notice("There is no card currently inserted.") + if(current_summon) + . += span_notice("There is currently a blank card inserted.") + else + . += span_notice("There is no card currently inserted.") /obj/machinery/trading_card_holder/red summon_offset_y = -1 - summon_type = /obj/structure/trading_card_summon/red + team_color = "#ff7777" /obj/structure/trading_card_summon name = "coder" @@ -118,6 +145,8 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) var/summon_resolve ///Is the card tapped (rotated) or not. var/tapped = FALSE + ///Is the card marked or not. + var/marked = FALSE ///Reference to the hologram object itself. var/obj/effect/overlay/card_summon/hologram @@ -130,7 +159,7 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) ///Color of the resolve stat. var/resolve_color = DEFAULT_RESOLVE_COLOR ///Color that stats become if they've been changed from their default. - var/modified_color = "#1db327" + var/modified_color = DEFAULT_MODIFIED_COLOR ///Color of the holograms produced. var/team_color = "#77abff" @@ -149,7 +178,6 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) summon_resolve = template.resolve update_overlays() - /obj/structure/trading_card_summon/get_name_chaser(mob/user, list/name_chaser = list()) name_chaser += "Faction: [template.faction]" name_chaser += "Cost: [template.summoncost]" @@ -162,7 +190,6 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) /obj/structure/trading_card_summon/update_overlays() . = ..() - var/overlay = update_stats(power_overlay, STAT_Y, summon_power, power_color, x_offset = POWER_X) if(overlay) @@ -170,6 +197,12 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) overlay = update_stats(resolve_overlay, STAT_Y, summon_resolve, resolve_color, x_offset = RESOLVE_X) if(overlay) resolve_overlay = overlay + + if(marked) + var/mutable_appearance/mark_overlay = mutable_appearance('icons/obj/toys/tcgmisc.dmi', "gem_green", 9) + mark_overlay.pixel_w = 12 + mark_overlay.pixel_z = 12 + . += mark_overlay /obj/structure/trading_card_summon/proc/update_stats(obj/effect/overlay/status_display_text/overlay, pos_y, stats, text_color, x_offset) if(overlay && stats == overlay.message) @@ -185,13 +218,17 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) vis_contents += stats_display return stats_display -/obj/structure/trading_card_summon/proc/update_tapped(obj/item/tcgcard/current_card) +/obj/structure/trading_card_summon/proc/update_tapped() if(tapped) hologram.transform = turn(hologram.transform, 90) else hologram.transform = turn(hologram.transform, -90) tapped = !tapped +/obj/structure/trading_card_summon/proc/update_marked() + marked = !marked + update_icon(UPDATE_OVERLAYS) + /obj/structure/trading_card_summon/proc/modify_stats(mob/living/user) summon_power = num2text(tgui_input_number(user, "Please input power value", "Stat Modification", text2num(template.power), 25)) if(summon_power == template.power) @@ -210,8 +247,32 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) qdel(hologram) return ..() -/obj/structure/trading_card_summon/red - team_color = "#ff7777" +/obj/structure/trading_card_summon/blank + name = "blank card" + desc = "A blank card used to represent cards summoned by other cards." + summon_power = 1 + summon_resolve = 1 + power_color = DEFAULT_MODIFIED_COLOR + resolve_color = DEFAULT_MODIFIED_COLOR + +/obj/structure/trading_card_summon/blank/load_model() + hologram = new(loc) + + hologram.icon = 'icons/obj/toys/tcgmisc.dmi' + hologram.icon_state = "cardback" + hologram.name = name + hologram.alpha = 170 + hologram.add_atom_colour(team_color, FIXED_COLOUR_PRIORITY) + update_overlays() + +/obj/structure/trading_card_summon/blank/get_name_chaser(mob/user, list/name_chaser) + name_chaser += "Power/Resolve: [summon_power]/[summon_resolve]" + return name_chaser + +/obj/structure/trading_card_summon/blank/modify_stats(mob/living/user) + summon_power = num2text(tgui_input_number(user, "Please input power value", "Stat Modification", text2num(summon_power), 25)) + summon_resolve = num2text(tgui_input_number(user, "Please input resolve value", "Stat Modification", text2num(summon_resolve), 25)) + update_overlays() #undef STAT_Y #undef POWER_X @@ -225,7 +286,7 @@ GLOBAL_LIST_EMPTY(tcgcard_machine_radial_choices) ///A button that generates a player manipulable bar of icons, in this case a mana bar. /obj/machinery/trading_card_button name = "mana control panel" - desc = "a set of buttons that lets you keep track of your mana when playing Tactical Game Cards." + desc = "A set of buttons that lets you keep track of your mana when playing Tactical Game Cards." icon = 'icons/obj/toys/tcgmisc.dmi' icon_state = "mana_buttons" use_power = NO_POWER_USE @@ -300,7 +361,7 @@ GLOBAL_LIST_EMPTY(tcgcard_mana_bar_radial_choices) /obj/machinery/trading_card_button/health name = "life control panel" - desc = "a set of buttons that lets you keep track of your life shards when playing Tactical Game Cards." + desc = "A set of buttons that lets you keep track of your life shards when playing Tactical Game Cards." icon_state = "health_buttons" display_panel_type = /obj/effect/decal/trading_card_panel/health panel_offset_x = -1 diff --git a/icons/hud/radial.dmi b/icons/hud/radial.dmi index d49c08e0222..897cb3a872e 100644 Binary files a/icons/hud/radial.dmi and b/icons/hud/radial.dmi differ diff --git a/icons/obj/toys/tcgmisc.dmi b/icons/obj/toys/tcgmisc.dmi index 1ba742470d4..e5415bcc02a 100644 Binary files a/icons/obj/toys/tcgmisc.dmi and b/icons/obj/toys/tcgmisc.dmi differ