summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.h
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-13 15:46:45 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-13 15:46:45 +0000
commitc32244f1ca9dfacd55040e1a61c3ff6c5c1ab4d5 (patch)
treead68b92ce822cad4a7ba541282afdeba6b7fd9c4 /crawl-ref/source/fight.h
parentd436eeaf8f01d5e9b0476254171b6a0bcc2c403d (diff)
downloadcrawl-ref-c32244f1ca9dfacd55040e1a61c3ff6c5c1ab4d5.tar.gz
crawl-ref-c32244f1ca9dfacd55040e1a61c3ff6c5c1ab4d5.zip
Remove atk and def from melee_attack.
Rewrite some code to use actor methods instead of calling things directly. In theory, attacker_as_monster() and defender_as_monster() are hacks; any calls to them that can be replaced by calls to actor methods should be. Fix some inconsistencies with monster bleeding and summoned creatures. (This should probably go into actor::can_bleed().) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8444 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.h')
-rw-r--r--crawl-ref/source/fight.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/crawl-ref/source/fight.h b/crawl-ref/source/fight.h
index b463ab75fa..30607497ae 100644
--- a/crawl-ref/source/fight.h
+++ b/crawl-ref/source/fight.h
@@ -81,17 +81,22 @@ int calc_your_to_hit( bool random_factor );
int calc_heavy_armour_penalty( bool random_factor );
unchivalric_attack_type is_unchivalric_attack(const actor *attacker,
- const actor *defender,
- const monsters *def);
+ const actor *defender);
class melee_attack
{
public:
- // At the moment this only covers players fighting monsters
actor *attacker, *defender;
- // If attacker and/or defender are monsters, these are set.
- monsters *atk, *def;
+ monsters* attacker_as_monster()
+ {
+ return dynamic_cast<monsters*>(attacker);
+ }
+
+ monsters* defender_as_monster()
+ {
+ return dynamic_cast<monsters*>(defender);
+ }
bool cancel_attack;
bool did_hit, perceived_attack, obvious_effect;
@@ -176,7 +181,7 @@ private:
void check_autoberserk();
void check_special_wield_effects();
void emit_nodmg_hit_message();
- void identify_mimic(monsters *mon);
+ void identify_mimic(actor *mon);
std::string debug_damage_number();
std::string special_attack_punctuation();