Skip to content

Commit

Permalink
Merge pull request CleverRaven#77691 from John-Candlebury/afs-riemann…
Browse files Browse the repository at this point in the history
…-shields

Riemann Shields
  • Loading branch information
Night-Pryanik authored Nov 14, 2024
2 parents 47c46e9 + 20827aa commit 2445365
Show file tree
Hide file tree
Showing 6 changed files with 637 additions and 2 deletions.
5 changes: 5 additions & 0 deletions data/mods/Aftershock/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"type": "json_flag",
"info": "You are immune to telepathy."
},
{
"id": "SHIELD_GENERATOR",
"type": "json_flag",
"info": "This item is capable of projecting a Riemann protective shield."
},
{
"id": "HIVE_MIND",
"type": "monster_flag",
Expand Down
3 changes: 2 additions & 1 deletion data/mods/Aftershock/itemgroups/clothing/armor_sets.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"distribution": [ { "item": "tac_fullhelmet_uicas", "prob": 20 }, { "item": "tac_helmet_uicas", "prob": 1 } ],
"prob": 40
},
{ "item": "afs_military_cloak", "prob": 40 }
{ "item": "afs_military_cloak", "prob": 40 },
{ "item": "afs_backpack_shieldgen", "prob": 1 }
]
},
{
Expand Down
283 changes: 283 additions & 0 deletions data/mods/Aftershock/items/armor/energy_shield.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
[
{
"id": "afs_energy_shield",
"type": "TOOL_ARMOR",
"name": { "str": "Riemann shell" },
"description": "A thin shell of altered reality containing enormous electromagnetic potential, such that it might behave as a solid object under certain conditions. A Riemann shell can defend against a wide variety of physical and energy attacks, but can be overwhelmed and forced to collapse into deadly radiation with prolonged assault.",
"weight": "1 g",
"volume": "1 ml",
"symbol": "o",
"color": "blue",
"material": [ "riemann_space" ],
"environmental_protection": 20,
"material_thickness": 5.0,
"max_energy_shield_hp": 1200,
"flags": [
"AURA",
"ENERGY_SHIELD",
"OVERSIZE",
"ONLY_ONE",
"TRADER_AVOID",
"NO_TAKEOFF",
"NONCONDUCTIVE",
"SPAWN_ACTIVE",
"ALLOWS_NATURAL_ATTACKS",
"SEMITANGIBLE",
"UNRESTRICTED"
],
"tick_action": {
"type": "effect_on_conditions",
"effect_on_conditions": [ { "id": "_afs_energy_shield", "effect": { "run_eocs": "EOC_afs_do_shield" } } ]
},
"armor": [
{
"encumbrance": 0,
"coverage": 100,
"covers": [ "leg_l", "leg_r", "torso", "arm_l", "arm_r", "hand_l", "hand_r", "head", "foot_l", "foot_r", "mouth", "eyes" ]
}
]
},
{
"id": "afs_backpack_shieldgen",
"type": "TOOL_ARMOR",
"name": { "str": "SHD-1k Riemann Shield Generator" },
"description": "A backpack mounted shield generator for infantry use, capable of fully protecting its user during prolonged bursts of kinetic and energy attacks. Standard issue for UICA breaching teams.\n\nIts high energy consumption and weight make it unsuitable for long-term use. Powered with energy cartridges.",
"weight": "10 kg",
"volume": "18000 ml",
"price": "120 kUSD",
"price_postapoc": "120 kUSD",
"ammo": [ "battery" ],
"material": [ "nylon", "aluminum" ],
"symbol": "[",
"looks_like": "backpack",
"color": "brown",
"warmth": 10,
"charges_per_use": 400,
"material_thickness": 2,
"pocket_data": [
{
"pocket_type": "MAGAZINE_WELL",
"max_contains_volume": "20 L",
"max_contains_weight": "20 kg",
"magazine_well": "75 ml",
"item_restriction": [ "afs_cartridge", "afs_bootleg_cartridge", "afs_archeotech_cartridge" ]
}
],
"flags": [ "BELTED", "WATERPROOF", "ONLY_ONE" ],
"use_action": {
"type": "effect_on_conditions",
"ammo_scale": 1,
"menu_text": "Activate",
"effect_on_conditions": [
{
"id": "afs_backpack_shieldgen_activate",
"effect": {
"run_eocs": "EOC_start_shield",
"variables": {
"transform_target": "afs_backpack_shieldgen_on",
"shield_max_hp": "600",
"shield_regen": "1",
"shield_regen_rate": "1",
"bionic": "0",
"turn_cost": "1",
"success_message": "a",
"failure_message": "b"
}
}
}
]
},
"armor": [
{
"encumbrance": [ 3, 12 ],
"volume_encumber_modifier": 0,
"coverage": 100,
"covers": [ "torso" ],
"specifically_covers": [ "torso_hanging_back", "torso_waist" ]
}
]
},
{
"id": "afs_backpack_shieldgen_on",
"type": "TOOL_ARMOR",
"name": { "str": "SHD-1k Riemann Shield Generator (active)", "str_pl": "SHD-1k Riemann Shield Generators (active)" },
"copy-from": "afs_backpack_shieldgen",
"description": "A backpack mounted shield generator for infantry use, capable of fully protecting its user during prolonged bursts of kinetic and energy attacks. Standard issue for UICA breaching teams.\n\nIts high energy consumption and weight make it unsuitable for long-term use. Powered with energy cartridges.",
"power_draw": "100000 mW",
"revert_to": "afs_backpack_shieldgen",
"extend": { "flags": [ "SHIELD_GENERATOR" ] },
"use_action": {
"type": "effect_on_conditions",
"ammo_scale": 0,
"menu_text": "Deactivate",
"effect_on_conditions": [
{
"id": "afs_backpack_shieldgen_deactivate",
"effect": { "run_eocs": "EOC_stop_shield", "variables": { "transform_target": "afs_backpack_shieldgen" } }
}
]
},
"tick_action": {
"type": "effect_on_conditions",
"effect_on_conditions": [
{
"id": "afs_backpack_shieldgen_tick",
"condition": "has_alpha",
"effect": { "math": [ "u_shield_power_ratio", "=", "n_val('power_percentage')" ] },
"false_effect": { "transform_item": "afs_backpack_shieldgen" }
}
]
}
},
{
"id": "spawn_shield",
"type": "SPELL",
"name": "Spawn Riemann Shield",
"description": "Creates a shield.",
"valid_targets": [ "self" ],
"flags": [ "VERBAL", "NO_FAIL", "CONCENTRATE", "SOMATIC", "PERMANENT_ALL_LEVELS", "NO_EXPLOSION_SFX" ],
"min_range": 0,
"max_range": 0,
"min_damage": 1,
"max_damage": 1,
"effect": "spawn_item",
"effect_str": "afs_energy_shield",
"shape": "blast",
"max_level": 1
},
{
"id": "EOC_start_shield",
"type": "effect_on_condition",
"effect": [
{
"if": "has_ammo",
"then": [
{ "turn_cost": { "context_val": "turn_cost" } },
{ "u_cast_spell": { "id": "spawn_shield", "hit_self": true } },
{ "u_message": { "context_val": "success_message" } },
{ "transform_item": { "context_val": "transform_target" }, "active": true },
{ "math": [ "_shield_uid", "=", "rand(1200)" ] },
{ "math": [ "n_shield_gen_uid", "=", "_shield_uid" ] },
{
"if": { "math": [ "_is_bionic" ] },
"then": [ { "math": [ "u_shield_power_ratio", "=", "u_val('power_percentage')" ] } ],
"else": [ { "math": [ "u_shield_power_ratio", "=", "n_val('power_percentage')" ] } ]
},
{
"u_run_inv_eocs": "all",
"search_data": [ { "id": [ "afs_energy_shield" ] } ],
"true_eocs": [
{
"id": "_SHIELD_SETUP",
"effect": [
{ "math": [ "n_shield_uid", "=", "_shield_uid" ] },
{ "math": [ "n_shield_turn", "=", "0" ] },
{ "math": [ "n_SHIELD_REGEN", "=", "0" ] },
{ "math": [ "n_SHIELD_REGEN_RATE", "=", "0" ] },
{ "math": [ "n_ENERGY_SHIELD_HP", "=", "_shield_max_hp*0.1" ] },
{ "math": [ "n_ENERGY_SHIELD_MAX_HP", "=", "_shield_max_hp" ] },
{ "math": [ "n_SHIELD_REGEN", "=", "_shield_regen" ] },
{ "math": [ "n_SHIELD_REGEN_RATE", "=", "shield_regen_rate" ] },
{ "math": [ "u_shield_ratio", "=", "n_ENERGY_SHIELD_HP/n_ENERGY_SHIELD_MAX_HP" ] }
]
}
]
}
],
"else": { "u_message": { "context_val": "failure_message" } }
}
]
},
{
"id": "EOC_afs_do_shield",
"type": "effect_on_condition",
"effect": [
{ "math": [ "u_proceed_shield", "=", "0" ] },
{ "math": [ "_shield_uid", "=", "n_shield_uid" ] },
{ "math": [ "u_shield_ratio", "=", "n_ENERGY_SHIELD_HP/n_ENERGY_SHIELD_MAX_HP*100" ] },
{
"//": "We check if the shield generator that made this shield is still active.",
"u_run_inv_eocs": "all",
"search_data": [ { "worn_only": true, "flags": [ "SHIELD_GENERATOR" ] } ],
"true_eocs": [
{
"id": "_afs_actually_do_shield",
"condition": { "math": [ "_shield_uid", "==", "n_shield_gen_uid" ] },
"effect": [ { "math": [ "u_proceed_shield", "=", "1" ] } ]
}
]
},
{
"if": { "math": [ "u_proceed_shield", "==", "1" ] },
"then": [
{ "math": [ "n_shield_turn", "++" ] },
{
"if": {
"and": [ { "math": [ "n_SHIELD_REGEN", "!=", "0" ] }, { "math": [ "n_shield_turn/n_SHIELD_REGEN_RATE", ">", "1" ] } ]
},
"then": [
{ "math": [ "n_shield_turn", "=", "0" ] },
{ "math": [ "n_ENERGY_SHIELD_HP", "+=", "n_SHIELD_REGEN" ] },
{
"math": [
"n_ENERGY_SHIELD_HP",
"=",
"n_ENERGY_SHIELD_HP > n_ENERGY_SHIELD_MAX_HP ? n_ENERGY_SHIELD_MAX_HP : n_ENERGY_SHIELD_HP"
]
}
]
}
],
"else": [ { "u_remove_item_with": "afs_energy_shield" }, { "math": [ "u_shield_ratio", "=", "-1" ] } ]
}
]
},
{
"id": "EOC_stop_shield",
"type": "effect_on_condition",
"effect": [
{ "transform_item": { "context_val": "transform_target" } },
{ "u_remove_item_with": "afs_energy_shield" },
{ "math": [ "u_shield_ratio", "=", "-1" ] }
]
},
{
"//": "This bit is only here to do a final update of the UI when a generator is dropped.",
"id": "EOC_check_drop_shield_gen",
"type": "effect_on_condition",
"eoc_type": "EVENT",
"required_event": "character_finished_activity",
"condition": {
"and": [
{ "compare_string": [ "ACT_DROP", { "context_val": "activity" } ] },
{ "math": [ "u_shield_power_ratio", ">=", "0" ] }
]
},
"effect": [
{ "math": [ "u_shield_power_ratio", "=", "-1" ] },
{
"//": "We check if we have another shield generator to update the UI power gauge.",
"u_run_inv_eocs": "all",
"search_data": [ { "worn_only": true, "flags": [ "SHIELD_GENERATOR" ] } ],
"true_eocs": [
{
"id": "_afs_drop_update_power",
"effect": [ { "math": [ "u_shield_power_ratio", "=", "n_val('power_percentage')" ] } ]
}
]
}
]
},
{
"id": "EOC_detonate_shield",
"type": "effect_on_condition",
"eoc_type": "EVENT",
"required_event": "character_armor_destroyed",
"condition": { "and": [ { "compare_string": [ "afs_energy_shield", { "context_val": "itype" } ] } ] },
"effect": [
{ "math": [ "u_shield_ratio", "=", "-1" ] },
{ "u_emit": "heavy_rad_glimmer", "chance_mult": 2 },
{ "u_message": "The shield blasts you with radiation as it dissipates.", "type": "bad" }
]
}
]
17 changes: 17 additions & 0 deletions data/mods/Aftershock/items/materials.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@
"resist": { "bash": 4, "cut": 6, "acid": 6, "heat": 2, "afs_plasma": 2, "bullet": 8, "electric": 0 },
"repair_difficulty": 9
},
{
"type": "material",
"id": "riemann_space",
"name": "Riemann space",
"density": 1,
"specific_heat_liquid": 0.52,
"specific_heat_solid": 0.52,
"latent_heat": 5200,
"chip_resist": 100,
"breathability": "SECOND_SKIN",
"dmg_adj": [ "resonating", "cascading", "unraveling", "fractal" ],
"bash_dmg_verb": "agitated",
"cut_dmg_verb": "agitated",
"soft": true,
"//": "Impenetrable to all damage types. The material energy shields are made of.",
"resist": { "bash": 1000, "cut": 1000, "acid": 1000, "heat": 1000, "bullet": 1000, "afs_plasma": 1000, "electric": 1000 }
},
{
"type": "material",
"id": "clearcrete",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@
"subtype": "distribution",
"ammo": 100,
"magazine": 100,
"items": [ { "group": "afs_armor_military_infantry_g", "prob": 90 }, { "item": "afs_backpack_rockets", "prob": 10 } ]
"items": [
{ "group": "afs_armor_military_infantry_g", "prob": 85 },
{ "item": "afs_backpack_rockets", "prob": 10 },
{ "item": "afs_backpack_shieldgen", "prob": 5 }
]
},
{
"type": "npc",
Expand Down
Loading

0 comments on commit 2445365

Please sign in to comment.