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

RPG dice #31031

Merged
merged 39 commits into from
Jun 11, 2019
Merged

RPG dice #31031

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
200a19f
Update ammo.json
krekeler0 Jun 1, 2019
89775d3
Update professions.json
krekeler0 Jun 1, 2019
22b056b
Update ammo.json
krekeler0 Jun 1, 2019
f6e41ba
Update SUS_specific_use_storage_items.json
krekeler0 Jun 1, 2019
1fa951f
Update SUS_specific_use_storage_items.json
krekeler0 Jun 1, 2019
6de8c38
Update ammo.json
krekeler0 Jun 1, 2019
d248b28
Update ammo.json
krekeler0 Jun 1, 2019
c0bce1a
Update SUS_specific_use_storage_items.json
krekeler0 Jun 1, 2019
90bb809
Update professions.json
krekeler0 Jun 2, 2019
e8b0754
Update ammo.json
krekeler0 Jun 2, 2019
a8ad9a9
Update SUS_specific_use_storage_items.json
krekeler0 Jun 2, 2019
3dd089f
Update professions.json
krekeler0 Jun 2, 2019
8e689b6
Update basement_game.json
krekeler0 Jun 2, 2019
41ae7cc
Update mall_item_groups.json
krekeler0 Jun 2, 2019
c0f1b0a
Update misc.json
krekeler0 Jun 3, 2019
f740088
Update item_groups.json
krekeler0 Jun 3, 2019
620a6ee
Update monster_drops.json
krekeler0 Jun 3, 2019
a86f51a
Update ammo.json
krekeler0 Jun 3, 2019
8cddb74
Update ammo.json
krekeler0 Jun 3, 2019
37e1170
Update item_groups.json
krekeler0 Jun 3, 2019
2dad012
Update mall_item_groups.json
krekeler0 Jun 3, 2019
c615ae3
Update misc.json
krekeler0 Jun 3, 2019
3dbba16
Update SUS_specific_use_storage_items.json
krekeler0 Jun 3, 2019
5c942e2
Update basement_game.json
krekeler0 Jun 3, 2019
4e270c2
Update monster_drops.json
krekeler0 Jun 3, 2019
5c2ea2a
Update monster_drops.json
krekeler0 Jun 3, 2019
1b4eea8
Update monster_drops.json
krekeler0 Jun 3, 2019
e5453a4
Update monster_drops.json
krekeler0 Jun 3, 2019
d9d94f4
Update materials.json
krekeler0 Jun 5, 2019
a5c7da4
Update ammo.json
krekeler0 Jun 5, 2019
3d86d76
Update materials.json
krekeler0 Jun 5, 2019
cb48100
Update materials.json
krekeler0 Jun 5, 2019
a8a876b
Add die use action
anothersimulacrum Jun 6, 2019
0f77bd9
Merge pull request #1 from anothersimulacrum/die-use-action
krekeler0 Jun 6, 2019
395c15e
Adjust use action a bit
anothersimulacrum Jun 7, 2019
bc66146
Merge pull request #2 from anothersimulacrum/die-use-action
krekeler0 Jun 7, 2019
c686951
Update src/item.cpp
krekeler0 Jun 7, 2019
4d84415
Update materials.json
krekeler0 Jun 9, 2019
eccbd84
Update materials.json
krekeler0 Jun 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/json/item_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,11 @@
"id": "MP3_ON",
"name": "Turn off music"
},
{
"type": "item_action",
"id": "RPGDIE",
"name": "Roll die"
},
{
"type": "item_action",
"id": "GASMASK",
Expand Down
2 changes: 2 additions & 0 deletions data/json/item_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
[ "slingshot", 10 ],
[ "frisbee", 10 ],
[ "dnd_handbook", 1 ],
[ "RPG_die", 1 ],
[ "metal_RPG_die", 1 ],
[ "milkshake_fastfood", 3 ]
]
},
Expand Down
2 changes: 2 additions & 0 deletions data/json/itemgroups/SUS_specific_use_storage_items.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
{ "item": "corkscrew", "prob": 60 },
{ "item": "bottle_opener", "prob": 75 },
{ "item": "candle", "prob": 75 },
{ "item": "RPG_die", "prob": 10 },
{ "item": "metal_RPG_die", "prob": 1 },
{ "distribution": [ { "item": "matches" }, { "item": "lighter" } ], "prob": 90 }
]
},
Expand Down
4 changes: 3 additions & 1 deletion data/json/itemgroups/mall_item_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@
[ "jedi_cloak", 5 ],
[ "clown_suit", 5 ],
[ "clownshoes", 5 ],
[ "radio_car_box", 10 ]
[ "radio_car_box", 10 ],
[ "RPG_die", 5 ],
[ "metal_RPG_die", 1 ]
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions data/json/itemgroups/misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
{ "item": "family_photo", "prob": 5 },
{ "item": "coin_quarter", "prob": 5 },
{ "item": "mobile_memory_card_used", "count": [ 1, 4 ], "prob": 15 },
{ "item": "RPG_die", "prob": 5 },
{ "item": "metal_RPG_die", "prob": 1 },
{ "item": "mobile_memory_card_encrypted", "count": [ 1, 2 ], "prob": 15 }
]
},
Expand Down
44 changes: 44 additions & 0 deletions data/json/items/ammo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1327,5 +1327,49 @@
"count": 50,
"ammo_type": "tinder",
"effects": [ "NEVER_MISFIRES" ]
},
{
"type": "AMMO",
"id": "RPG_die",
"price": 10,
"name": "RPG die",
"name_plural": "RPG dice",
"symbol": "=",
"color": "light_gray",
"looks_like": "marble",
"description": "A die used to play various role-playing games.",
"material": "plastic",
"volume": 1,
"weight": 1,
"ammo_type": "pebble",
"damage": 1,
"range": 20,
"dispersion": 15,
"loudness": 0,
"count": 7,
"effects": [ "NEVER_MISFIRES" ],
"use_action": "RPGDIE"
},
{
"type": "AMMO",
"id": "metal_RPG_die",
"price": 50,
"name": "metal RPG die",
"name_plural": "metal RPG dice",
"symbol": "=",
"color": "light_gray",
"looks_like": "marble",
"description": "A metal die used to play various role-playing games",
"material": "zinc",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This material does not exist

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I made another PR adding it, and removed it from this one. I'll put it back in this one and just mention that in both PRs.

"volume": 1,
"weight": 1,
"ammo_type": "pebble",
"damage": 3,
"range": 15,
"dispersion": 10,
"loudness": 0,
"count": 7,
"effects": [ "NEVER_MISFIRES" ],
"use_action": "RPGDIE"
}
]
4 changes: 3 additions & 1 deletion data/json/mapgen/basement/basement_game.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@
"place_loot": [
{ "item": "dnd_handbook", "x": 18, "y": 8, "chance": 100 },
{ "item": "novel_fantasy", "x": [ 17, 19 ], "y": [ 8, 10 ], "chance": 60, "repeat": [ 0, 4 ] },
{ "item": "character_sheet", "x": [ 17, 19 ], "y": [ 9, 10 ], "chance": 80, "repeat": [ 1, 5 ] }
{ "item": "character_sheet", "x": [ 17, 19 ], "y": [ 9, 10 ], "chance": 80, "repeat": [ 1, 5 ] },
{ "item": "metal_RPG_die", "x": 18, "y": 8, "chance": 10 },
{ "item": "RPG_die", "x": [ 17, 19 ], "y": [ 8, 10 ], "chance": 90, "repeat": [ 1, 4 ] }
],
"mapping": {
"F": { "items": [ { "item": "fridgesnacks", "chance": 80, "repeat": [ 1, 3 ] } ] },
Expand Down
18 changes: 18 additions & 0 deletions data/json/materials.json
Original file line number Diff line number Diff line change
Expand Up @@ -1387,5 +1387,23 @@
"dmg_adj": [ "lightly damaged", "damaged", "very damaged", "thoroughly damaged" ],
"bash_dmg_verb": "damaged",
"cut_dmg_verb": "damaged"
},
{
"type": "material",
"ident": "zinc",
"name": "Zinc",
"density": 10,
"specific_heat_liquid": 1.18,
"specific_heat_solid": 0.91,
"latent_heat": 260,
"bash_resist": 4,
"cut_resist": 3,
"acid_resist": 4,
"fire_resist": 1,
"elec_resist": 0,
"chip_resist": 10,
"dmg_adj": [ "dented", "bent", "smashed", "shattered" ],
"bash_dmg_verb": "dented",
"cut_dmg_verb": "scratched"
}
]
4 changes: 4 additions & 0 deletions data/json/monster_drops.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
],
"prob": 5
},
{
"distribution": [ { "item": "RPG_die", "prob": 70 }, { "item": "dnd_handbook", "prob": 30 }, { "item": "metal_RPG_die", "prob": 10 } ],
"prob": 1
},
{
"distribution": [
{ "item": "cig", "prob": 65, "charges-min": 0, "charges-max": 20 },
Expand Down
2 changes: 1 addition & 1 deletion data/json/professions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3582,7 +3582,7 @@
"skills": [ { "level": 2, "name": "speech" }, { "level": 1, "name": "survival" } ],
"items": {
"both": {
"items": [ "jeans", "tshirt", "socks", "sneakers", "mbag", "pizza_cheese", "cola", "dnd_handbook", "wristwatch" ],
"items": [ "jeans", "tshirt", "socks", "sneakers", "mbag", "pizza_cheese", "cola", "dnd_handbook", "wristwatch", "RPG_die" ],
"entries": [ { "group": "charged_cell_phone" } ]
},
"male": [ "briefs" ],
Expand Down
5 changes: 5 additions & 0 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2691,6 +2691,11 @@ std::string item::info( std::vector<iteminfo> &info, const iteminfo_query *parts
}
}
}
if( this->get_var( "die_num_sides", 0 ) != 0 ) {
info.emplace_back( "DESCRIPTION",
string_format( _( "* This item can be used as a <info>die</info>, and has <info>%d</info> sides." ),
static_cast<int>( this->get_var( "die_num_sides", 0 ) ) ) );
}

// list recipes you could use it in
itype_id tid;
Expand Down
1 change: 1 addition & 0 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ void Item_factory::init()
add_iuse( "CHAINSAW_OFF", &iuse::chainsaw_off );
add_iuse( "CHAINSAW_ON", &iuse::chainsaw_on );
add_iuse( "CHEW", &iuse::chew );
add_iuse( "RPGDIE", &iuse::rpgdie );
add_iuse( "BIRDFOOD", &iuse::feedbird );
add_iuse( "BURROW", &iuse::burrow );
add_iuse( "CHOP_TREE", &iuse::chop_tree );
Expand Down
17 changes: 17 additions & 0 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4051,6 +4051,23 @@ int iuse::mp3_on( player *p, item *it, bool t, const tripoint &pos )
return it->type->charges_to_use();
}

int iuse::rpgdie( player *you, item *die, bool, const tripoint & )
{
const std::vector<int> sides_options = { 4, 6, 8, 10, 12, 20, 50 };
int num_sides = die->get_var( "die_num_sides", 0 );
if( num_sides == 0 ) {
const int sides = sides_options[ rng( 0, sides_options.size() - 1 ) ];
num_sides = sides;
die->set_var( "die_num_sides", sides );
}
const int roll = rng( 1, num_sides );
you->add_msg_if_player( _( "You roll a %d on your %d sided %s" ), roll, num_sides, die->tname() );
if( roll == num_sides ) {
add_msg( m_good, _( "Critical!" ) );
}
return roll;
}

int iuse::dive_tank( player *p, item *it, bool t, const tripoint & )
{
if( t ) { // Normal use
Expand Down
1 change: 1 addition & 0 deletions src/iuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class iuse
int shocktonfa_on( player *, item *, bool, const tripoint & );
int mp3( player *, item *, bool, const tripoint & );
int mp3_on( player *, item *, bool, const tripoint & );
int rpgdie( player *, item *, bool, const tripoint & );
int dive_tank( player *, item *, bool, const tripoint & );
int gasmask( player *, item *, bool, const tripoint & );
int portable_game( player *, item *, bool, const tripoint & );
Expand Down