Skip to content

Commit

Permalink
Base ammo explosions on new cookoff and other flags instead of item i…
Browse files Browse the repository at this point in the history
…dentity.
  • Loading branch information
kevingranade committed Apr 14, 2013
1 parent b716ca2 commit 32f5bb9
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,31 @@ bool map::process_fields_in_submap(game *g, int gridn)
destroyed = false;
vol = i_at(x, y)[i].volume();
item *it = &(i_at(x, y)[i]);
it_ammo *ammo_type = NULL;

if (it->is_ammo() && it->ammo_type() != AT_BATT &&
it->ammo_type() != AT_NAIL && it->ammo_type() != AT_BB &&
it->ammo_type() != AT_BOLT && it->ammo_type() != AT_ARROW && it->ammo_type() != AT_NULL) {
destroyed = true;
// cook off ammo instead of just burning it.
for(int i = 0; i < (it->charges / 10) + 1; i++)
{
g->explosion(x, y, (dynamic_cast<it_ammo*>(it->type))->damage / 2, true, false);
}

if (it->is_ammo())
{
ammo_type = dynamic_cast<it_ammo*>(it->type);
}
if(ammo_type != NULL &&
(ammo_type->ammo_effects & mfb(AMMO_FLAME) ||
ammo_type->ammo_effects & mfb(AMMO_INCENDIARY) ||
ammo_type->ammo_effects & mfb(AMMO_EXPLOSIVE) ||
ammo_type->ammo_effects & mfb(AMMO_FRAG) ||
ammo_type->ammo_effects & mfb(AMMO_NAPALM) ||
ammo_type->ammo_effects & mfb(AMMO_EXPLOSIVE_BIG) ||
ammo_type->ammo_effects & mfb(AMMO_TEARGAS) ||
ammo_type->ammo_effects & mfb(AMMO_SMOKE) ||
ammo_type->ammo_effects & mfb(AMMO_FLASHBANG) ||
ammo_type->ammo_effects & mfb(AMMO_COOKOFF)))
{
// TODO: Vary the effect based on the ammo flag instead of just exploding them all.
destroyed = true;
// cook off ammo instead of just burning it.
for(int i = 0; i < (it->charges / 10) + 1; i++)
{
g->explosion(x, y, (dynamic_cast<it_ammo*>(it->type))->damage / 2, true, false);
}
} else if (it->made_of(PAPER)) {
destroyed = it->burn(cur->density * 3);
consumed++;
Expand Down

0 comments on commit 32f5bb9

Please sign in to comment.