Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mal's branch radiation mutation event #74612

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,53 @@
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_RADIATION_MUTATION",
"eoc_type": "EVENT",
"required_event": "character_radioactively_mutates",
"condition": { "or": [ { "u_is_character": true }, { "u_is_npc": true } ] },
Maleclypse marked this conversation as resolved.
Show resolved Hide resolved
"effect": [
{
"set_string_var": "<radiation_category>",
"target_var": { "context_val": "radiation_mutation_category" },
"parse_tags": true
},
{ "u_mutate_category": { "context_val": "radiation_mutation_category" }, "use_vitamins": false }
]
},
{
"type": "snippet",
"category": "<radiation_category>",
"text": [
{ "text": "CHIMERA" },
{ "text": "INSECT" },
{ "text": "ALPHA" },
{ "text": "URSINE" },
{ "text": "CHIROPTERAN" },
{ "text": "BIRD" },
{ "text": "MEDICAL" },
{ "text": "LUPINE" },
{ "text": "RAT" },
{ "text": "SLIME" },
{ "text": "PLANT" },
{ "text": "BATRACHIAN" },
{ "text": "RAPTOR" },
{ "text": "MOUSE" },
{ "text": "CEPHALOPOD" },
{ "text": "ELFA" },
{ "text": "FISH" },
{ "text": "HUMAN" },
{ "text": "RABBIT" },
{ "text": "GASTROPOD" },
{ "text": "BEAST" },
{ "text": "FELINE" },
{ "text": "CATTLE" },
{ "text": "LIZARD" },
{ "text": "TROGLOBITE" },
{ "text": "CRUSTACEAN" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_ink_grand_spray",
Expand Down
1 change: 1 addition & 0 deletions doc/EFFECT_ON_CONDITION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,7 @@ Every event EOC passes context vars with each of their key value pairs that the
| character_loses_effect | | { "character", `character_id` },<br/> { "effect", `efftype_id` },<br/> { "bodypart", `bodypart_id` } | character / NONE |
| character_melee_attacks_character | | { "attacker", `character_id` },<br/> { "weapon", `itype_id` },<br/> { "hits", `bool` },<br/> { "victim", `character_id` },<br/> { "victim_name", `string` }, | character (attacker) / character (victim) |
| character_melee_attacks_monster | | { "attacker", `character_id` },<br/> { "weapon", `itype_id` },<br/> { "hits", `bool` },<br/> { "victim_type", `mtype_id` },| character / monster |
| character_radioactively_mutates | triggered when a character mutates due to being irradiated | { "character", `character_id` }, | character / NONE |
| character_ranged_attacks_character | | { "attacker", `character_id` },<br/> { "weapon", `itype_id` },<br/> { "victim", `character_id` },<br/> { "victim_name", `string` }, | character (attacker) / character (victim) |
| character_ranged_attacks_monster | | { "attacker", `character_id` },<br/> { "weapon", `itype_id` },<br/> { "victim_type", `mtype_id` }, | character / monster |
| character_smashes_tile | | { "character", `character_id` },<br/> { "terrain", `ter_str_id` }, { "furniture", `furn_str_id` }, | character / NONE |
Expand Down
3 changes: 2 additions & 1 deletion src/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ std::string enum_to_string<event_type>( event_type data )
return "character_melee_attacks_character";
case event_type::character_melee_attacks_monster:
return "character_melee_attacks_monster";
case event_type::character_radioactively_mutates: return "character_radioactively_mutates";
case event_type::character_ranged_attacks_character:
return "character_ranged_attacks_character";
case event_type::character_ranged_attacks_monster:
Expand Down Expand Up @@ -141,7 +142,7 @@ DEFINE_EVENT_HELPER_FIELDS( event_spec_empty )
DEFINE_EVENT_HELPER_FIELDS( event_spec_character )
DEFINE_EVENT_HELPER_FIELDS( event_spec_character_item )

static_assert( static_cast<int>( event_type::num_event_types ) == 102,
static_assert( static_cast<int>( event_type::num_event_types ) == 103,
Maleclypse marked this conversation as resolved.
Show resolved Hide resolved
"This static_assert is a reminder to add a definition below when you add a new "
"event_type. If your event_spec specialization inherits from another struct for "
"its fields definition then you probably don't need a definition here." );
Expand Down
6 changes: 5 additions & 1 deletion src/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
character_loses_effect,
character_melee_attacks_character,
character_melee_attacks_monster,
character_radioactively_mutates,
character_ranged_attacks_character,
character_ranged_attacks_monster,
character_smashes_tile,
Expand Down Expand Up @@ -186,8 +187,8 @@
};
};

static_assert( static_cast<int>( event_type::num_event_types ) == 102,
static_assert( static_cast<int>( event_type::num_event_types ) == 103,
Maleclypse marked this conversation as resolved.
Show resolved Hide resolved
"This static_assert is to remind you to add a specialization for your new "

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (src)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (src)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (src)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (src)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (src)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (src)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (src)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (src)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (src)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (src)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (other)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (other)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (other)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (other)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (other)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (other)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (other)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (other)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (other)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / build (other)

static assertion failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103': This static_assert is to remind you to add a specialization for your new event_type below [clang-diagnostic-error]

Check failure on line 191 in src/event.h

View workflow job for this annotation

GitHub Actions / Basic Build and Test (Clang 10, Ubuntu, Curses)

static_assert failed due to requirement 'static_cast<int>(event_type::num_event_types) == 103' "This static_assert is to remind you to add a specialization for your new event_type below"
"event_type below" );

template<>
Expand Down Expand Up @@ -406,6 +407,9 @@
};
};

template<>
struct event_spec<event_type::character_radioactively_mutates> : event_spec_character {};

template<>
struct event_spec<event_type::character_ranged_attacks_character> {
static constexpr std::array<std::pair<const char *, cata_variant_type>, 4> fields = {{
Expand Down
1 change: 1 addition & 0 deletions src/memorial_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,7 @@ void memorial_logger::notify( const cata::event &e )
case event_type::character_wakes_up:
case event_type::character_attempt_to_fall_asleep:
case event_type::character_falls_asleep:
case event_type::character_radioactively_mutates:
case event_type::character_wears_item:
case event_type::character_wields_item:
case event_type::character_casts_spell:
Expand Down
2 changes: 1 addition & 1 deletion src/suffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ void suffer::from_radiation( Character &you )
// 1000 rads = 900 / 10000 = 9 / 100 = 10% !!!
// 2000 rads = 2000 / 10000 = 1 / 5 = 20% !!!
if( get_option<bool>( "RAD_MUTATION" ) && rng( 100, 10000 ) < you.get_rad() ) {
you.mutate();
get_event_bus().send<event_type::character_radioactively_mutates>( you.getID() );
}
if( you.get_rad() > 50 && rng( 1, 3000 ) < you.get_rad() &&
( you.stomach.contains() > 0_ml || radiation_increasing || !you.in_sleep_state() ) ) {
Expand Down
Loading