Skip to content

Commit

Permalink
Aftershock: Shield bionics deploy Riemman shields (CleverRaven#78266)
Browse files Browse the repository at this point in the history
* Aftershock: Shield bionics deploy Riemman shields

* Apply suggestions from code review

Co-authored-by: Anton Burmistrov <[email protected]>

---------

Co-authored-by: Anton Burmistrov <[email protected]>
  • Loading branch information
John-Candlebury and Night-Pryanik authored Dec 9, 2024
1 parent 76a5045 commit 7b67e86
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 185 deletions.
17 changes: 8 additions & 9 deletions data/mods/Aftershock/itemgroups/bionics_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[ "afs_bio_linguistic_coprocessor", 10 ],
[ "afs_bio_dopamine_stimulators", 10 ],
[ "afs_bio_neurosoft_aeronautics", 5 ],
[ "bio_forcefield_bash_cut_weak", 25 ],
[ "bio_shield_weak", 25 ],
[ "afs_bio_translocator", 5 ],
[ "bio_shock_absorber", 2 ],
[ "afs_bio_skullgun", 5 ],
Expand All @@ -23,7 +23,7 @@
"id": "bionics_common",
"type": "item_group",
"copy-from": "bionics_common",
"extend": { "items": [ [ "bn_bio_solar", 10 ], [ "afs_bio_linguistic_coprocessor", 8 ], [ "bio_forcefield_bash_cut_weak", 25 ] ] }
"extend": { "items": [ [ "bn_bio_solar", 10 ], [ "afs_bio_linguistic_coprocessor", 8 ], [ "bio_shield_weak", 25 ] ] }
},
{
"id": "bionics_reaver",
Expand Down Expand Up @@ -73,9 +73,9 @@
[ "bio_jointservo", 10 ],
[ "bio_shotgun", 10 ],
[ "bio_recoil", 10 ],
[ "bio_forcefield_bash_cut_weak", 10 ],
[ "bio_shield_weak", 10 ],
[ "afs_bio_chemical_enhancement_rig", 10 ],
[ "bio_forcefield_ballistic_weak", 10 ],
[ "bio_shield_weak", 10 ],
[ "afs_bio_skullgun", 10 ]
]
},
Expand All @@ -90,10 +90,9 @@
[ "afs_bio_melee_optimization_unit", 10 ],
[ "afs_bio_monowhip", 10 ],
[ "afs_bio_blood_plus", 10 ],
[ "bio_forcefield_bash_cut_medium", 16 ],
[ "bio_forcefield_bash_cut_heavy", 3 ],
[ "bio_forcefield_ballistic_weak", 10 ],
[ "bio_forcefield_ballistic_medium", 10 ],
[ "bio_shield_heavy", 3 ],
[ "bio_shield_weak", 10 ],
[ "bio_shield_medium", 26 ],
[ "afs_bio_translocator", 5 ],
[ "afs_bio_blood_brain", 1 ],
[ "bio_shock_absorber", 2 ],
Expand Down Expand Up @@ -160,7 +159,7 @@
[ "afs_bio_melee_optimization_unit", 10 ],
[ "afs_bio_neurosoft_aeronautics", 10 ],
[ "afs_bio_dopamine_stimulators", 10 ],
[ "bio_forcefield_ballistic_heavy", 1 ],
[ "bio_shield_heavy", 1 ],
[ "afs_bio_translocator", 5 ],
[ "bio_shock_absorber", 2 ],
[ "afs_bio_skullgun", 2 ]
Expand Down
38 changes: 21 additions & 17 deletions data/mods/Aftershock/items/armor/energy_shield.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@
"variables": {
"transform_target": "afs_backpack_shieldgen_on",
"shield_max_hp": "600",
"shield_regen": "1",
"shield_regen": "2",
"shield_regen_rate": "1",
"bionic": "0",
"turn_cost": "1",
"success_message": "a",
"failure_message": "b"
Expand All @@ -103,9 +102,11 @@
"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",
"description": "A powerful shielding system salvaged from a pre-Discontinuity robotic warframe, crudely adapted for compatibility with biological hosts. Powerful enough to withstand prolonged assault from anti-vehicle weaponry.",
"//": "A hundred watts isnt much IRL, but this is powered with laser magazines, so theres an extra layer of abstraction here.",
"power_draw": "1 kW",
"revert_to": "afs_backpack_shieldgen",
"charges_per_use": 0,
"extend": { "flags": [ "SHIELD_GENERATOR" ] },
"use_action": {
"type": "effect_on_conditions",
Expand Down Expand Up @@ -151,19 +152,14 @@
"type": "effect_on_condition",
"effect": [
{
"if": "has_ammo",
"if": { "and": [ { "not": { "u_has_worn_with_flag": "ENERGY_SHIELD" } }, "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" ] } ],
Expand All @@ -172,6 +168,7 @@
"id": "_SHIELD_SETUP",
"effect": [
{ "math": [ "n_shield_uid = _shield_uid" ] },
{ "math": [ "n_shield_is_bionic = 0" ] },
{ "math": [ "n_shield_turn = 0" ] },
{ "math": [ "n_SHIELD_REGEN = 0" ] },
{ "math": [ "n_SHIELD_REGEN_RATE = 0" ] },
Expand All @@ -197,14 +194,21 @@
{ "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": [
"//": "If the shield is bionic, we check if the bionic is still active. Else we proceed to check for a shield generator item.",
"if": { "and": [ { "math": [ "n_shield_is_bionic", "==", "1" ] }, { "u_has_flag": "BIO_SHIELD_ACTIVE" } ] },
"then": [ { "math": [ "u_proceed_shield = 1" ] } ],
"else": [
{
"id": "_afs_actually_do_shield",
"condition": { "math": [ "_shield_uid", "==", "n_shield_gen_uid" ] },
"effect": [ { "math": [ "u_proceed_shield = 1" ] } ]
"//": "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" ] } ]
}
]
}
]
},
Expand Down
56 changes: 13 additions & 43 deletions data/mods/Aftershock/items/cbms.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,63 +232,33 @@
"difficulty": 6
},
{
"id": "bio_forcefield_bash_cut_weak",
"id": "bio_shield_weak",
"copy-from": "bionic_general",
"type": "BIONIC_ITEM",
"name": { "str": "HawkingCorps GravyField Mark I CBM" },
"name": { "str": "HawkingCorps Mark I Shield CBM" },
"description": "Imagine a computer inside your body playing pong against the universe. The paddles are made of energy fields and how it causes this to happen are trade secrets. -From the owners manual of HawkingCorps GravyField Mark I. Activating the field will reduce incoming bashing and cut damage by 5 points.",
"price": "1 kUSD",
"price_postapoc": "25 USD",
"difficulty": 6
},
{
"id": "bio_forcefield_bash_cut_medium",
"copy-from": "bionic_general",
"type": "BIONIC_ITEM",
"name": { "str": "HawkingCorps GravyField Mark II CBM" },
"description": "The HawkingCorps GravyField Mark II was designed for police actions during food riots and other civilian uprisings. It has proven capable of protecting against most improvised weapons. Activating the field will reduce incoming and cut damage by 15 points.",
"price": "1 kUSD",
"price_postapoc": "35 USD",
"difficulty": 8
},
{
"id": "bio_forcefield_bash_cut_heavy",
"copy-from": "bionic_general",
"type": "BIONIC_ITEM",
"name": { "str": "Debt Collection Agent GravyField CBM" },
"description": "This class of personal energy field often sees action on both sides of the vicious ship-to-ship boarding fights that are common with both repossession and piracy. It remains practically impenetrable to melee weapons that lack sharp piercing points. Activating the field will reduce incoming bashing and cut damage by 25 points.",
"price": "1 kUSD",
"price_postapoc": "65 USD",
"difficulty": 10
},
{
"id": "bio_forcefield_ballistic_weak",
"copy-from": "bionic_general",
"type": "BIONIC_ITEM",
"name": { "str": "Point Energy Conversion Field CBM" },
"description": "A personal kinetic attenuation field that slows incoming projectiles by converting their kinetic energy into bursts of visible light. Although this version is not powerful enough to defeat most pistol or rifle cartridges by itself, it greatly increases survival odds when combined with traditional ballistic armor. Activating the field will reduce incoming ballistic and piercing damage by 10 points.",
"price": "1 kUSD",
"price_postapoc": "25 USD",
"price": "80 kUSD",
"price_postapoc": "80 kUSD",
"difficulty": 6
},
{
"id": "bio_forcefield_ballistic_medium",
"id": "bio_shield_medium",
"copy-from": "bionic_general",
"type": "BIONIC_ITEM",
"name": { "str": "Holtzman Personal Shield Generator CBM" },
"description": "A military grade kinetic attenuation system developed for use within UICA's special service branches. Although much more effective than anything that could be conceived with current technology, it remains a pale imitation of the Hyperspace Age systems it was reverse engineered from. A side effect modern engineering seems unable to address is the tendency for this unit to release electrical fields when hit. Activating the field will reduce incoming ballistic and piercing damage by 20 points.",
"price": "1 kUSD",
"price_postapoc": "65 USD",
"name": { "str": "HawkingCorps Mark V Shield CBM" },
"description": "Powerful and covert, the Mark V Shield is a military-grade shielding system developed for use within UICA's special service branches. Although much more effective than anything that could be conceived with current technology, it remains a pale imitation of the Hyperspace Age systems it was reverse-engineered from. A.\n\nActivating the shield will create an energy barrier capable of withstanding a modest amount of melee and ranged damage.",
"price": "220 kUSD",
"price_postapoc": "220 kUSD",
"difficulty": 10
},
{
"id": "bio_forcefield_ballistic_heavy",
"id": "bio_shield_heavy",
"copy-from": "bionic_general",
"type": "BIONIC_ITEM",
"name": { "str": "Kinetic Annulment System CBM" },
"description": "A kinetic attenuation system salvaged from a pre-Discontinuity robotic warframe, crudely adapted for compatibility with biological hosts. Powerful enough to completely stop most rifle cartridges. Activating the field will reduce incoming ballistic and piercing damage by 40 points.",
"price": "1 kUSD",
"price_postapoc": "125 USD",
"description": "A powerful shielding system salvaged from a pre-Discontinuity robotic warframe, crudely adapted for compatibility with biological hosts. Powerful enough to completely stop most rifle cartridges. Activating the field will reduce incoming ballistic and piercing damage by 40 points.",
"price": "1320 kUSD",
"price_postapoc": "1320 kUSD",
"difficulty": 16
}
]
60 changes: 60 additions & 0 deletions data/mods/Aftershock/migration.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,66 @@
"//": "obsoleted from base game as part of https://github.com/CleverRaven/Cataclysm-DDA/pull/70989",
"from": "bio_trickle"
},
{
"type": "bionic_migration",
"from": "bio_forcefield_bash_cut_weak",
"to": "bio_shield_weak"
},
{
"type": "bionic_migration",
"from": "bio_forcefield_bash_cut_medium",
"to": "bio_shield_medium"
},
{
"type": "bionic_migration",
"from": "bio_forcefield_bash_cut_heavy",
"to": "bio_shield_heavy"
},
{
"type": "bionic_migration",
"from": "bio_forcefield_ballistic_weak",
"to": "bio_shield_weak"
},
{
"type": "bionic_migration",
"from": "bio_forcefield_ballistic_medium",
"to": "bio_shield_medium"
},
{
"type": "bionic_migration",
"from": "bio_forcefield_ballistic_heavy",
"to": "bio_shield_heavy"
},
{
"type": "MIGRATION",
"id": "bio_forcefield_bash_cut_weak",
"replace": "bio_shield_weak"
},
{
"type": "MIGRATION",
"id": "bio_forcefield_bash_cut_medium",
"replace": "bio_shield_medium"
},
{
"type": "MIGRATION",
"id": "bio_forcefield_bash_cut_heavy",
"replace": "bio_shield_heavy"
},
{
"type": "MIGRATION",
"id": "bio_forcefield_ballistic_weak",
"replace": "bio_shield_weak"
},
{
"type": "MIGRATION",
"id": "bio_forcefield_ballistic_medium",
"replace": "bio_shield_medium"
},
{
"type": "MIGRATION",
"id": "bio_forcefield_ballistic_heavy",
"replace": "bio_shield_heavy"
},
{
"id": [ "bot_eyebot" ],
"type": "MIGRATION",
Expand Down
2 changes: 1 addition & 1 deletion data/mods/Aftershock/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "anesthetic",
"type": "requirement",
"//": "Anesthetic cost removed in this mod, as autodocs do all the heavy lifting.",
"tools": [ ]
"tools": [ [ ] ]
},
{
"type": "EXTERNAL_OPTION",
Expand Down
48 changes: 48 additions & 0 deletions data/mods/Aftershock/player/bionic_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,53 @@
"decay_start": "24 hours"
}
]
},
{
"id": "EOC_bio_start_shield",
"type": "effect_on_condition",
"effect": [
{
"if": { "not": { "u_has_worn_with_flag": "ENERGY_SHIELD" } },
"then": [
{ "u_cast_spell": { "id": "spawn_shield", "hit_self": true } },
{ "u_message": { "context_val": "success_message" } },
{ "math": [ "_shield_uid = rand(1200)" ] },
{ "math": [ "u_shield_gen_uid = _shield_uid" ] },
{ "math": [ "u_shield_power_ratio = u_val('power_percentage')" ] },
{
"u_run_inv_eocs": "all",
"search_data": [ { "id": [ "afs_energy_shield" ] } ],
"true_eocs": [
{
"id": "_BIO_SHIELD_SETUP",
"effect": [
{ "math": [ "n_shield_uid = _shield_uid" ] },
{ "math": [ "n_shield_is_bionic = 1" ] },
{ "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_bio_stop_shield",
"type": "effect_on_condition",
"effect": [ { "u_remove_item_with": "afs_energy_shield" }, { "math": [ "u_shield_ratio = -1" ] } ]
},
{
"id": "EOC_bio_update_ui",
"type": "effect_on_condition",
"effect": { "math": [ "u_shield_power_ratio = u_val('power_percentage')" ] }
}
]
Loading

0 comments on commit 7b67e86

Please sign in to comment.