Skip to content

Commit

Permalink
[ Xedra Evolved ] Species based snares [Robot, Cyborg, Nether, Change…
Browse files Browse the repository at this point in the history
…ling] (#73867)

* Species based trap

Co-Authored-By: RenechCDDA <[email protected]>

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Additional traps, needs recipes still

* Apply suggestions from code review

Co-authored-by: Jianxiang Wang (王健翔) <[email protected]>

* Update data/mods/Xedra_Evolved/items/alchemy.json

* hedge snare

* Update alchemy.json

* Apply suggestions from code review

Co-authored-by: RenechCDDA <[email protected]>

* Update src/trapfunc.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spellbooks_hedge.json

* Update data/mods/Xedra_Evolved/items/spell_learning_items/spellbooks_hedge.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spell_components.json

* Recipe for inventors

* Update misc.json

* Update data/json/effects.json

* Update data/json/effects.json

* Update misc.json

* Apply suggestions from code review

---------

Co-authored-by: RenechCDDA <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jianxiang Wang (王健翔) <[email protected]>
  • Loading branch information
4 people authored Jul 4, 2024
1 parent 7f60041 commit 36d0635
Show file tree
Hide file tree
Showing 18 changed files with 314 additions and 4 deletions.
9 changes: 9 additions & 0 deletions data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,15 @@
],
"flags": [ "EFFECT_LIMB_SCORE_MOD" ]
},
{
"type": "effect_type",
"id": "immobilization",
"name": [ "Immobilized" ],
"desc": [ "You can't move!" ],
"rating": "bad",
"show_in_info": true,
"flags": [ "EFFECT_IMPEDING" ]
},
{
"type": "effect_type",
"id": "stunned",
Expand Down
11 changes: 11 additions & 0 deletions data/json/traps.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,17 @@
"difficulty": 0,
"action": "snare_light"
},
{
"type": "trap",
"id": "tr_species_snare",
"name": "species snare trap",
"color": "red",
"symbol": "~",
"visibility": 1,
"avoidance": 8,
"difficulty": 0,
"action": "snare_species"
},
{
"type": "trap",
"id": "tr_beartrap",
Expand Down
4 changes: 3 additions & 1 deletion data/mods/Xedra_Evolved/eocs/inventor.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"mod_inv_pistol_booster",
"inventor_research_base_3",
"inventor_research_energy_1",
"software_AI"
"software_AI",
"stunning_qr_trap"
],
"type": "recipe",
"true_eocs": [ "EOC_INVENTOR_MESSAGE_GOOD" ],
Expand Down Expand Up @@ -101,6 +102,7 @@
"vision_halo",
"sonic_gun",
"mace_magic",
"stunning_arg_trap",
"inventor_fists_plus",
"inventor_plasma_axe_off",
"inventor_research_energy_1"
Expand Down
24 changes: 24 additions & 0 deletions data/mods/Xedra_Evolved/items/alchemy.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,30 @@
"vitamins": [ [ "cheval", 1000 ] ]
}
},
{
"id": "nether_snare",
"type": "TOOL",
"name": "snaring pentagram trap",
"category": "traps",
"properties": { "capture_species": "NETHER" },
"description": "A metallic pentagram full of mystic symbols. Will trap creatures from other dimensions if they wander into it.",
"weight": "1 kg",
"volume": "1000 ml",
"longest_side": "60 cm",
"price": "250 USD",
"price_postapoc": "5 USD",
"material": "lead",
"symbol": "*",
"color": "dark_gray",
"flags": [ "SINGLE_USE" ],
"use_action": {
"type": "place_trap",
"trap": "tr_species_snare",
"moves": 150,
"practice": 2,
"done_message": "You set the pentagram snare."
}
},
{
"id": "spiritshow_dust",
"name": { "str_sp": "spirit show dust" },
Expand Down
24 changes: 24 additions & 0 deletions data/mods/Xedra_Evolved/items/hedge_magic_items.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,30 @@
"flags": [ "ONE_PER_LAYER", "SKINTIGHT", "NO_UNLOAD", "NO_RELOAD", "MUNDANE" ],
"relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "MAX_MANA", "add": 0 } ] } ] }
},
{
"id": "item_hedge_changeling_snare",
"type": "TOOL",
"name": "betweener's maze",
"category": "traps",
"properties": { "capture_species": "CHANGELING" },
"description": "A yarn contraption similar to a cat's cradle that looks like a three dimensional maze. When placed properly, it can fascinate the changeling blooded.",
"weight": "20 g",
"volume": "100 ml",
"longest_side": "20 cm",
"price": "250 USD",
"price_postapoc": "5 USD",
"material": "wool",
"symbol": "*",
"color": "green_green",
"flags": [ "SINGLE_USE" ],
"use_action": {
"type": "place_trap",
"trap": "tr_species_snare",
"moves": 150,
"practice": 2,
"done_message": "You place the betweener's maze."
}
},
{
"id": "item_hedge_nether_eye_paste",
"name": { "str_sp": "Blood-and-Ash Paste" },
Expand Down
50 changes: 50 additions & 0 deletions data/mods/Xedra_Evolved/items/inventor/traps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"id": "stunning_qr_trap",
"type": "TOOL",
"name": "stunning QR trap",
"category": "traps",
"properties": { "capture_species": "ROBOT" },
"description": "A jagged and eldritch looking QR code ready to be placed wherever you are concerned about mechanical eyes. Will trap robots if they wander into it.",
"weight": "1 g",
"volume": "5 ml",
"longest_side": "5 cm",
"price": "250 USD",
"price_postapoc": "5 USD",
"material": "plastic",
"symbol": "*",
"color": "light_gray",
"flags": [ "SINGLE_USE" ],
"use_action": {
"type": "place_trap",
"trap": "tr_species_snare",
"moves": 150,
"practice": 2,
"done_message": "You set the QR code."
}
},
{
"id": "stunning_arg_trap",
"type": "TOOL",
"name": "stunning arg trap",
"category": "traps",
"properties": { "capture_species": "CYBORG" },
"description": "A jagged and eldritch looking QR code ready to be placed wherever you are concerned about mechanical eyes. Will trap cyborgs if they wander into it.",
"weight": "1 g",
"volume": "5 ml",
"longest_side": "5 cm",
"price": "250 USD",
"price_postapoc": "5 USD",
"material": "plastic",
"symbol": "*",
"color": "light_gray",
"flags": [ "SINGLE_USE" ],
"use_action": {
"type": "place_trap",
"trap": "tr_species_snare",
"moves": 150,
"practice": 2,
"done_message": "You set the QR code."
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,20 @@
"symbol": "?",
"color": "dark_gray",
"use_action": { "type": "learn_spell", "spells": [ "hedge_no_nightmares" ] }
},
{
"id": "spellbook_hedge_snare_changelings",
"type": "BOOK",
"category": "manuals",
"name": { "str": "Monas Hieroglyphica", "str_pl": "copies of Monas Hieroglyphica" },
"description": "This is a thin reproduction of John Dee's Monas Hieroglyphica. A complicated work whose meaning has long been lost without access to the occult oral tradition of it's time. It's possible that some remnants of that oral tradition still exist today, but it is unknown if they would be able to fully interpret this spellbook.",
"weight": "83 g",
"volume": "132 ml",
"price": "10 USD",
"material": [ "paper" ],
"looks_like": "cookbook",
"symbol": "?",
"color": "dark_gray",
"use_action": { "type": "learn_spell", "spells": [ "hedge_changeling_snare" ] }
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"condition": { "and": [ { "u_has_trait": "perk_ALCHEMY4" }, { "not": { "u_has_effect": "mental_exhaustion" } } ] },
"effect": [
{
"u_roll_remainder": [ "life_extension_potion", "potion_strength", "potion_dex", "hares_leap_potion" ],
"u_roll_remainder": [ "life_extension_potion", "potion_strength", "potion_dex", "hares_leap_potion", "nether_snare" ],
"type": "recipe",
"true_eocs": [ "EOC_SUCCESFUL_ROLL_REMAINDER_ALCHEMY" ],
"false_eocs": [ "EOC_COMPLETED_ROLL_REMAINDER_ALCHEMY" ]
Expand Down
14 changes: 14 additions & 0 deletions data/mods/Xedra_Evolved/recipes/alchemy.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,20 @@
"tools": [ [ [ "surface_heat", 25, "LIST" ] ] ],
"components": [ [ [ "faewild", 1 ] ], [ [ "scrap_dreamdross", 2 ] ], [ [ "bone", 1 ] ], [ [ "corpse_ash", 1 ] ] ]
},
{
"type": "recipe",
"activity_level": "LIGHT_EXERCISE",
"result": "nether_snare",
"category": "CC_XEDRA",
"subcategory": "CSC_XEDRA_ALCHEMY",
"skill_used": "fabrication",
"skills_required": [ "deduction", 1 ],
"difficulty": 3,
"time": "75 m",
"flags": [ "SECRET" ],
"tools": [ [ [ "paint_brush", -1 ] ], [ [ "paint", 1, "LIST" ] ] ],
"components": [ [ [ "scrap_dreamdross", 3 ] ], [ [ "mutant_blood", 1 ] ], [ [ "silver_small", 1 ] ] ]
},
{
"type": "recipe",
"activity_level": "LIGHT_EXERCISE",
Expand Down
48 changes: 48 additions & 0 deletions data/mods/Xedra_Evolved/recipes/inventor/misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,54 @@
[ [ "amplifier", 2 ] ]
]
},
{
"type": "recipe",
"activity_level": "MODERATE_EXERCISE",
"result": "stunning_qr_trap",
"flags": [ "SECRET" ],
"category": "CC_XEDRA",
"subcategory": "CSC_XEDRA_MISC",
"skill_used": "deduction",
"difficulty": 5,
"skills_required": [ "fabrication", 1 ],
"time": "3 h",
"proficiencies": [ { "proficiency": "prof_plasticworking", "time_multiplier": 2, "skill_penalty": 0 } ],
"qualities": [ { "id": "SCREW", "level": 1 }, { "id": "SAW_M", "level": 1 } ],
"tools": [ [ [ "paint_brush", -1 ] ], [ [ "paint", 1, "LIST" ] ] ],
"components": [
[ [ "light_disposable_cell", 1 ] ],
[ [ "power_supply", 1 ] ],
[ [ "scrap", 3 ] ],
[ [ "cable", 4 ] ],
[ [ "scrap_dreamdross", 4 ] ],
[ [ "plastic_chunk", 2 ] ],
[ [ "amplifier", 1 ] ]
]
},
{
"type": "recipe",
"activity_level": "MODERATE_EXERCISE",
"result": "stunning_arg_trap",
"flags": [ "SECRET" ],
"category": "CC_XEDRA",
"subcategory": "CSC_XEDRA_MISC",
"skill_used": "deduction",
"difficulty": 6,
"skills_required": [ "computer", 3 ],
"time": "3 h",
"proficiencies": [ { "proficiency": "prof_plasticworking", "time_multiplier": 2, "skill_penalty": 0 } ],
"qualities": [ { "id": "SCREW", "level": 1 }, { "id": "SAW_M", "level": 1 } ],
"tools": [ [ [ "paint_brush", -1 ] ], [ [ "paint", 1, "LIST" ] ] ],
"components": [
[ [ "light_disposable_cell", 1 ] ],
[ [ "power_supply", 1 ] ],
[ [ "scrap", 3 ] ],
[ [ "cable", 4 ] ],
[ [ "scrap_dreamdross", 4 ] ],
[ [ "plastic_chunk", 2 ] ],
[ [ "amplifier", 1 ] ]
]
},
{
"result": "software_AI",
"container": "usb_drive",
Expand Down
5 changes: 5 additions & 0 deletions data/mods/Xedra_Evolved/requirements/spell_components.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@
"components": [ [ [ "corpse_ash", 50 ] ], [ [ "edible_blood", 1, "LIST" ], [ "blood_tainted", 1 ] ], [ [ "wild_herbs", 20 ] ] ],
"qualities": [ { "id": "FINE_GRIND", "level": 1 } ]
},
{
"id": "spell_components_hedge_changeling_snare",
"type": "requirement",
"components": [ [ [ "yarn", 10 ] ], [ [ "splinter", 3 ] ], [ [ "blackberries", 1 ] ], [ [ "wild_herbs", 20 ] ] ]
},
{
"id": "spell_components_hedge_stunning_spell",
"type": "requirement",
Expand Down
22 changes: 22 additions & 0 deletions data/mods/Xedra_Evolved/spells/hedge_magic_spells.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,28 @@
"max_level": 1,
"min_damage": 1,
"max_damage": 1,
"base_casting_time": 1440000,
"min_duration": 360000,
"max_duration": 720000
},
{
"id": "hedge_changeling_snare",
"type": "SPELL",
"name": "Maze the Little Folk",
"description": "A spell to create a snare for catching one of the little folk, a changeling. Has no effect on the elder spirits of wood and water, fire and earth, nor plant or man.",
"message": "You skein a complicated cat's cradle with splinters of wood guiding the way in to blackberries at each of the focus points in your design.",
"flags": [ "VERBAL", "SOMATIC", "NO_FAIL", "PERMANENT", "PERMANENT_ALL_LEVELS" ],
"valid_targets": [ "self" ],
"difficulty": 1,
"spell_class": "HEDGE_MAGIC",
"skill": "survival",
"effect": "spawn_item",
"effect_str": "item_hedge_changeling_snare",
"shape": "blast",
"components": "spell_components_hedge_changeling_snare",
"max_level": 1,
"min_damage": 1,
"max_damage": 1,
"base_casting_time": 990000,
"min_duration": 360000,
"max_duration": 720000
Expand Down
4 changes: 4 additions & 0 deletions src/iuse_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3929,6 +3929,10 @@ std::optional<int> place_trap_actor::use( Character *p, item &it, const tripoint
p->mod_moves( -move_cost_final );

place_and_add_as_known( *p, pos, data.trap );
const trap &placed_trap = here.tr_at( pos );
if( !placed_trap.is_null() ) {
const_cast<trap &>( placed_trap ).set_trap_data( it.typeId() );
}
for( const tripoint &t : here.points_in_radius( pos, data.trap.obj().get_trap_radius(), 0 ) ) {
if( t != pos ) {
place_and_add_as_known( *p, t, outer_layer_trap );
Expand Down
5 changes: 5 additions & 0 deletions src/monmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ static const efftype_id effect_downed( "downed" );
static const efftype_id effect_dragging( "dragging" );
static const efftype_id effect_grabbed( "grabbed" );
static const efftype_id effect_harnessed( "harnessed" );
static const efftype_id effect_immobilization( "immobilization" );
static const efftype_id effect_led_by_leash( "led_by_leash" );
static const efftype_id effect_no_sight( "no_sight" );
static const efftype_id effect_operating( "operating" );
Expand Down Expand Up @@ -895,6 +896,10 @@ void monster::move()
moves = 0;
return;
}
if( has_effect( effect_immobilization ) ) {
moves = 0;
return;
}
if( has_effect( effect_stunned ) || has_effect( effect_psi_stunned ) ) {
stumble();
moves = 0;
Expand Down
9 changes: 7 additions & 2 deletions src/savegame_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4762,8 +4762,10 @@ void submap::store( JsonOut &jsout ) const
jsout.start_array();
jsout.write( p.x );
jsout.write( p.y );
const trap_id &trap_at = get_trap( p );
// TODO: jsout should support writing an id like jsout.write( trap_id )
jsout.write( get_trap( p ).id().str() );
jsout.write( trap_at.id().str() );
jsout.write( trap_at->trap_item_type );
jsout.end_array();
}
}
Expand Down Expand Up @@ -5020,7 +5022,10 @@ void submap::load( const JsonValue &jv, const std::string &member_name, int vers
// TODO: jsin should support returning an id like jsin.get_id<trap>()
const trap_str_id trid( trap_entry.next_string() );
m->trp[p.x][p.y] = trid.id();
if( trap_entry.size() > 3 ) {
if( trap_entry.has_more() ) {
const_cast<trap &>( m->trp[p.x][p.y].obj() ).set_trap_data( itype_id( trap_entry.next_string() ) );
}
if( trap_entry.size() > 4 ) {
trap_entry.throw_error( "Too many values for trap entry" );
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/trap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ bool trap::easy_take_down() const
return avoidance == 0 && difficulty == 0;
}

void trap::set_trap_data( itype_id trap_item_type_id )
{
trap_item_type = trap_item_type_id;
}

bool trap::can_not_be_disarmed() const
{
return difficulty >= 99;
Expand Down
Loading

0 comments on commit 36d0635

Please sign in to comment.