Skip to content

Commit

Permalink
Adds a strict limit for how many antagonists of a type can be added i…
Browse files Browse the repository at this point in the history
…n the round via storyteller (Bubberstation#1834)

## About The Pull Request

Adds a strict limit for how many antagonists of the same type can be
added in the round. This affects both midrounds and roundstarts.

### Current limits are:
- Bloodsucker: 3
- Changeling: 4
- Heretic: 2
- Malfunctioning AI: 1
- Nuke Ops: 5
- Spies: 4
- Traitor: 6

If an antagonist type is not listed here, there is no limit.

This does not affect an admin's ability to bus in additional antagonists
via the antag panel. This just affects storyteller.

## Why It's Good For The Game

Storyteller does not actually have a maximum cap of how many antagonists
of a certain type can be in the game. This means that while the maximum
heretics that storyteller can spawn roundstart is 2, there is actually
no limit (except for cost) for how many heretics can be in a round, as
the midround heretic event does not consider existing heretics in the
round.

This PR fixes that and adds a hard cap to antagonists of a certain type
in a round. This should prevent the rare and extremely stressful round
of 6 heretics spawning or something insane.

## Proof Of Testing

Untested. Can't really test this because I can't fake antag players.

## Changelog


:cl: BurgerBB
balance: Adds a strict limit for how many antagonists of the same type
can be added in the round. This affects both midrounds and roundstarts.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

<!-- By opening a pull request. You have read and understood the
repository rules located on the main README.md on this project. -->
  • Loading branch information
BurgerLUA authored Jul 26, 2024
1 parent 5c86359 commit 3c45262
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
var/base_antags = 2
/// How many maximum antags can we spawn
var/maximum_antags = 6
/// Strict limit on how many antagonists of this type that should be in this round. 0 to ignore.
var/maximum_antags_global = 0
/// For this many players we'll add 1 up to the maximum antag amount
var/denominator = 20
/// The antag flag to be used
Expand Down Expand Up @@ -83,8 +85,22 @@
typepath = /datum/round_event/antagonist/solo

/datum/round_event_control/antagonist/proc/get_antag_amount()

var/people = SSgamemode.get_correct_popcount()
var/amount = base_antags + FLOOR(people / denominator, 1)

if(antag_datum && maximum_antags_global > 0)
var/antag_slots_left = maximum_antags_global
for(var/datum/antagonist/existing_antagonist as anything in GLOB.antagonists)
if(QDELETED(existing_antagonist) || QDELETED(existing_antagonist.owner) || QDELETED(existing_antagonist.owner.current)) //This feels messy, but it just werks.
continue
if(!istype(existing_antagonist,antag_datum)) //Obviously ignore other antagonists.
continue
antag_slots_left-- //Slot is occupied.
if(antag_slots_left <= 0) //No point in checking anymore.
break
amount = min(amount,antag_slots_left)

return min(amount, maximum_antags)

/datum/round_event/antagonist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

base_antags = 2
maximum_antags = 3
maximum_antags_global = 3

tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_CREW_ANTAG)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
antag_datum = /datum/antagonist/changeling
weight = 8
min_players = 20
maximum_antags_global = 4

tags = list(TAG_COMBAT, TAG_CREW_ANTAG)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
weight = 8
min_players = 30

base_antags = 2
maximum_antags = 3
base_antags = 1
maximum_antags = 2
maximum_antags_global = 2

tags = list(TAG_COMBAT, TAG_SPOOKY, TAG_CREW_ANTAG)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

base_antags = 1
maximum_antags = 1
maximum_antags_global = 1

min_players = 20

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

base_antags = 2
maximum_antags = 5
maximum_antags_global = 5

typepath = /datum/round_event/antagonist/team/nukie

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
antag_flag = ROLE_SPY
antag_datum = /datum/antagonist/spy
weight = 8
maximum_antags_global = 4

tags = list(TAG_CREW_ANTAG)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
antag_flag = ROLE_TRAITOR
antag_datum = /datum/antagonist/traitor
weight = 8
maximum_antags_global = 6

tags = list(TAG_CREW_ANTAG)

Expand Down

0 comments on commit 3c45262

Please sign in to comment.