diff --git a/code/__DEFINES/achievements.dm b/code/__DEFINES/achievements.dm index ed82c8ce1d7..4e8ea6b3567 100644 --- a/code/__DEFINES/achievements.dm +++ b/code/__DEFINES/achievements.dm @@ -28,6 +28,24 @@ //Skill medal hub IDs #define MEDAL_LEGENDARY_MINER "Legendary Miner" +//Mafia medal hub IDs (wins) +#define MAFIA_MEDAL_ASSISTANT "Assistant" +#define MAFIA_MEDAL_DETECTIVE "Detective" +#define MAFIA_MEDAL_PSYCHOLOGIST "Psychologist" +#define MAFIA_MEDAL_CHAPLAIN "Chaplain" +#define MAFIA_MEDAL_MD "Medical Doctor" +#define MAFIA_MEDAL_LAWYER "Lawyer" +#define MAFIA_MEDAL_HOP "Head of Personnel" +#define MAFIA_MEDAL_CHANGELING "CHANGELING" +#define MAFIA_MEDAL_THOUGHTFEEDER "Thoughtfeeder" +#define MAFIA_MEDAL_TRAITOR "Traitor" +#define MAFIA_MEDAL_NIGHTMARE "Nightmare" +#define MAFIA_MEDAL_FUGITIVE "Fugitive" +#define MAFIA_MEDAL_OBSESSED "Obsessed" +#define MAFIA_MEDAL_CLOWN "Clown" + +//Mafia medal hub IDs (misc stuff) +#define MAFIA_MEDAL_HATED "Universally Hated" //Boss medals diff --git a/code/datums/achievements/_achievement_data.dm b/code/datums/achievements/_achievement_data.dm index cfa1ab6ed01..384663c156e 100644 --- a/code/datums/achievements/_achievement_data.dm +++ b/code/datums/achievements/_achievement_data.dm @@ -107,7 +107,7 @@ /datum/achievement_data/ui_data(mob/user) var/ret_data = list() // screw standards (qustinnus you must rename src.data ok) - ret_data["categories"] = list("Bosses", "Misc" , "Scores") + ret_data["categories"] = list("Bosses", "Misc", "Mafia", "Scores") ret_data["achievements"] = list() ret_data["user_key"] = user.ckey diff --git a/code/datums/achievements/mafia_achievements.dm b/code/datums/achievements/mafia_achievements.dm new file mode 100644 index 00000000000..414917413a9 --- /dev/null +++ b/code/datums/achievements/mafia_achievements.dm @@ -0,0 +1,97 @@ +/datum/award/achievement/mafia + category = "Mafia" + icon = "basemafia" + +///ALL THE ACHIEVEMENTS FOR WINNING A ROUND AS A ROLE/// + +/datum/award/achievement/mafia/assistant + name = "Assistant Victory" + desc = "If you got killed instead of someone more important, you just flexed the true strength of your \"\"\"\"role\"\"\"\"." + database_id = MAFIA_MEDAL_ASSISTANT + icon = "assistant" + +/datum/award/achievement/mafia/detective + name = "Detective Victory" + desc = "If you did this with a Medical Doctor in the game, i'm not really that impressed." + database_id = MAFIA_MEDAL_DETECTIVE + icon = "detective" + +/datum/award/achievement/mafia/psychologist + name = "Psychologist Victory" + desc = "You learned how to not reveal someone random night one! Or... maybe you're just a lucky bastard." + database_id = MAFIA_MEDAL_PSYCHOLOGIST + icon = "psychologist" + +/datum/award/achievement/mafia/chaplain + name = "Chaplain Victory" + desc = "Useless... until the one night the thoughtfeeder confidently claims themselves as detective. Mafia's true bullshit detector." + database_id = MAFIA_MEDAL_CHAPLAIN + icon = "chaplain" + +/datum/award/achievement/mafia/md + name = "Medical Doctor Victory" + desc = "Congratulations on learning how to not talk!" + database_id = MAFIA_MEDAL_MD + icon = "md" + +/datum/award/achievement/mafia/lawyer + name = "Lawyer Victory" + desc = "Oh don't mind me, i'm just the worst rol- Oops, I just instantly ended the game." + database_id = MAFIA_MEDAL_LAWYER + icon = "lawyer" + +/datum/award/achievement/mafia/hop + name = "Head of Personnel Victory" + desc = "King of Assistants, waster of a single mafia's night, thrower of games." + database_id = MAFIA_MEDAL_HOP + icon = "hop" + +/datum/award/achievement/mafia/changeling + name = "Changeling Victory" + desc = "I think the changelings are metacomming." + database_id = MAFIA_MEDAL_CHANGELING + icon = "changeling" + +/datum/award/achievement/mafia/thoughtfeeder + name = "Thoughtfeeder Victory" + desc = "Clown's best friend. And Obsessed. And fugitive? Whose side are you on?!" + database_id = MAFIA_MEDAL_THOUGHTFEEDER + icon = "thoughtfeeder" + +/datum/award/achievement/mafia/traitor + name = "Traitor Victory" + desc = "Guys, we still have two more changelings to ki-!! TRAITOR VICTORY !!" + database_id = MAFIA_MEDAL_TRAITOR + icon = "traitor" + +/datum/award/achievement/mafia/nightmare + name = "Nightmare Victory" + desc = "DID YOUR LIGHT FLICKER?!" + database_id = MAFIA_MEDAL_NIGHTMARE + icon = "nightmare" + +/datum/award/achievement/mafia/fugitive + name = "Fugitive Victory" + desc = "I'm just the description on an achievement, but if you end up having to choose between town and changelings, go changelings." + database_id = MAFIA_MEDAL_FUGITIVE + icon = "fugitive" + +/datum/award/achievement/mafia/obsessed + name = "Obsessed Victory" + desc = "You got your target lynched, so instead of being spiteful and annoying, you're just smug and annoying." + database_id = MAFIA_MEDAL_OBSESSED + icon = "obsessed" + +/datum/award/achievement/mafia/clown + name = "Clown Victory" + desc = "Did you know this works on traitors, despite their immunity? If you hit the jackpot and manage to kill one, they'll salt into the next dimension. Clown tips!" + database_id = MAFIA_MEDAL_CLOWN + icon = "clown" + +///ALL THE ACHIEVEMENTS FOR MISC MAFIA ODDITIES/// + +/datum/award/achievement/mafia/universally_hated + name = "Universally Hated" + desc = "Managed to get more than 12 votes when put up on trial, jesus christ." + database_id = MAFIA_MEDAL_HATED + icon = "hated" diff --git a/code/modules/mafia/controller.dm b/code/modules/mafia/controller.dm index 793716848f5..b2f0c613533 100644 --- a/code/modules/mafia/controller.dm +++ b/code/modules/mafia/controller.dm @@ -190,7 +190,10 @@ */ /datum/mafia_controller/proc/check_trial(verbose = TRUE) var/datum/mafia_role/loser = get_vote_winner("Day")//, majority_of_town = TRUE) + var/loser_votes = get_vote_count(loser,"Day") if(loser) + if(loser_votes > 12) + loser.body.client?.give_award(/datum/award/achievement/mafia/universally_hated, loser.body) send_message("[loser.body.real_name] wins the day vote, Listen to their defense and vote \"INNOCENT\" or \"GUILTY\"!") on_trial = loser on_trial.body.forceMove(get_turf(town_center_landmark)) @@ -254,6 +257,10 @@ * * returns TRUE if someone won the game, halting other procs from continuing in the case of a victory */ /datum/mafia_controller/proc/check_victory() + //needed for achievements + var/list/total_town = list() + var/list/total_mafia = list() + var/alive_town = 0 var/alive_mafia = 0 var/list/solos_to_ask = list() //need to ask after because first round is counting team sizes @@ -263,13 +270,17 @@ ///PHASE ONE: TALLY UP ALL NUMBERS OF PEOPLE STILL ALIVE for(var/datum/mafia_role/R in all_roles) - if(R.game_status == MAFIA_ALIVE) - switch(R.team) - if(MAFIA_TEAM_MAFIA) + switch(R.team) + if(MAFIA_TEAM_MAFIA) + total_mafia += R + if(R.game_status == MAFIA_ALIVE) alive_mafia += R.vote_power - if(MAFIA_TEAM_TOWN) + if(MAFIA_TEAM_TOWN) + total_town += R + if(R.game_status == MAFIA_ALIVE) alive_town += R.vote_power - if(MAFIA_TEAM_SOLO) + if(MAFIA_TEAM_SOLO) + if(R.game_status == MAFIA_ALIVE) if(R.solo_counts_as_town) alive_town += R.vote_power solos_to_ask += R @@ -286,6 +297,8 @@ var/solo_end = FALSE for(var/datum/mafia_role/winner in total_victors) send_message("!! [uppertext(winner.name)] VICTORY !!") + var/client/winner_client = GLOB.directory[winner.player_key] + winner_client?.give_award(winner.winner_award, winner.body) solo_end = TRUE if(solo_end) start_the_end() @@ -293,10 +306,16 @@ if(blocked_victory) return FALSE if(alive_mafia == 0) + for(var/datum/mafia_role/townie in total_town) + var/client/townie_client = GLOB.directory[townie.player_key] + townie_client?.give_award(townie.winner_award, townie.body) start_the_end("!! TOWN VICTORY !!") return TRUE else if(alive_mafia >= alive_town) //guess could change if town nightkill is added start_the_end("!! MAFIA VICTORY !!") + for(var/datum/mafia_role/changeling in total_mafia) + var/client/changeling_client = GLOB.directory[changeling.player_key] + changeling_client?.give_award(changeling.winner_award, changeling.body) return TRUE /** diff --git a/code/modules/mafia/roles.dm b/code/modules/mafia/roles.dm index e1f0c0143a7..672ca789e12 100644 --- a/code/modules/mafia/roles.dm +++ b/code/modules/mafia/roles.dm @@ -18,12 +18,12 @@ //action = uses var/list/actions = list() var/list/targeted_actions = list() + //what the role gets when it wins a game + var/winner_award = /datum/award/achievement/mafia/assistant //so mafia have to also kill them to have a majority var/solo_counts_as_town = FALSE //(don't set this for town) - var/game_status = MAFIA_ALIVE - var/special_theme //set this to something cool for antagonists and their window will look different var/list/role_notes = list() @@ -116,6 +116,7 @@ desc = "You can investigate a single person each night to learn their team." revealed_outfit = /datum/outfit/mafia/detective role_type = TOWN_INVEST + winner_award = /datum/award/achievement/mafia/detective targeted_actions = list("Investigate") @@ -166,6 +167,7 @@ desc = "You can visit someone ONCE PER GAME to reveal their true role in the morning!" revealed_outfit = /datum/outfit/mafia/psychologist role_type = TOWN_INVEST + winner_award = /datum/award/achievement/mafia/psychologist targeted_actions = list("Reveal") var/datum/mafia_role/current_target @@ -200,6 +202,7 @@ desc = "You can communicate with spirits of the dead each night to discover dead crewmember roles." revealed_outfit = /datum/outfit/mafia/chaplain role_type = TOWN_INVEST + winner_award = /datum/award/achievement/mafia/chaplain targeted_actions = list("Pray") var/current_target @@ -230,9 +233,9 @@ desc = "You can protect a single person each night from killing." revealed_outfit = /datum/outfit/mafia/md // /mafia <- outfit must be readded (just make a new mafia outfits file for all of these) role_type = TOWN_PROTECT + winner_award = /datum/award/achievement/mafia/md targeted_actions = list("Protect") - var/datum/mafia_role/current_protected /datum/mafia_role/md/New(datum/mafia_controller/game) @@ -275,9 +278,9 @@ desc = "You can choose a person during the day to provide extensive legal advice to during the night, preventing night actions." revealed_outfit = /datum/outfit/mafia/lawyer role_type = TOWN_PROTECT + winner_award = /datum/award/achievement/mafia/lawyer targeted_actions = list("Advise") - var/datum/mafia_role/current_target /datum/mafia_role/lawyer/New(datum/mafia_controller/game) @@ -330,6 +333,7 @@ desc = "You can reveal yourself once per game, tripling your vote power but becoming unable to be protected!" revealed_outfit = /datum/outfit/mafia/hop role_type = TOWN_MISC + winner_award = /datum/award/achievement/mafia/hop targeted_actions = list("Reveal") @@ -350,6 +354,8 @@ desc = "You're a member of the changeling hive. Use ':j' talk prefix to talk to your fellow lings." team = MAFIA_TEAM_MAFIA role_type = MAFIA_REGULAR + winner_award = /datum/award/achievement/mafia/changeling + revealed_outfit = /datum/outfit/mafia/changeling special_theme = "syndicate" win_condition = "become majority over the town and no solo killing role can stop them." @@ -366,8 +372,9 @@ name = "Thoughtfeeder" desc = "You're a changeling variant that feeds on the memories of others. Use ':j' talk prefix to talk to your fellow lings, and visit people at night to learn their role." role_type = MAFIA_SPECIAL - targeted_actions = list("Learn Role") + winner_award = /datum/award/achievement/mafia/thoughtfeeder + targeted_actions = list("Learn Role") var/datum/mafia_role/current_investigation /datum/mafia_role/mafia/thoughtfeeder/New(datum/mafia_controller/game) @@ -408,6 +415,8 @@ win_condition = "kill everyone." team = MAFIA_TEAM_SOLO role_type = NEUTRAL_KILL + winner_award = /datum/award/achievement/mafia/traitor + targeted_actions = list("Night Kill") revealed_outfit = /datum/outfit/mafia/traitor special_theme = "syndicate" @@ -459,6 +468,8 @@ detect_immune = TRUE team = MAFIA_TEAM_SOLO role_type = NEUTRAL_KILL + winner_award = /datum/award/achievement/mafia/nightmare + targeted_actions = list("Flicker", "Hunt") var/list/flickering = list() var/datum/mafia_role/flicker_target @@ -528,6 +539,8 @@ win_condition = "survive to the end of the game, with anyone" team = MAFIA_TEAM_SOLO role_type = NEUTRAL_DISRUPT + winner_award = /datum/award/achievement/mafia/fugitive + actions = list("Self Preservation") var/charges = 2 var/protection_status = FUGITIVE_NOT_PRESERVING @@ -572,6 +585,8 @@ /datum/mafia_role/fugitive/proc/survived(datum/mafia_controller/game) if(game_status == MAFIA_ALIVE) + var/client/winner_client = GLOB.directory[player_key] + winner_client?.give_award(winner_award, body) game.send_message("!! FUGITIVE VICTORY !!") #undef FUGITIVE_NOT_PRESERVING @@ -583,8 +598,9 @@ win_condition = "lynch their obsession." team = MAFIA_TEAM_SOLO role_type = NEUTRAL_DISRUPT - revealed_outfit = /datum/outfit/mafia/obsessed // /mafia <- outfit must be readded (just make a new mafia outfits file for all of these) + winner_award = /datum/award/achievement/mafia/obsessed + revealed_outfit = /datum/outfit/mafia/obsessed // /mafia <- outfit must be readded (just make a new mafia outfits file for all of these) solo_counts_as_town = TRUE //after winning or whatever, can side with whoever. they've already done their objective! var/datum/mafia_role/obsession var/lynched_target = FALSE @@ -614,6 +630,8 @@ return if(lynch) game.send_message("!! OBSESSED VICTORY !!") + var/client/winner_client = GLOB.directory[player_key] + winner_client?.give_award(winner_award, body) reveal_role(game, FALSE) else to_chat(body, "You have failed your objective to lynch [obsession.body]!") @@ -625,6 +643,7 @@ revealed_outfit = /datum/outfit/mafia/clown team = MAFIA_TEAM_SOLO role_type = NEUTRAL_DISRUPT + winner_award = /datum/award/achievement/mafia/clown /datum/mafia_role/clown/New(datum/mafia_controller/game) . = ..() @@ -635,4 +654,6 @@ var/datum/mafia_role/victim = pick(game.judgement_guilty_votes) game.send_message("[body.real_name] WAS A CLOWN! HONK! They take down [victim.body.real_name] with their last prank.") game.send_message("!! CLOWN VICTORY !!") + var/client/winner_client = GLOB.directory[player_key] + winner_client?.give_award(winner_award, body) victim.kill(game,FALSE) diff --git a/icons/UI_Icons/Achievements/Mafia/assistant.png b/icons/UI_Icons/Achievements/Mafia/assistant.png new file mode 100644 index 00000000000..0cfc93b166f Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/assistant.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/changeling.png b/icons/UI_Icons/Achievements/Mafia/changeling.png new file mode 100644 index 00000000000..9e44c902633 Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/changeling.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/chaplain.png b/icons/UI_Icons/Achievements/Mafia/chaplain.png new file mode 100644 index 00000000000..ac482912823 Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/chaplain.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/clown.png b/icons/UI_Icons/Achievements/Mafia/clown.png new file mode 100644 index 00000000000..4f2d9194715 Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/clown.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/detective.png b/icons/UI_Icons/Achievements/Mafia/detective.png new file mode 100644 index 00000000000..edeba8c402d Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/detective.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/fugitive.png b/icons/UI_Icons/Achievements/Mafia/fugitive.png new file mode 100644 index 00000000000..86beb21b1bd Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/fugitive.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/hated.png b/icons/UI_Icons/Achievements/Mafia/hated.png new file mode 100644 index 00000000000..00ea735200c Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/hated.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/hop.png b/icons/UI_Icons/Achievements/Mafia/hop.png new file mode 100644 index 00000000000..f60719974da Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/hop.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/lawyer.png b/icons/UI_Icons/Achievements/Mafia/lawyer.png new file mode 100644 index 00000000000..1c9bba20364 Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/lawyer.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/md.png b/icons/UI_Icons/Achievements/Mafia/md.png new file mode 100644 index 00000000000..32bc972a4ae Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/md.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/nightmare.png b/icons/UI_Icons/Achievements/Mafia/nightmare.png new file mode 100644 index 00000000000..14c50b403a2 Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/nightmare.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/obsessed.png b/icons/UI_Icons/Achievements/Mafia/obsessed.png new file mode 100644 index 00000000000..b92ba5b582f Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/obsessed.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/psychologist.png b/icons/UI_Icons/Achievements/Mafia/psychologist.png new file mode 100644 index 00000000000..60171ca723b Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/psychologist.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/thoughtfeeder.png b/icons/UI_Icons/Achievements/Mafia/thoughtfeeder.png new file mode 100644 index 00000000000..009bac0d99d Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/thoughtfeeder.png differ diff --git a/icons/UI_Icons/Achievements/Mafia/traitor.png b/icons/UI_Icons/Achievements/Mafia/traitor.png new file mode 100644 index 00000000000..28c8c521917 Binary files /dev/null and b/icons/UI_Icons/Achievements/Mafia/traitor.png differ diff --git a/icons/UI_Icons/Achievements/basemafia.png b/icons/UI_Icons/Achievements/basemafia.png new file mode 100644 index 00000000000..b22676d8915 Binary files /dev/null and b/icons/UI_Icons/Achievements/basemafia.png differ diff --git a/tgstation.dme b/tgstation.dme index eaa7538d93e..d0fc21e6ea9 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -364,6 +364,7 @@ #include "code\datums\achievements\boss_achievements.dm" #include "code\datums\achievements\boss_scores.dm" #include "code\datums\achievements\hardcore_random.dm" +#include "code\datums\achievements\mafia_achievements.dm" #include "code\datums\achievements\misc_achievements.dm" #include "code\datums\achievements\skill_achievements.dm" #include "code\datums\actions\beam_rifle.dm"