Skip to content

Commit

Permalink
[XEDRA Evolved] Add ARMOR_ALL enchantment and use it in two new Homul…
Browse files Browse the repository at this point in the history
…lus mutations (CleverRaven#72257)

* Add 'ALL' armor enchantment and make two new homullus mutations that use it

* Add missing definition to switch statement

* Add missing space in MAGIC.md

* Fix new enchantment to only affect armor calculations.

* Alphabetize armor enchants and exclude PURE damage from ARMOR_ALL

* Uncapitalize pure

* Clear out lints
  • Loading branch information
b3brodie authored Mar 9, 2024
1 parent 54f7cba commit 3601a6a
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,31 @@
"threshreq": [ "THRESH_HOMULLUS" ],
"category": [ "HOMULLUS" ]
},
{
"type": "mutation",
"id": "HOMULLUS_ARMOR_MULT_1",
"name": "Reinforced Armor",
"points": 4,
"visibility": 0,
"ugliness": 0,
"description": "Humans are flimsy creatures compared to even natural animals, yet by crafting armor they obtain durability that unthinking creatures will never reach. You draw on this legacy, increasing the strength of armor you wear by 20%",
"changes_to": "HOMULLUS_ARMOR_MULT_2",
"category": [ "HOMULLUS" ],
"enchantments": [ { "values": [ { "value": "ARMOR_ALL", "multiply": -0.2 } ] } ]
},
{
"type": "mutation",
"id": "HOMULLUS_ARMOR_MULT_2",
"name": "Fortified Armor",
"points": 8,
"visibility": 0,
"ugliness": 0,
"description": "You embody the tales of ancient knights, increasing the strength of armor you wear by 40%",
"prereqs": [ "HOMULLUS_ARMOR_MULT_1" ],
"threshreq": [ "THRESH_HOMULLUS" ],
"category": [ "HOMULLUS" ],
"enchantments": [ { "values": [ { "value": "ARMOR_ALL", "multiply": -0.4 } ] } ]
},
{
"type": "mutation",
"id": "HOMULLUS_GAIN_BIONIC_POWER",
Expand Down
2 changes: 2 additions & 0 deletions doc/MAGIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ The following is a list of possible enchantment `values`:
Character status value | Description
--- |---
`ARMOR_ACID` | Negative values give armor against the damage, positive values make you accept more damage of this type.
`ARMOR_ALL` |
`ARMOR_BASH` |
`ARMOR_BIO` |
`ARMOR_BULLET` |
Expand Down Expand Up @@ -923,6 +924,7 @@ A small subset of enchantments can be applied to monsters via effects. These are
Character status value | Description
--- |---
`ARMOR_ACID` | Negative values give armor against the damage, positive values make the monster accept more damage of this type.
`ARMOR_ALL` |
`ARMOR_BASH` |
`ARMOR_BIO` |
`ARMOR_BULLET` |
Expand Down
3 changes: 3 additions & 0 deletions src/character_armor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ static void armor_enchantment_adjust( Character &guy, damage_unit &du )
} else if( du.type == STATIC( damage_type_id( "bullet" ) ) ) {
du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_BULLET );
}
if( du.type != STATIC( damage_type_id( "pure" ) ) ) {
du.amount = guy.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ALL );
}
du.amount = std::max( 0.0f, du.amount );
}

Expand Down
3 changes: 3 additions & 0 deletions src/magic_enchantment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ namespace io
case enchant_vals::mod::STOMACH_SIZE_MULTIPLIER: return "STOMACH_SIZE_MULTIPLIER";
case enchant_vals::mod::LEARNING_FOCUS: return "LEARNING_FOCUS";
case enchant_vals::mod::RECOIL_MODIFIER: return "RECOIL_MODIFIER";
case enchant_vals::mod::ARMOR_ALL: return "ARMOR_ALL";
case enchant_vals::mod::ARMOR_ACID: return "ARMOR_ACID";
case enchant_vals::mod::ARMOR_BASH: return "ARMOR_BASH";
case enchant_vals::mod::ARMOR_BIO: return "ARMOR_BIO";
Expand Down Expand Up @@ -294,6 +295,7 @@ bool enchantment::is_monster_relevant() const
for( const std::pair<const enchant_vals::mod, dbl_or_var> &pair_values :
values_add ) {
if( pair_values.first == enchant_vals::mod::ARMOR_ACID ||
pair_values.first == enchant_vals::mod::ARMOR_ALL ||
pair_values.first == enchant_vals::mod::ARMOR_BASH ||
pair_values.first == enchant_vals::mod::ARMOR_BIO ||
pair_values.first == enchant_vals::mod::ARMOR_BULLET ||
Expand All @@ -312,6 +314,7 @@ bool enchantment::is_monster_relevant() const
for( const std::pair<const enchant_vals::mod, dbl_or_var> &pair_values :
values_multiply ) {
if( pair_values.first == enchant_vals::mod::ARMOR_ACID ||
pair_values.first == enchant_vals::mod::ARMOR_ALL ||
pair_values.first == enchant_vals::mod::ARMOR_BASH ||
pair_values.first == enchant_vals::mod::ARMOR_BIO ||
pair_values.first == enchant_vals::mod::ARMOR_BULLET ||
Expand Down
11 changes: 6 additions & 5 deletions src/magic_enchantment.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,16 @@ enum class mod : int {
MENDING_MODIFIER,
STOMACH_SIZE_MULTIPLIER,
LEARNING_FOCUS,
ARMOR_ACID,
ARMOR_ALL,
ARMOR_BASH,
ARMOR_CUT,
ARMOR_STAB,
ARMOR_BIO,
ARMOR_BULLET,
ARMOR_HEAT,
ARMOR_COLD,
ARMOR_CUT,
ARMOR_ELEC,
ARMOR_ACID,
ARMOR_BIO,
ARMOR_HEAT,
ARMOR_STAB,
EXTRA_BASH,
EXTRA_CUT,
EXTRA_STAB,
Expand Down
3 changes: 3 additions & 0 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ static void armor_enchantment_adjust( monster &mon, damage_unit &du )
} else if( du.type == STATIC( damage_type_id( "bullet" ) ) ) {
du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_BULLET );
}
if( du.type != STATIC( damage_type_id( "pure" ) ) ) {
du.amount = mon.calculate_by_enchantment( du.amount, enchant_vals::mod::ARMOR_ALL );
}
du.amount = std::max( 0.0f, du.amount );
}

Expand Down

0 comments on commit 3601a6a

Please sign in to comment.