summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-abil.cc
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2009-11-13 00:51:56 -0500
committerCharles Otto <ottochar@gmail.com>2009-11-13 00:51:56 -0500
commite7d888537c4d178a98e2ef1727a84d5132655d6c (patch)
tree79fc6a8cb3a521b7c4d6a9f8fb761a12c7d6ed23 /crawl-ref/source/mon-abil.cc
parent4a7b398e339f0b55ae3ce579a02c81c2c281216d (diff)
parent8075717d132ff61257a8836ce7854f71f1eb05f8 (diff)
downloadcrawl-ref-e7d888537c4d178a98e2ef1727a84d5132655d6c.tar.gz
crawl-ref-e7d888537c4d178a98e2ef1727a84d5132655d6c.zip
Merge spore experiments branch.
Diffstat (limited to 'crawl-ref/source/mon-abil.cc')
-rw-r--r--crawl-ref/source/mon-abil.cc105
1 files changed, 105 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index 43118781d1..9d53edc726 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -1388,4 +1388,109 @@ void mon_nearby_ability(monsters *monster)
}
}
+// When giant spores move (while wandering) maybe place a spore on the
+// square they move off of.
+void ballisto_on_move(monsters * monster, const coord_def & position)
+{
+ if (monster->type == MONS_GIANT_SPORE)
+ {
+ // The number field is used as a cooldown timer for this behavior.
+ if (monster->number <= 0)
+ {
+ if (one_chance_in(4))
+ {
+ beh_type attitude = SAME_ATTITUDE(monster);
+ if(!crawl_state.arena && attitude == BEH_FRIENDLY)
+ {
+ attitude = BEH_GOOD_NEUTRAL;
+ }
+ int rc = create_monster(mgen_data(MONS_BALLISTOMYCETE,
+ attitude,
+ 0,
+ 0,
+ position,
+ MHITNOT,
+ MG_FORCE_PLACE));
+
+ if (rc != -1 && you.can_see(&env.mons[rc]))
+ mprf("A ballistomycete grows in the wake of the spore.");
+
+ monster->number = 40;
+ }
+ }
+ else
+ {
+ monster->number--;
+ }
+
+ }
+}
+
+void activate_ballistomycetes( monsters * monster)
+{
+ if(!monster || monster->type != MONS_BALLISTOMYCETE && monster->type != MONS_GIANT_SPORE)
+ return;
+
+ bool activated_others = false;
+ int seen_others = 0;
+ for(int i=0; i < int(env.mons.size()); ++i)
+ {
+ if(i != monster->mindex()
+ && env.mons[i].alive()
+ && env.mons[i].type == MONS_BALLISTOMYCETE)
+ {
+ env.mons[i].number++;
+ // 0 -> 1 means the ballisto moves onto the faster spawn
+ // timer and changes color
+ if(env.mons[i].number == 1)
+ {
+ env.mons[i].colour = LIGHTRED;
+ // Reset the spore production timer.
+ env.mons[i].del_ench(ENCH_SPORE_PRODUCTION, false);
+ env.mons[i].add_ench(ENCH_SPORE_PRODUCTION);
+ activated_others = true;
+ if(you.can_see(&env.mons[i]))
+ seen_others++;
+ }
+ }
+ }
+
+ // How to do messaging? Message on kill no matter what, only if you see
+ // other ballistos get angry, only if other ballistos get angry
+ // (seen or not). Also need a message if a ballisto suddenly becomes
+ // angry
+ if(mons_near(monster) && activated_others)
+ mprf("You feel ballistomycets on the level are angry now?");
+ else if (seen_others > 0)
+ mprf("The ballistomycete appears angry...");
+}
+
+void deactivate_ballistos()
+{
+ for(unsigned i=0;i < env.mons.size(); i++)
+ {
+ if(env.mons[i].alive()
+ && env.mons[i].type == MONS_BALLISTOMYCETE)
+ {
+ monsters * temp = &env.mons[i];
+ // Decrease the count and maybe become inactive
+ // again
+ if(temp->number)
+ {
+ temp->number--;
+ if(temp->number == 0)
+ {
+ temp->colour = MAGENTA;
+ temp->del_ench(ENCH_SPORE_PRODUCTION);
+ //temp->add_ench(ENCH_SPORE_PRODUCTION);
+ if(you.can_see(temp))
+ mprf("A nearby ballistomycete calms down.");
+ }
+ }
+
+
+ }
+ }
+}
+