Skip to content

Commit

Permalink
Merge matchbombs.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingranade committed Sep 7, 2013
2 parents 7e5ba3d + a91914d commit aa45d25
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/raw/item_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -3649,6 +3649,7 @@
["smokebomb_act", 0],
["molotov_lit", 0],
["dynamite_act", 5],
["matchbomb_act", 0],
["firecracker_pack_act", 5],
["firecracker_act", 5],
["mininuke_act", 0],
Expand Down
46 changes: 46 additions & 0 deletions data/raw/items/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -4669,6 +4669,52 @@
"revert_to": "null",
"use_action": "KNIFE"
},

{
"id": "matchbomb",
"type": "TOOL",
"symbol": "*",
"color": "light_red",
"name": "match head bomb",
"description": "A bottle filled with match heads and equipped with a fuse. Use this item to light the fuse; you will, of course, need a lighter in your inventory to do this. After lighting it, throw it to cause fires.",
"price": 200,
"material": ["glass", "cotton"],
"weight": 412,
"volume": 2,
"bashing": 8,
"cutting": 0,
"to_hit": 1,
"max_charges": 0,
"initial_charges": 0,
"charges_per_use": 0,
"turns_per_charge": 0,
"ammo": "NULL",
"revert_to": "null",
"use_action": "MATCHBOMB"
},

{
"id": "matchbomb_act",
"type": "TOOL",
"symbol": "*",
"color": "light_red",
"name": "match head bomb (lit)",
"description": "A bottle filled with match heads and equipped with a fuse. This one has been lit, and its fuse is rapidly burning down.",
"price": 0,
"material": ["glass", "cotton"],
"weight": 412,
"volume": 2,
"bashing": 8,
"cutting": 0,
"to_hit": 1,
"max_charges": 1,
"initial_charges": 1,
"charges_per_use": 0,
"turns_per_charge": 1,
"ammo": "NULL",
"revert_to": "null",
"use_action": "MATCHBOMB_ACT"
},
{ "id":"ref_lighter",
"type": "TOOL",
"symbol": ",",
Expand Down
22 changes: 22 additions & 0 deletions data/raw/recipes.json
Original file line number Diff line number Diff line change
Expand Up @@ -13513,6 +13513,28 @@
]
},

{
"result": "matchbomb",
"category": "CC_WEAPON",
"skill_used": "fabrication",
"difficulty": 3,
"time": 10000,
"reversible": false,
"autolearn": true,
"components": [
[
[ "string_6", 1 ]
],
[
[ "bottle_glass", 1 ],
[ "flask_glass", 1 ]
],
[
[ "matches", 200 ]
]
]
},

{
"result": "goggles_welding",
"category": "CC_ARMOR",
Expand Down
2 changes: 2 additions & 0 deletions item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ void Item_factory::init(){
iuse_function_list["ARROW_FLAMABLE"] = &iuse::arrow_flamable;
iuse_function_list["MOLOTOV"] = &iuse::molotov;
iuse_function_list["MOLOTOV_LIT"] = &iuse::molotov_lit;
iuse_function_list["MATCHBOMB"] = &iuse::matchbomb;
iuse_function_list["MATCHBOMB_ACT"] = &iuse::matchbomb_act;
iuse_function_list["DYNAMITE"] = &iuse::dynamite;
iuse_function_list["DYNAMITE_ACT"] = &iuse::dynamite_act;
iuse_function_list["FIRECRACKER_PACK"] = &iuse::firecracker_pack;
Expand Down
25 changes: 25 additions & 0 deletions iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3342,6 +3342,31 @@ void iuse::dynamite_act(game *g, player *p, item *it, bool t)
g->explosion(pos.x, pos.y, 60, 0, false);
}

void iuse::matchbomb(game *g, player *p, item *it, bool t)
{
if (!p->use_charges_if_avail("fire", 1))
{
it->charges++;
g->add_msg_if_player(p,_("You need a lighter!"));
return;
}
g->add_msg_if_player(p,_("You light the match head bomb."));
it->make(g->itypes["matchbomb_act"]);
it->charges = 3;
it->active = true;
}

void iuse::matchbomb_act(game *g, player *p, item *it, bool t)
{
point pos = g->find_item(it);
if (pos.x == -999 || pos.y == -999)
return;
if (t) // Simple timer effects
g->sound(pos.x, pos.y, 0, _("ssss..."));
else // When that timer runs down...
g->explosion(pos.x, pos.y, 24, 0, false);
}

void iuse::firecracker_pack(game *g, player *p, item *it, bool t)
{
if (!p->use_charges_if_avail("fire", 1))
Expand Down
2 changes: 2 additions & 0 deletions iuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class iuse
void acidbomb_act (game *g, player *p, item *it, bool t);
void molotov (game *g, player *p, item *it, bool t);
void molotov_lit (game *g, player *p, item *it, bool t);
void matchbomb (game *g, player *p, item *it, bool t);
void matchbomb_act (game *g, player *p, item *it, bool t);
void dynamite (game *g, player *p, item *it, bool t);
void dynamite_act (game *g, player *p, item *it, bool t);
void firecracker_pack (game *g, player *p, item *it, bool t);
Expand Down

0 comments on commit aa45d25

Please sign in to comment.