diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-10-16 12:20:21 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-10-16 23:59:13 +0200 |
commit | e322a3c4051aec1761ba563e45cb62759e0c327c (patch) | |
tree | 57370bb80bc05dbd314a87a3ab4c12c5a6e73a76 /crawl-ref/source/fineff.cc | |
parent | 2ee5dd9bf5074d0a33e969f6e71310d33f339d58 (diff) | |
download | crawl-ref-e322a3c4051aec1761ba563e45cb62759e0c327c.tar.gz crawl-ref-e322a3c4051aec1761ba563e45cb62759e0c327c.zip |
Use final effects to pass kraken damage upwards.
This should avoid the rest of still notorious crashes[1], and unlike
DracoOmega's ideas, doesn't turn krakens into a boring summoner-with-a-swarm
-of-pets we have too many examples of.
(Improvements to tentacle AI and connectivity are very welcome, I just
vehemently oppose making tentacles obstacles rather than parts of the kraken
itself.)
I did not yet purge a lot of no longer needed checks, to reduce possible
conflicts.
[1]. Even though such crashes are rare now, this is what killed my record
Abyss stress test run after over a week and umpteen million turns.
Diffstat (limited to 'crawl-ref/source/fineff.cc')
-rw-r--r-- | crawl-ref/source/fineff.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crawl-ref/source/fineff.cc b/crawl-ref/source/fineff.cc index 28796bdaf9..34268a5a1a 100644 --- a/crawl-ref/source/fineff.cc +++ b/crawl-ref/source/fineff.cc @@ -77,6 +77,12 @@ bool blood_fineff::mergeable(const final_effect &fe) const return o && posn == o->posn && mtype == o->mtype; } +bool kraken_damage_fineff::mergeable(const final_effect &fe) const +{ + const kraken_damage_fineff *o = dynamic_cast<const kraken_damage_fineff *>(&fe); + return o && att == o->att && def == o->def; +} + void mirror_damage_fineff::merge(const final_effect &fe) { @@ -101,6 +107,14 @@ void blood_fineff::merge(const final_effect &fe) blood += bfe->blood; } +void kraken_damage_fineff::merge(const final_effect &fe) +{ + const kraken_damage_fineff *krakfe = + dynamic_cast<const kraken_damage_fineff *>(&fe); + ASSERT(krakfe && mergeable(*krakfe)); + damage += krakfe->damage; +} + void lightning_fineff::fire() { @@ -235,6 +249,12 @@ void blood_fineff::fire() bleed_onto_floor(posn, mtype, blood, true); } +void kraken_damage_fineff::fire() +{ + if (actor *df = defender()) + df->hurt(attacker(), damage); +} + // Effects that occur after all other effects, even if the monster is dead. // For example, explosions that would hit other creatures, but we want // to deal with only one creature at a time, so that's handled last. |