Skip to content

Commit

Permalink
Merge pull request #12723 from Coolthulhu/fungal-rework
Browse files Browse the repository at this point in the history
Rebalance fungaloids, clean up code
  • Loading branch information
BevapDin committed Jun 21, 2015
2 parents bd42b85 + addb2e7 commit 205b560
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 323 deletions.
8 changes: 4 additions & 4 deletions data/json/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -2263,7 +2263,7 @@
"death_drops": "default_zombie_items",
"hp":30,
"death_function":["FUNGUS", "NORMAL"],
"special_attacks":[["FUNGUS", 200], ["BOOMER", 20]],
"special_attacks":[["FUNGUS", 100], ["BOOMER", 20]],
"description":"A rotund and bloated human body with pasty, fungus-ridden flesh. Its mouth drips with a frothing gray sludge.",
"flags":["SEES", "HEARS", "SMELLS", "STUMBLES", "WARM", "BASHES", "GROUP_BASH", "POISON", "NO_BREATHE", "BONES", "FAT", "PUSH_MON"]
},{
Expand Down Expand Up @@ -3297,20 +3297,20 @@
"material":"veggy",
"diff":1,
"aggression":-50,
"morale":100,
"morale":75,
"speed":100,
"melee_skill":0,
"melee_dice":0,
"melee_dice_sides":0,
"melee_cut":0,
"dodge":4,
"dodge":2,
"armor_bash":0,
"armor_cut":0,
"hp":4,
"upgrades_into": "mon_fungaloid",
"half_life" : 1,
"death_function":"DISINTEGRATE",
"special_attacks":[["PLANT", 500]],
"special_attacks":[["PLANT", 100]],
"description":"A mass of spores the size of a balled fist, wafting around in the air.",
"flags":["STUMBLES", "FLIES", "POISON", "NO_BREATHE", "NOHEAD", "NOGIB"]
},{
Expand Down
39 changes: 17 additions & 22 deletions src/field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,28 +1268,10 @@ bool map::process_fields_in_submap( submap *const current_submap,
case fd_fungal_haze:
dirty_transparency_cache = true;
spread_gas( cur, p, curtype, 33, 5);
int mondex;
mondex = g->mon_at( p );
if( move_cost( p ) > 0 ) {
if( mondex != -1 ) { // Haze'd!
if( !g->zombie(mondex).type->in_species("FUNGUS") &&
!g->zombie(mondex).type->has_flag("NO_BREATHE")) {
if( g->u.sees( p ) ) {
add_msg( m_info, _("The %s inhales thousands of live spores!"),
g->zombie(mondex).name().c_str());
}

monster &critter = g->zombie( mondex );
if( !critter.make_fungus() ) {
critter.die(nullptr);
}
}
}

if (one_in(5 - cur->getFieldDensity())) {
g->spread_fungus( p ); //Haze'd terrain
}
if( one_in( 10 - 2 * cur->getFieldDensity() ) ) {
g->spread_fungus( p ); //Haze'd terrain
}

break;

case fd_toxic_gas:
Expand Down Expand Up @@ -2375,12 +2357,25 @@ void map::monster_in_field( monster &z )
}
break;

case fd_fungal_haze:
if( !z.type->in_species("FUNGUS") &&
!z.type->has_flag("NO_BREATHE") &&
!z.make_fungus() ) {
// Don't insta-kill jabberwocks, that's silly
const int density = cur->getFieldDensity();
z.moves -= rng( 10 * density, 30 * density );
dam += rng( 0, 10 * density );
}

break;

default:
//Suppress warnings
break;
}
}
if (dam > 0) {

if( dam > 0 ) {
z.apply_damage( nullptr, bp_torso, dam );
z.check_dead_state();
}
Expand Down
147 changes: 73 additions & 74 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13804,82 +13804,80 @@ void game::nuke( const tripoint &p )

bool game::spread_fungus( const tripoint &p )
{
int x = p.x;
int y = p.y;
int growth = 1;
for (int i = x - 1; i <= x + 1; i++) {
for (int j = y - 1; j <= y + 1; j++) {
if (i == x && j == y) {
for( int i = p.x - 1; i <= p.x + 1; i++ ) {
for( int j = p.y - 1; j <= p.y + 1; j++ ) {
if (i == p.x && j == p.y) {
continue;
}
if (m.has_flag("FUNGUS", i, j)) {
if( m.has_flag("FUNGUS", tripoint( i, j, p.z ) ) ) {
growth += 1;
}
}
}

bool converted = false;
if (!m.has_flag_ter("FUNGUS", x, y)) {
if (!m.has_flag_ter("FUNGUS", p)) {
// Terrain conversion
if (m.has_flag_ter("DIGGABLE", x, y)) {
if (m.has_flag_ter("DIGGABLE", p)) {
if (x_in_y(growth * 10, 100)) {
m.ter_set(x, y, t_fungus);
m.ter_set(p, t_fungus);
converted = true;
}
} else if (m.has_flag("FLAT", x, y)) {
if( m.has_flag( TFLAG_INDOORS, x, y ) ) {
} else if (m.has_flag("FLAT", p)) {
if( m.has_flag( TFLAG_INDOORS, p ) ) {
if (x_in_y(growth * 10, 500)) {
m.ter_set(x, y, t_fungus_floor_in);
m.ter_set(p, t_fungus_floor_in);
converted = true;
}
} else if( m.has_flag( TFLAG_SUPPORTS_ROOF, x, y ) ) {
} else if( m.has_flag( TFLAG_SUPPORTS_ROOF, p ) ) {
if (x_in_y(growth * 10, 1000)) {
m.ter_set(x, y, t_fungus_floor_sup);
m.ter_set(p, t_fungus_floor_sup);
converted = true;
}
} else {
if (x_in_y(growth * 10, 2500)) {
m.ter_set(x, y, t_fungus_floor_out);
m.ter_set(p, t_fungus_floor_out);
converted = true;
}
}
} else if (m.has_flag("SHRUB", x, y)) {
} else if (m.has_flag("SHRUB", p)) {
if (x_in_y(growth * 10, 200)) {
m.ter_set(x, y, t_shrub_fungal);
m.ter_set(p, t_shrub_fungal);
converted = true;
} else if (x_in_y(growth, 1000)) {
m.ter_set(x, y, t_marloss);
m.ter_set(p, t_marloss);
converted = true;
}
} else if (m.has_flag("THIN_OBSTACLE", x, y)) {
} else if (m.has_flag("THIN_OBSTACLE", p)) {
if (x_in_y(growth * 10, 150)) {
m.ter_set(x, y, t_fungus_mound);
m.ter_set(p, t_fungus_mound);
converted = true;
}
} else if (m.has_flag("YOUNG", x, y)) {
} else if (m.has_flag("YOUNG", p)) {
if (x_in_y(growth * 10, 500)) {
m.ter_set(x, y, t_tree_fungal_young);
m.ter_set(p, t_tree_fungal_young);
converted = true;
}
} else if (m.has_flag("WALL", x, y)) {
} else if (m.has_flag("WALL", p)) {
if (x_in_y(growth * 10, 5000)) {
converted = true;
m.ter_set(x, y, t_fungus_wall);
m.ter_set(p, t_fungus_wall);
}
}
// Furniture conversion
if (converted) {
if (m.has_flag("FLOWER", x, y)) {
m.furn_set(x, y, f_flower_fungal);
} else if (m.has_flag("ORGANIC", x, y)) {
if (m.furn_at(x, y).movecost == -10) {
m.furn_set(x, y, f_fungal_mass);
if (m.has_flag("FLOWER", p)) {
m.furn_set(p, f_flower_fungal);
} else if (m.has_flag("ORGANIC", p)) {
if (m.furn_at(p).movecost == -10) {
m.furn_set(p, f_fungal_mass);
} else {
m.furn_set(x, y, f_fungal_clump);
m.furn_set(p, f_fungal_clump);
}
} else if (m.has_flag("PLANT", x, y)) {
} else if (m.has_flag("PLANT", p)) {
// Replace the (already existing) seed
m.i_at( x, y )[0] = item( "fungal_seeds", calendar::turn );
m.i_at( p )[0] = item( "fungal_seeds", calendar::turn );
}
}
return true;
Expand All @@ -13888,97 +13886,98 @@ bool game::spread_fungus( const tripoint &p )
if (growth == 9) {
return false;
}
for (int i = x - 1; i <= x + 1; i++) {
for (int j = y - 1; j <= y + 1; j++) {
for (int i = p.x - 1; i <= p.x + 1; i++) {
for (int j = p.y - 1; j <= p.y + 1; j++) {
tripoint dest( i, j, p.z );
// One spread on average
if (!m.has_flag("FUNGUS", i, j) && one_in(9 - growth)) {
if (!m.has_flag("FUNGUS", dest) && one_in(9 - growth)) {
//growth chance is 100 in X simplified
if (m.has_flag("DIGGABLE", i, j)) {
m.ter_set(i, j, t_fungus);
if (m.has_flag("DIGGABLE", dest)) {
m.ter_set(dest, t_fungus);
converted = true;
} else if (m.has_flag("FLAT", i, j)) {
if( m.has_flag( TFLAG_INDOORS, i, j ) ) {
} else if (m.has_flag("FLAT", dest)) {
if( m.has_flag( TFLAG_INDOORS, dest ) ) {
if (one_in(5)) {
m.ter_set(i, j, t_fungus_floor_in);
m.ter_set(dest, t_fungus_floor_in);
converted = true;
}
} else if( m.has_flag( TFLAG_SUPPORTS_ROOF, i, j ) ) {
} else if( m.has_flag( TFLAG_SUPPORTS_ROOF, dest ) ) {
if (one_in(10)) {
m.ter_set(i, j, t_fungus_floor_sup);
m.ter_set(dest, t_fungus_floor_sup);
converted = true;
}
} else {
if (one_in(25)) {
m.ter_set(i, j, t_fungus_floor_out);
m.ter_set(dest, t_fungus_floor_out);
converted = true;
}
}
} else if (m.has_flag("SHRUB", i, j)) {
} else if (m.has_flag("SHRUB", dest)) {
if (one_in(2)) {
m.ter_set(i, j, t_shrub_fungal);
m.ter_set(dest, t_shrub_fungal);
converted = true;
} else if (one_in(25)) {
m.ter_set(i, j, t_marloss);
m.ter_set(dest, t_marloss);
converted = true;
}
} else if (m.has_flag("THIN_OBSTACLE", i, j)) {
} else if (m.has_flag("THIN_OBSTACLE", dest)) {
if (x_in_y(10, 15)) {
m.ter_set(i, j, t_fungus_mound);
m.ter_set(dest, t_fungus_mound);
converted = true;
}
} else if (m.has_flag("YOUNG", i, j)) {
} else if (m.has_flag("YOUNG", dest)) {
if (one_in(5)) {
if (m.get_field_strength( tripoint(x, y, get_levz()), fd_fungal_haze) != 0) {
if( m.get_field_strength( p, fd_fungal_haze ) != 0 ) {
if (one_in(3)) { // young trees are Vulnerable
m.ter_set(i, j, t_fungus);
m.add_spawn("mon_fungal_blossom", 1, x, y);
if (u.sees(x, y)) {
add_msg(m_warning, _("The young tree blooms forth into a fungal blossom!"));
m.ter_set(dest, t_fungus);
summon_mon( "mon_fungal_blossom", p );
if (u.sees(p)) {
add_msg(m_warning, _("The young tree blooms forth into a fungal blossom!"));
}
} else if (one_in(2)) {
m.ter_set(i, j, t_marloss_tree);
m.ter_set(dest, t_marloss_tree);
}
} else {
m.ter_set(i, j, t_tree_fungal_young);
m.ter_set(dest, t_tree_fungal_young);
}
converted = true;
}
} else if (m.has_flag("TREE", i, j)) {
} else if (m.has_flag("TREE", dest)) {
if (one_in(10)) {
if (m.get_field_strength( tripoint(x, y, get_levz()), fd_fungal_haze) != 0) {
if( m.get_field_strength( p, fd_fungal_haze ) != 0) {
if (one_in(4)) {
m.ter_set(i, j, t_fungus);
m.add_spawn("mon_fungal_blossom", 1, x, y);
if (u.sees(x, y)) {
add_msg(m_warning, _("The tree blooms forth into a fungal blossom!"));
m.ter_set(dest, t_fungus);
summon_mon( "mon_fungal_blossom", p );
if (u.sees(p)) {
add_msg(m_warning, _("The tree blooms forth into a fungal blossom!"));
}
} else if (one_in(3)) {
m.ter_set(i, j, t_marloss_tree);
m.ter_set(dest, t_marloss_tree);
}
} else {
m.ter_set(i, j, t_tree_fungal);
m.ter_set(dest, t_tree_fungal);
}
converted = true;
}
} else if (m.has_flag("WALL", i, j)) {
} else if (m.has_flag("WALL", dest)) {
if (one_in(50)) {
converted = true;
m.ter_set(i, j, t_fungus_wall);
m.ter_set(dest, t_fungus_wall);
}
}

if (converted) {
if (m.has_flag("FLOWER", i, j)) {
m.furn_set(i, j, f_flower_fungal);
} else if (m.has_flag("ORGANIC", i, j)) {
if (m.furn_at(i, j).movecost == -10) {
m.furn_set(i, j, f_fungal_mass);
if (m.has_flag("FLOWER", dest)) {
m.furn_set(dest, f_flower_fungal);
} else if (m.has_flag("ORGANIC", dest)) {
if (m.furn_at(dest).movecost == -10) {
m.furn_set(dest, f_fungal_mass);
} else {
m.furn_set(i, j, f_fungal_clump);
m.furn_set(dest, f_fungal_clump);
}
} else if (m.has_flag("PLANT", i, j)) {
} else if (m.has_flag("PLANT", dest)) {
// Replace the (already existing) seed
m.i_at( x, y )[0] = item( "fungal_seeds", calendar::turn );
m.i_at( p )[0] = item( "fungal_seeds", calendar::turn );
}
}
}
Expand Down
Loading

0 comments on commit 205b560

Please sign in to comment.