forked from Rotwood-Vale/Ratwood-Keep
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from Stutternov/Statpack
Statpack Port
- Loading branch information
Showing
31 changed files
with
248 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
GLOBAL_LIST_EMPTY(statpacks) | ||
|
||
/datum/statpack | ||
/// Name of the statpack | ||
var/name | ||
/// Flavor description of the statpack (don't include stat totals in this, we'll render them automatically) | ||
var/desc | ||
/// An associative list of only the stats we're altering. The value can also be a list to signify a range of values - maximum length of 2 for these. | ||
var/stat_array = list() | ||
|
||
/datum/statpack/proc/apply_to_human(mob/living/carbon/human/recipient) | ||
if (recipient && recipient.mind) | ||
for (var/stat in stat_array) | ||
if (!islist(stat_array[stat])) | ||
var/value = stat_array[stat] | ||
recipient.change_stat(stat, value) | ||
else | ||
var/list/stat_range = stat_array[stat] | ||
recipient.change_stat(stat, rand(stat_range[1], stat_range[2])) | ||
return TRUE | ||
return FALSE | ||
|
||
/datum/statpack/proc/description_string() | ||
return "[desc]<br> <i>[generate_modifier_string()]</i>" | ||
|
||
/datum/statpack/proc/generate_modifier_string() | ||
/// Generates a blurb string for use in preferences, programatically, based on our desc and stat alterations. | ||
var/result | ||
var/list/concat = list() | ||
for (var/stat in stat_array) | ||
if (!islist(stat_array[stat])) | ||
var/value = stat_array[stat] | ||
var/modifier = "" | ||
|
||
if (value >= 1) | ||
modifier = "+" | ||
|
||
var/statlabel = uppertext(copytext(stat, 1, 4)) | ||
var/blockstring = "[modifier][value] [statlabel]" | ||
concat += blockstring | ||
else | ||
var/list/stat_range = stat_array[stat] | ||
var/list/chunk_string = list() | ||
for (var/sub_range in stat_range) | ||
var/modifier = "" | ||
if (sub_range >= 1) | ||
modifier = "+" | ||
|
||
chunk_string += "<b>[modifier][sub_range]</b>" | ||
|
||
var/statlabel = uppertext(copytext(stat, 1, 4)) | ||
concat += "[chunk_string.Join(" to ")] [statlabel]" | ||
|
||
result = "([concat.Join(", ")])" | ||
return result |
Oops, something went wrong.