diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-09-05 12:43:12 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-09-05 12:43:12 +0000 |
commit | 08935d76ee9dd29ad5f4c8a80f999df151a63f2c (patch) | |
tree | fa108607f3beb521f8ddc55e3f3396dddb7fc16f /crawl-ref/source | |
parent | 722e5bdfccde8ba11f8fc82c70ff9ba0c48ba34e (diff) | |
download | crawl-ref-08935d76ee9dd29ad5f4c8a80f999df151a63f2c.tar.gz crawl-ref-08935d76ee9dd29ad5f4c8a80f999df151a63f2c.zip |
Apply caotto's fungus lifecycle patch in [2850879].
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10623 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/beam.cc | 24 | ||||
-rw-r--r-- | crawl-ref/source/enum.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 42 | ||||
-rw-r--r-- | crawl-ref/source/monplace.cc | 15 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/spells2.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 4 |
7 files changed, 88 insertions, 13 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 735bb18e1a..2cab1bce09 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2991,9 +2991,31 @@ void bolt::affect_ground() if (is_tracer) return; + // Spore explosions might spawn a fungus. The spore explosion + // covers 21 tiles in open space, so the expected number of spores + // produced is the x in x_chance_in_y() in the conditional below. + if (is_explosion && this->flavour == BEAM_SPORE + && x_chance_in_y(2, 21) + && mons_class_can_pass(MONS_FUNGUS, env.grid(pos())) + && !actor_at(pos())) + { + int rc = create_monster(mgen_data(MONS_FUNGUS, + BEH_HOSTILE, + 0, + 0, + pos(), + MHITNOT, + MG_FORCE_PLACE)); + + if (rc != -1 && see_grid(pos())) + mpr("A fungus suddenly grows."); + } + if (affects_items) { - const int burn_power = (is_explosion) ? 5 : (is_beam) ? 3 : 2; + const int burn_power = is_explosion ? 5 : + is_beam ? 3 + : 2; expose_items_to_element(flavour, pos(), burn_power); affect_place_clouds(); } diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 634ef4fca6..b211703598 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -1286,10 +1286,11 @@ enum enchant_type ENCH_SLOWLY_DYING, ENCH_EATS_ITEMS, ENCH_AQUATIC_LAND, // Water monsters lose hp while on land. + ENCH_SPORE_PRODUCTION, // Update enchantment names in mon-util.cc when adding or removing // enchantments. - NUM_ENCHANTMENTS // 34 + NUM_ENCHANTMENTS // 35 }; enum enchant_retval diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 72acdb3c12..6324de377f 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -7568,7 +7568,6 @@ void monsters::apply_enchantment(const mon_enchant &me) break; case ENCH_SLOWLY_DYING: - // If you are no longer dying, you must be dead. if (decay_enchantment(me)) { @@ -7582,6 +7581,45 @@ void monsters::apply_enchantment(const mon_enchant &me) } break; + case ENCH_SPORE_PRODUCTION: + // Very low chance of actually making a spore on each turn. + if(one_chance_in(5000)) + { + int idx[] = {0, 1, 2, 3, 4, 5, 6, 7}; + std::random_shuffle(idx, idx + 8); + + for (unsigned i = 0; i < 8; ++i) + { + coord_def adjacent = this->pos() + Compass[idx[i]]; + if (mons_class_can_pass(MONS_GIANT_SPORE, env.grid(adjacent)) + && !actor_at(adjacent)) + { + beh_type created_behavior = BEH_HOSTILE; + + if (this->attitude == ATT_FRIENDLY) + created_behavior = BEH_FRIENDLY; + + int rc = create_monster(mgen_data(MONS_GIANT_SPORE, + created_behavior, + 0, + 0, + adjacent, + MHITNOT, + MG_FORCE_PLACE)); + + if (rc != -1) + { + env.mons[rc].behaviour = BEH_WANDER; + + if (see_grid(adjacent) && see_grid(pos())) + mpr("A nearby fungus spawns a giant spore."); + } + break; + } + } + } + break; + case ENCH_GLOWING_SHAPESHIFTER: // This ench never runs out! // Number of actions is fine for shapeshifters. if (type == MONS_GLOWING_SHAPESHIFTER || one_chance_in(4)) @@ -8332,7 +8370,7 @@ static const char *enchant_names[] = "gloshifter", "shifter", "tp", "wary", "submerged", "short-lived", "paralysis", "sick", "sleep", "fatigue", "held", "blood-lust", "neutral", "petrifying", "petrified", "magic-vulnerable", - "soul-ripe", "decay", "hungry", "flopping", "bug" + "soul-ripe", "decay", "hungry", "flopping", "spore-producing", "bug" }; static const char *_mons_enchantment_name(enchant_type ench) diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index f15b363918..8b893680ce 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -1128,13 +1128,20 @@ static int _place_monster_aux(const mgen_data &mg, if (mg.cls == MONS_TOADSTOOL) { // This enchantment is a timer that counts down until death. - // These mushrooms should last longer than the lifespan of a corpse - // (to avoid spawning mushrooms in the same place over and over), aside - // from that the value is slightly randomized to avoid simultaneous - // die-offs of mushroom rings. + // It should last longer than the lifespan of a corpse, to avoid + // spawning mushrooms in the same place over and over. Aside + // from that, the value is slightly randomised to avoid + // simultaneous die-offs of mushroom rings. menv[id].add_ench(ENCH_SLOWLY_DYING); } + if (mg.cls == MONS_FUNGUS && you.your_level > 0) + { + // This enchantment causes rare production of giant spores. + // It's disabled on D:1 to avoid issues with entry vaults. + menv[id].add_ench(ENCH_SPORE_PRODUCTION); + } + if (monster_can_submerge(&menv[id], grd(fpos)) && !one_chance_in(5)) menv[id].add_ench(ENCH_SUBMERGED); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 7dbcb3fd8b..66d017a34d 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -6013,7 +6013,8 @@ static bool _feawn_plants_on_level_hostile() { monsters *monster = &menv[i]; if (monster->alive() - && mons_is_plant(monster)) + && (mons_is_plant(monster) + || monster->mons_species() == MONS_GIANT_SPORE)) { #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Plant hostility: %s on level %d, branch %d", @@ -6470,8 +6471,7 @@ void beogh_convert_orc(monsters *orc, bool emergency, void feawn_neutralise_plant(monsters *plant) { - if ((plant->type != MONS_OKLOB_PLANT - && plant->type != MONS_WANDERING_MUSHROOM) + if ((!mons_is_plant(plant) && plant->type != MONS_GIANT_SPORE) || testbits(plant->flags, MF_ATT_CHANGE_ATTEMPT)) { return; diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index fd4116f879..e0a101c373 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -2414,8 +2414,13 @@ bool evolve_flora() current_plant->flags |= MF_CREATED_FRIENDLY; // Try to remove slowly dying in case we are upgrading a - // toadstool. + // toadstool, and spore production in case we are upgrading a + // fungus. current_plant->del_ench(ENCH_SLOWLY_DYING); + current_plant->del_ench(ENCH_SPORE_PRODUCTION); + + if (current_plant->mons_species() == MONS_FUNGUS) + current_plant->add_ench(ENCH_SPORE_PRODUCTION); // Maybe we can upgrade it again? if (_possible_evolution(current_plant, temp_conversion) diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 3e23813503..4ae707c5b3 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1022,7 +1022,9 @@ void slime_convert(monsters* monster) void feawn_neutralise(monsters* monster) { - if (you.religion == GOD_FEAWN && mons_is_plant(monster) + if (you.religion == GOD_FEAWN + && (mons_is_plant(monster) + || monster->mons_species() == MONS_GIANT_SPORE) && !mons_is_summoned(monster) && !mons_wont_attack(monster) && !testbits(monster->flags, MF_ATT_CHANGE_ATTEMPT)) |