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

Make existing math comparative operators single string #77808

Merged
  •  
  •  
  •  
36 changes: 18 additions & 18 deletions data/json/effects_on_condition/addictions_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
{
"type": "effect_on_condition",
"id": "EOC_CAFFEINE_ADDICTION",
"condition": { "math": [ "rand(2000)", "<=", "addiction_rational(2000, 20, u_addiction_intensity('caffeine'))" ] },
"condition": { "math": [ "rand(2000) <= addiction_rational(2000, 20, u_addiction_intensity('caffeine'))" ] },
"effect": [
{ "u_message": "You want some caffeine.", "type": "warning" },
{ "u_add_morale": "morale_craving_caffeine", "bonus": -5, "max_bonus": -30 },
{
"if": {
"and": [
{ "math": [ "u_val('stim')", ">", "u_addiction_intensity('caffeine') * -10" ] },
{ "math": [ "rand(10)", "<", "u_addiction_intensity('caffeine')" ] }
{ "math": [ "u_val('stim') > u_addiction_intensity('caffeine') * -10" ] },
{ "math": [ "rand(10) < u_addiction_intensity('caffeine')" ] }
]
},
"then": { "math": [ "u_val('stim')", "--" ] }
},
{
"if": {
"and": [
{ "math": [ "u_addiction_intensity('caffeine')", ">=", "8" ] },
{ "math": [ "rand(392)", "<", "u_addiction_intensity('caffeine')" ] }
{ "math": [ "u_addiction_intensity('caffeine') >= 8" ] },
{ "math": [ "rand(392) < u_addiction_intensity('caffeine')" ] }
]
},
"then": [
Expand All @@ -41,37 +41,37 @@
"type": "effect_on_condition",
"id": "EOC_SLEEP_ADDICTION",
"//": "Actual effects processed in player::can_sleep(). Here, only prolong this addiction longer than usual.",
"condition": { "and": [ { "one_in_chance": 2 }, { "math": [ "u_addiction_turns('sleeping pill')", "<", "0" ] } ] },
"condition": { "and": [ { "one_in_chance": 2 }, { "math": [ "u_addiction_turns('sleeping pill') < 0" ] } ] },
"effect": { "math": [ "u_addiction_turns('sleeping pill')", "++" ] }
},
{
"type": "effect_on_condition",
"id": "EOC_MARLOSS_R_ADDICTION",
"condition": { "math": [ "rand(800)", "<=", "addiction_rational(800, 20, u_addiction_intensity('marloss_r'))" ] },
"condition": { "math": [ "rand(800) <= addiction_rational(800, 20, u_addiction_intensity('marloss_r'))" ] },
"effect": [
{ "u_add_morale": "morale_craving_marloss", "bonus": -5, "max_bonus": -30 },
{ "u_message": "You daydream about luscious pink berries as big as your fist.", "type": "info" },
{ "if": { "math": [ "u_val('focus')", ">", "40" ] }, "then": { "math": [ "u_val('focus')", "--" ] } }
{ "if": { "math": [ "u_val('focus') > 40" ] }, "then": { "math": [ "u_val('focus')", "--" ] } }
]
},
{
"type": "effect_on_condition",
"id": "EOC_MARLOSS_B_ADDICTION",
"condition": { "math": [ "rand(800)", "<=", "addiction_rational(800, 20, u_addiction_intensity('marloss_b'))" ] },
"condition": { "math": [ "rand(800) <= addiction_rational(800, 20, u_addiction_intensity('marloss_b'))" ] },
"effect": [
{ "u_add_morale": "morale_craving_marloss", "bonus": -5, "max_bonus": -30 },
{ "u_message": "You daydream about nutty cyan seeds as big as your hand.", "type": "info" },
{ "if": { "math": [ "u_val('focus')", ">", "40" ] }, "then": { "math": [ "u_val('focus')", "--" ] } }
{ "if": { "math": [ "u_val('focus') > 40" ] }, "then": { "math": [ "u_val('focus')", "--" ] } }
]
},
{
"type": "effect_on_condition",
"id": "EOC_MARLOSS_Y_ADDICTION",
"condition": { "math": [ "rand(800)", "<=", "addiction_rational(800, 20, u_addiction_intensity('marloss_y'))" ] },
"condition": { "math": [ "rand(800) <= addiction_rational(800, 20, u_addiction_intensity('marloss_y'))" ] },
"effect": [
{ "u_add_morale": "morale_craving_marloss", "bonus": -5, "max_bonus": -30 },
{ "u_message": "You daydream about succulent, pale golden gel, sweet but light.", "type": "info" },
{ "if": { "math": [ "u_val('focus')", ">", "40" ] }, "then": { "math": [ "u_val('focus')", "--" ] } }
{ "if": { "math": [ "u_val('focus') > 40" ] }, "then": { "math": [ "u_val('focus')", "--" ] } }
]
},
{
Expand All @@ -80,10 +80,10 @@
"condition": { "u_has_trait": "MUT_JUNKIE" },
"effect": [
{
"if": { "math": [ "rand(600)", "<=", "addiction_rational(600, 50, u_addiction_intensity('mutagen'))" ] },
"if": { "math": [ "rand(600) <= addiction_rational(600, 50, u_addiction_intensity('mutagen'))" ] },
"then": [
{
"if": { "math": [ "rand(6)", "<", "u_addiction_intensity('mutagen')" ] },
"if": { "math": [ "rand(6) < u_addiction_intensity('mutagen')" ] },
"then": { "u_message": "You so miss the exquisite rainbow of post-humanity.", "type": "warning" },
"else": { "u_message": "Your body is SOO booorrrring. Just a little sip to liven things up?", "type": "warning" }
},
Expand All @@ -93,8 +93,8 @@
{
"if": {
"and": [
{ "math": [ "u_val('focus')", ">", "40" ] },
{ "math": [ "rand(800)", "<=", "addiction_rational(800, 20, u_addiction_intensity('mutagen'))" ] }
{ "math": [ "u_val('focus') > 40" ] },
{ "math": [ "rand(800) <= addiction_rational(800, 20, u_addiction_intensity('mutagen'))" ] }
]
},
"then": [
Expand All @@ -108,10 +108,10 @@
],
"false_effect": [
{
"if": { "math": [ "rand(500)", "<=", "addiction_rational(500, 15, u_addiction_intensity('mutagen'))" ] },
"if": { "math": [ "rand(500) <= addiction_rational(500, 15, u_addiction_intensity('mutagen'))" ] },
"then": [
{
"if": { "math": [ "rand(6)", "<", "u_addiction_intensity('mutagen')" ] },
"if": { "math": [ "rand(6) < u_addiction_intensity('mutagen')" ] },
"then": { "u_message": "You haven't had any mutagen lately.", "type": "warning" },
"else": { "u_message": "You could use some new parts…", "type": "warning" }
},
Expand Down
6 changes: 3 additions & 3 deletions data/json/effects_on_condition/bionic_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "effect_on_condition",
"id": "bio_drain",
"recurrence": [ "30 minutes", "1 hours 30 minutes" ],
"condition": { "and": [ { "u_has_bionics": "bio_drain" }, { "math": [ "u_val('power')", ">=", "energy('25 kJ')" ] } ] },
"condition": { "and": [ { "u_has_bionics": "bio_drain" }, { "math": [ "u_val('power') >= energy('25 kJ')" ] } ] },
"deactivate_condition": { "not": { "u_has_bionics": "bio_drain" } },
"effect": [
{ "u_message": "Your batteries discharge slightly.", "type": "bad" },
Expand Down Expand Up @@ -51,7 +51,7 @@
"type": "effect_on_condition",
"id": "bio_shakes",
"recurrence": [ "1 hours", "3 hours" ],
"condition": { "and": [ { "u_has_bionics": "bio_shakes" }, { "math": [ "u_val('power')", ">=", "energy('25 kJ')" ] } ] },
"condition": { "and": [ { "u_has_bionics": "bio_shakes" }, { "math": [ "u_val('power') >= energy('25 kJ')" ] } ] },
"deactivate_condition": { "not": { "u_has_bionics": "bio_shakes" } },
"effect": [
{ "u_message": "Your bionics short-circuit, causing you to tremble and shiver.", "type": "bad" },
Expand All @@ -68,7 +68,7 @@
"and": [
{ "u_has_bionics": "bio_glowy" },
{ "not": { "u_has_effect": "glowy_led" } },
{ "math": [ "u_val('power')", ">=", "energy('1 kJ')" ] }
{ "math": [ "u_val('power') >= energy('1 kJ')" ] }
]
},
"deactivate_condition": { "not": { "u_has_bionics": "bio_glowy" } },
Expand Down
4 changes: 2 additions & 2 deletions data/json/effects_on_condition/computer_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
{
"type": "effect_on_condition",
"id": "EOC_READ_LOCAL_FILES",
"condition": { "and": [ { "math": [ "u_skill('computer')", ">=", "2" ] }, { "one_in_chance": 2 } ] },
"condition": { "and": [ { "math": [ "u_skill('computer') >= 2" ] }, { "one_in_chance": 2 } ] },
"effect": [ { "u_message": "local_files_simple", "snippet": true, "same_snippet": true, "popup": true } ],
"false_effect": {
"run_eocs": [
{
"id": "EOC_READ_LOCAL_FILES_MESSAGE",
"condition": { "math": [ "u_skill('computer')", ">=", "2" ] },
"condition": { "math": [ "u_skill('computer') >= 2" ] },
"effect": { "u_message": "You found nothing interesting" },
"false_effect": { "u_message": "You understanding of computer devices is not good enough to find anything.", "type": "bad" }
}
Expand Down
4 changes: 2 additions & 2 deletions data/json/effects_on_condition/dream_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"id": "EOC_GIVE_NIGHTMARES",
"eoc_type": "EVENT",
"required_event": "character_wakes_up",
"condition": { "and": [ { "u_has_effect": "nightmares" }, { "math": [ "dream_counter", "==", "0" ] } ] },
"condition": { "and": [ { "u_has_effect": "nightmares" }, { "math": [ "dream_counter == 0" ] } ] },
"effect": [
{ "u_message": "nightmares", "snippet": true, "type": "bad" },
{ "u_add_morale": "morale_nightmare", "bonus": [ -15, -30 ], "max_bonus": -30 },
Expand All @@ -33,7 +33,7 @@
{ "not": { "u_has_effect": "flu" } }
]
},
{ "math": [ "dream_counter", "==", "0" ] }
{ "math": [ "dream_counter == 0" ] }
]
},
"effect": [
Expand Down
4 changes: 2 additions & 2 deletions data/json/effects_on_condition/effects_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"type": "effect_on_condition",
"id": "EOC_DERMATIK_BIRTH_INIT",
"recurrence": [ "3 minutes", "10 minutes" ],
"condition": { "and": [ { "math": [ "u_vitamin('dermatik_larva_size')", ">=", "1440" ] }, { "x_in_y_chance": { "x": 1, "y": 3 } } ] },
"condition": { "and": [ { "math": [ "u_vitamin('dermatik_larva_size') >= 1440" ] }, { "x_in_y_chance": { "x": 1, "y": 3 } } ] },
"effect": { "u_lose_effect": "dermatik" }
},
{
Expand All @@ -101,7 +101,7 @@
"condition": { "compare_string": [ "dermatik", { "context_val": "effect" } ] },
"effect": [
{
"if": { "math": [ "u_vitamin('dermatik_larva_size')", ">=", "1440" ] },
"if": { "math": [ "u_vitamin('dermatik_larva_size') >= 1440" ] },
"then": [
{ "if": { "u_has_effect": "sleep" }, "then": { "u_lose_effect": "sleep" } },
{ "math": [ "NUM_LARVA", "=", "u_val('size')" ] },
Expand Down
6 changes: 3 additions & 3 deletions data/json/effects_on_condition/example_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
{
"type": "effect_on_condition",
"id": "EOC_selector_test_4",
"condition": { "math": [ "1", "<", "0" ] },
"condition": { "math": [ "1 < 0" ] },
"effect": [ { "math": [ "key1", "=", "_val" ] } ]
},
{
Expand Down Expand Up @@ -311,7 +311,7 @@
{ "math": [ "_coverage", "=", "n_coverage(_id)" ] },
{ "math": [ "_encumbrance", "=", "n_encumbrance(_id)" ] },
{
"if": { "math": [ "_coverage", ">", "0" ] },
"if": { "math": [ "_coverage > 0" ] },
"then": [
{ "u_message": " <npc_name>" },
{ "u_message": " coverage:<context_val:coverage>" },
Expand Down Expand Up @@ -515,7 +515,7 @@
{
"type": "effect_on_condition",
"id": "EOC_print_item_charge",
"condition": { "math": [ "n_val('power_max')", ">", "0" ] },
"condition": { "math": [ "n_val('power_max') > 0" ] },
"effect": [
{ "math": [ "ITEM_POWER", "=", "n_val('power')" ] },
{ "math": [ "ITEM_POWER_MAX", "=", "n_val('power_max')" ] },
Expand Down
6 changes: 3 additions & 3 deletions data/json/effects_on_condition/generalized_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{ "one_in_chance": { "context_val": "chance" } },
{ "u_near_om_location": { "context_val": "omt" }, "range": 30 },
{ "math": [ "time_since('cataclysm', 'unit':'days') >= _days_till_spawn" ] },
{ "math": [ "time_since(u_timer_caravan_RandEnc)", ">=", "time('1 d')" ] },
{ "math": [ "time_since(u_timer_caravan_RandEnc) >= time('1 d')" ] },
{ "not": { "u_near_om_location": { "context_val": "omt" }, "range": 2 } },
{ "get_condition": "random_enc_condition" }
]
Expand All @@ -41,9 +41,9 @@
"global": true,
"condition": {
"and": [
{ "math": [ "time_since(u_timer_caravan_RandEnc)", ">", "time('1 h')" ] },
{ "math": [ "time_since(u_timer_caravan_RandEnc) > time('1 h')" ] },
{ "not": { "u_near_om_location": { "global_val": "random_encounter_omt" }, "range": 2 } },
{ "math": [ "RandEnc", "==", "1" ] }
{ "math": [ "RandEnc == 1" ] }
]
},
"effect": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
{
"type": "effect_on_condition",
"id": "slot_machine_win_payout",
"condition": { "math": [ "u_bet_amount", "==", "20" ] },
"condition": { "math": [ "u_bet_amount == 20" ] },
"effect": [
{ "u_spawn_item": "money_twenty", "count": { "global_val": "gamble_multiplier", "default": 1 } },
{ "math": [ "gamble_multiplier", "=", "0" ] },
Expand All @@ -132,7 +132,7 @@
"false_effect": {
"run_eocs": {
"id": "win_10",
"condition": { "math": [ "u_bet_amount", "==", "10" ] },
"condition": { "math": [ "u_bet_amount == 10" ] },
"effect": [
{ "u_spawn_item": "money_ten", "count": { "global_val": "gamble_multiplier", "default": 1 } },
{ "math": [ "gamble_multiplier", "=", "0" ] },
Expand All @@ -141,7 +141,7 @@
"false_effect": {
"run_eocs": {
"id": "win_5",
"condition": { "math": [ "u_bet_amount", "==", "5" ] },
"condition": { "math": [ "u_bet_amount == 5" ] },
"effect": [
{ "u_spawn_item": "money_five", "count": { "global_val": "gamble_multiplier", "default": 1 } },
{ "math": [ "gamble_multiplier", "=", "0" ] },
Expand All @@ -150,7 +150,7 @@
"false_effect": {
"run_eocs": {
"id": "win_1",
"condition": { "math": [ "u_bet_amount", "==", "1" ] },
"condition": { "math": [ "u_bet_amount == 1" ] },
"effect": [
{ "u_spawn_item": "money_one", "count": { "global_val": "gamble_multiplier", "default": 1 } },
{ "math": [ "gamble_multiplier", "=", "0" ] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"//plano": "used to handle the case, when lens don't have any correction power, and anyone can use it, specifically for transition_contacts_plano",
"condition": {
"and": [
{ "math": [ "u_has_flag(_flag1) + u_has_flag(_flag2) + u_has_flag(_flag3) + _plano", ">", "0" ] },
{ "math": [ "u_has_flag(_flag1) + u_has_flag(_flag2) + u_has_flag(_flag3) + _plano > 0" ] },
{ "expects_vars": [ "time", "effect" ] }
]
},
"effect": { "run_eocs": [ "EOC_CONTACTS1" ] },
"false_effect": [
{
"if": { "math": [ "u_has_flag('HYPEROPIC') + u_has_flag('MYOPIC') + u_has_flag('MYOPIC_IN_LIGHT')", ">", "0" ] },
"if": { "math": [ "u_has_flag('HYPEROPIC') + u_has_flag('MYOPIC') + u_has_flag('MYOPIC_IN_LIGHT') > 0" ] },
"then": { "u_message": "These lenses won't help you with your sight problems." },
"else": { "u_message": "You don't have any sight problems that require lenses." }
}
Expand Down
8 changes: 4 additions & 4 deletions data/json/effects_on_condition/misc_effect_on_condition.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
{
"type": "effect_on_condition",
"id": "EOC_last_amigara_death",
"condition": { "math": [ "u_monsters_nearby('mon_amigara_horror')", "<", "1" ] },
"condition": { "math": [ "u_monsters_nearby('mon_amigara_horror') < 1" ] },
"effect": [
{ "u_location_variable": { "context_val": "my_loc" }, "max_radius": 2, "passable_only": true },
{ "map_spawn_item": "amigara_drops", "use_item_group": true, "loc": { "context_val": "my_loc" } },
Expand Down Expand Up @@ -92,7 +92,7 @@
{
"run_eocs": {
"id": "EOC_HALLUCINATION_ATTACKS",
"condition": { "math": [ "u_monsters_nearby()", ">", "1" ] },
"condition": { "math": [ "u_monsters_nearby() > 1" ] },
"effect": [
{
"u_spawn_monster": "GROUP_YOUR_FEARS",
Expand All @@ -112,7 +112,7 @@
{
"type": "effect_on_condition",
"id": "EOC_discover_zomborg",
"condition": { "math": [ "u_monsters_nearby('mon_zomborg')", ">=", "1" ] },
"condition": { "math": [ "u_monsters_nearby('mon_zomborg') >= 1" ] },
"effect": [ { "u_add_var": "dialogue_exodii_seen_zomborg", "value": "yes" } ]
},
{
Expand Down Expand Up @@ -232,7 +232,7 @@
{ "not": { "u_has_trait": "COMPOUND_EYES" } },
{ "not": { "u_has_trait": "SEESLEEP" } },
{ "not": { "u_has_bionics": "armor_bio_eyes" } },
{ "math": [ "u_coverage('eyes')", "<", "rand(100)" ] },
{ "math": [ "u_coverage('eyes') < rand(100)" ] },
{ "x_in_y_chance": { "x": 2, "y": 3 } }
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id": "changing_initiate_check",
"//": "Give player the CHANGING trait when they have enough basic mutagen in their blood.",
"recurrence": [ "30 m", "45 m" ],
"condition": { "and": [ { "math": [ "u_vitamin('mutagen')", ">=", "450" ] }, { "not": { "u_has_flag": "CHANGING" } } ] },
"condition": { "and": [ { "math": [ "u_vitamin('mutagen') >= 450" ] }, { "not": { "u_has_flag": "CHANGING" } } ] },
"deactivate_condition": { "u_has_flag": "CHANGING" },
"effect": [
{
Expand Down Expand Up @@ -46,7 +46,7 @@
{
"id": "changing_mutate2",
"//": "Mutate!",
"condition": { "math": [ "u_vitamin('mutagen')", ">=", "300" ] },
"condition": { "math": [ "u_vitamin('mutagen') >= 300" ] },
"effect": [
{ "u_message": "You feel a deep, churning sensation fill your body.", "type": "mixed" },
{ "u_mutate": 0 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"condition": {
"and": [
{ "expects_vars": [ "prep_time", "spell_to_cast", "message_success", "message_fail" ] },
{ "math": [ "u_val('stamina')", ">", "_energy_amount" ] }
{ "math": [ "u_val('stamina') > _energy_amount" ] }
]
},
"effect": [
Expand Down
Loading
Loading