Skip to content

Commit

Permalink
Merge pull request #7934 from swissloaf/revert-6879-removemonkey
Browse files Browse the repository at this point in the history
Adds monkey gamemode V3
  • Loading branch information
fluffe9911 committed Mar 9, 2020
2 parents b8cf472 + 48917ba commit e2bdf0e
Show file tree
Hide file tree
Showing 9 changed files with 440 additions and 2 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/role_preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define ROLE_CULTIST "Cultist"
#define ROLE_BLOB "Blob"
#define ROLE_NINJA "Space Ninja"
#define ROLE_MONKEY "Monkey"
#define ROLE_ABDUCTOR "Abductor"
#define ROLE_REVENANT "Revenant"
#define ROLE_DEVIL "Devil"
Expand Down Expand Up @@ -60,6 +61,7 @@ GLOBAL_LIST_INIT(special_roles, list(
ROLE_BLOB,
ROLE_NINJA,
ROLE_OBSESSED,
ROLE_MONKEY = /datum/game_mode/monkey,
ROLE_REVENANT,
ROLE_ABDUCTOR,
ROLE_DEVIL = /datum/game_mode/devil,
Expand Down
61 changes: 61 additions & 0 deletions code/datums/diseases/transformation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,67 @@
new_mob.ghostize(can_reenter_corpse = FALSE)
new_mob.key = null

/datum/disease/transformation/jungle_fever
name = "Jungle Fever"
cure_text = "Death."
cures = list(/datum/reagent/medicine/adminordrazine)
spread_text = "Monkey Bites"
spread_flags = DISEASE_SPREAD_SPECIAL
viable_mobtypes = list(/mob/living/carbon/monkey, /mob/living/carbon/human)
permeability_mod = 1
cure_chance = 1
disease_flags = CAN_CARRY|CAN_RESIST
desc = "Monkeys with this disease will bite humans, causing humans to mutate into a monkey."
severity = DISEASE_SEVERITY_BIOHAZARD
stage_prob = 4
visibility_flags = 0
agent = "Kongey Vibrion M-909"
new_form = /mob/living/carbon/monkey
bantype = ROLE_MONKEY


stage1 = list()
stage2 = list()
stage3 = list()
stage4 = list("<span class='warning'>Your back hurts.</span>", "<span class='warning'>You breathe through your mouth.</span>",
"<span class='warning'>You have a craving for bananas.</span>", "<span class='warning'>Your mind feels clouded.</span>")
stage5 = list("<span class='warning'>You feel like monkeying around.</span>")

/datum/disease/transformation/jungle_fever/do_disease_transformation(mob/living/carbon/affected_mob)
if(affected_mob.mind && !is_monkey(affected_mob.mind))
add_monkey(affected_mob.mind)
if(ishuman(affected_mob))
var/mob/living/carbon/monkey/M = affected_mob.monkeyize(TR_KEEPITEMS | TR_KEEPIMPLANTS | TR_KEEPORGANS | TR_KEEPDAMAGE | TR_KEEPVIRUS | TR_KEEPSTUNS | TR_KEEPREAGENTS | TR_KEEPSE)
M.ventcrawler = VENTCRAWLER_ALWAYS


/datum/disease/transformation/jungle_fever/stage_act()
..()
switch(stage)
if(2)
if(prob(2))
to_chat(affected_mob, "<span class='notice'>Your [pick("back", "arm", "leg", "elbow", "head")] itches.</span>")
if(3)
if(prob(4))
to_chat(affected_mob, "<span class='danger'>You feel a stabbing pain in your head.</span>")
affected_mob.confused += 10
if(4)
if(prob(3))
affected_mob.say(pick("Eeek, ook ook!", "Eee-eeek!", "Eeee!", "Ungh, ungh."), forced = "jungle fever")

/datum/disease/transformation/jungle_fever/cure()
remove_monkey(affected_mob.mind)
..()

/datum/disease/transformation/jungle_fever/monkeymode
visibility_flags = HIDDEN_SCANNER|HIDDEN_PANDEMIC
disease_flags = CAN_CARRY //no vaccines! no cure!

/datum/disease/transformation/jungle_fever/monkeymode/after_add()
if(affected_mob && !is_monkey_leader(affected_mob.mind))
visibility_flags = NONE



/datum/disease/transformation/robot

Expand Down
22 changes: 22 additions & 0 deletions code/datums/saymode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,28 @@
return FALSE
return TRUE

/datum/saymode/monkey
key = "k"
mode = MODE_MONKEY

/datum/saymode/monkey/handle_message(mob/living/user, message, datum/language/language)
var/datum/mind = user.mind
if(!mind)
return TRUE
if(is_monkey_leader(mind) || (ismonkey(user) && is_monkey(mind)))
user.log_talk(message, LOG_SAY, tag="monkey")
if(prob(75) && ismonkey(user))
user.visible_message("<span class='notice'>\The [user] chimpers.</span>")
var/msg = "<span class='[is_monkey_leader(mind) ? "monkeylead" : "monkeyhive"]'><b><font size=2>\[[is_monkey_leader(mind) ? "Monkey Leader" : "Monkey"]\]</font> [user]</b>: [message]</span>"
for(var/_M in GLOB.mob_list)
var/mob/M = _M
if(M in GLOB.dead_mob_list)
var/link = FOLLOW_LINK(M, user)
to_chat(M, "[link] [msg]")
if((is_monkey_leader(M.mind) || ismonkey(M)) && (M.mind in SSticker.mode.ape_infectees))
to_chat(M, msg)
return FALSE

/datum/saymode/darkspawn //yogs: darkspawn
key = "k"
mode = MODE_DARKSPAWN
Expand Down
132 changes: 132 additions & 0 deletions code/game/gamemodes/monkey/monkey.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/datum/game_mode
var/list/ape_infectees = list()
var/list/ape_leaders = list()

/datum/game_mode/monkey
name = "monkey"
config_tag = "monkey"
report_type = "monkey"
antag_flag = ROLE_MONKEY
false_report_weight = 1

required_players = 20
required_enemies = 1
recommended_enemies = 1

restricted_jobs = list("Cyborg", "AI")

announce_span = "Monkey"
announce_text = "One or more crewmembers have been infected with Jungle Fever! Crew: Contain the outbreak. None of the infected monkeys may escape alive to CentCom. Monkeys: Ensure that your kind lives on! Rise up against your captors!"

var/carriers_to_make = 1
var/list/carriers = list()

var/monkeys_to_win = 1
var/escaped_monkeys = 0

var/players_per_carrier = 30

var/datum/team/monkey/monkey_team



/datum/game_mode/monkey/pre_setup()
carriers_to_make = max(round(num_players()/players_per_carrier, 1), 1)

for(var/j = 0, j < carriers_to_make, j++)
if (!antag_candidates.len)
break
var/datum/mind/carrier = pick(antag_candidates)
carriers += carrier
carrier.special_role = "Monkey Leader"
carrier.restricted_roles = restricted_jobs
//log_game("[key_name(carrier)] has been selected as a Jungle Fever carrier") | yogs - redundant
antag_candidates -= carrier

if(!carriers.len)
setup_error = "No monkey candidates"
return FALSE
return TRUE

/datum/game_mode/monkey/post_setup()
for(var/datum/mind/carriermind in carriers)
var/datum/antagonist/monkey/M = add_monkey_leader(carriermind, monkey_team)
if(M)
monkey_team = M.monkey_team
return ..()

/datum/game_mode/monkey/check_finished()
if((SSshuttle.emergency.mode == SHUTTLE_ENDGAME) || station_was_nuked)
return TRUE

if(!round_converted)
for(var/datum/mind/monkey_mind in ape_infectees)
continuous_sanity_checked = TRUE
if(monkey_mind.current && monkey_mind.current.stat != DEAD)
return FALSE

var/datum/disease/D = new /datum/disease/transformation/jungle_fever() //ugly but unfortunately needed
for(var/mob/living/carbon/human/H in GLOB.alive_mob_list)
if(!is_station_level(H.z))
continue
if(H.mind && H.client && H.stat != DEAD)
if(H.HasDisease(D))
return FALSE

return ..()

/datum/game_mode/monkey/proc/check_monkey_victory()
if(SSshuttle.emergency.mode != SHUTTLE_ENDGAME)
return FALSE
var/datum/disease/D = new /datum/disease/transformation/jungle_fever()
for(var/mob/living/carbon/monkey/M in GLOB.alive_mob_list)
if (M.HasDisease(D))
if(M.onCentCom() || M.onSyndieBase())
escaped_monkeys++
if(escaped_monkeys >= monkeys_to_win)
return TRUE
else
return FALSE


/datum/game_mode/monkey/set_round_result()
..()
if(check_monkey_victory())
SSticker.mode_result = "win - monkey win"
else
SSticker.mode_result = "loss - staff stopped the monkeys"

/datum/game_mode/monkey/special_report()
if(check_monkey_victory())
return "<span class='redtext big'>The monkeys have overthrown their captors! Eeek eeeek!!</span>"
else
return "<span class='redtext big'>The staff managed to contain the monkey infestation!</span>"

/datum/game_mode/monkey/generate_report()
return "Reports of an ancient [pick("retrovirus", "flesh eating bacteria", "disease", "magical curse blamed on viruses", "banana blight")] outbreak that turn humans into monkeys has been reported in your quadrant. Any such infections may be treated with banana juice. If an outbreak occurs, ensure the station is quarantined to prevent a largescale outbreak at CentCom."

/proc/add_monkey_leader(datum/mind/monkey_mind)
if(is_monkey_leader(monkey_mind))
return FALSE
var/datum/antagonist/monkey/leader/M = monkey_mind.add_antag_datum(/datum/antagonist/monkey/leader)
return M

/proc/add_monkey(datum/mind/monkey_mind)
if(is_monkey(monkey_mind))
return FALSE
var/datum/antagonist/monkey/M = monkey_mind.add_antag_datum(/datum/antagonist/monkey)
return M

/proc/remove_monkey(datum/mind/monkey_mind)
if(!is_monkey(monkey_mind))
return FALSE
var/datum/antagonist/monkey/M = monkey_mind.has_antag_datum(/datum/antagonist/monkey)
M.on_removal()
return TRUE

/proc/is_monkey_leader(datum/mind/monkey_mind)
return monkey_mind && monkey_mind.has_antag_datum(/datum/antagonist/monkey/leader)

/proc/is_monkey(datum/mind/monkey_mind)
return monkey_mind && (monkey_mind.has_antag_datum(/datum/antagonist/monkey) || is_monkey_leader(monkey_mind))

2 changes: 1 addition & 1 deletion code/modules/admin/sql_ban_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
"Antagonist Positions" = list(ROLE_ABDUCTOR, ROLE_ALIEN, ROLE_BLOB,
ROLE_BROTHER, ROLE_CHANGELING, ROLE_CULTIST,
ROLE_DEVIL, ROLE_INTERNAL_AFFAIRS, ROLE_MALF,
ROLE_NINJA, ROLE_OPERATIVE,
ROLE_MONKEY, ROLE_NINJA, ROLE_OPERATIVE,
ROLE_OVERTHROW, ROLE_REV, ROLE_REVENANT,
ROLE_REV_HEAD, ROLE_SERVANT_OF_RATVAR, ROLE_SYNDICATE,
ROLE_TRAITOR, ROLE_WIZARD, ROLE_GANG, ROLE_VAMPIRE,
Expand Down

0 comments on commit e2bdf0e

Please sign in to comment.