summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-08-04 20:01:10 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-08-04 20:01:10 +0000
commit48334a9c4f77825eb2971183c36fbcee5a343364 (patch)
treedf226e5481465c83a3673d09b0665ae9b8e890e2 /crawl-ref/source/fight.cc
parentb7705078f8d3bd0212edef0072f89d5e06d88368 (diff)
downloadcrawl-ref-48334a9c4f77825eb2971183c36fbcee5a343364.tar.gz
crawl-ref-48334a9c4f77825eb2971183c36fbcee5a343364.zip
Finally added vampiric bite attack. Thanks to Jarmo
for the underlying patch. Only vampires can turn into vampire bats, other species transform into normal bats, so can't draw blood. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1966 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc189
1 files changed, 103 insertions, 86 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 83c306ef22..64bcaa10e9 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -863,6 +863,47 @@ bool melee_attack::player_apply_aux_unarmed()
if (mons_holiness(def) == MH_HOLY)
did_god_conduct(DID_KILL_ANGEL, 1);
+
+ // normal vampiric biting attack
+ if (damage_brand == SPWPN_VAMPIRICISM && mons_holiness(def) == MH_NATURAL)
+ {
+ const int chunk_type = mons_corpse_effect( def->type );
+
+ // don't drink poisonous or mutagenic blood
+ if (chunk_type == CE_CLEAN || chunk_type == CE_CONTAMINATED)
+ {
+ mprf( "You draw %s's blood!",
+ def->name(DESC_NOCAP_THE, true).c_str() );
+
+ if (you.hp < you.hp_max)
+ {
+ int heal = 1 + random2(damage_done);
+ if (heal > you.experience_level)
+ heal = you.experience_level;
+
+ if (chunk_type == CE_CLEAN)
+ heal += 1 + random2(damage_done);
+
+ inc_hp(heal, false);
+ mpr("You feel better.");
+ }
+
+ if (you.hunger_state < HS_ENGORGED) // always the case
+ {
+ int food_value = 0;
+ if (chunk_type == CE_CLEAN)
+ food_value = 45 + random2avg(59, 2);
+ else if (chunk_type == CE_CONTAMINATED)
+ food_value = 22 + random2avg(29, 2);
+
+ if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT)
+ food_value -= 5 + random2(16);
+
+ lessen_hunger(food_value, true);
+ }
+ did_god_conduct(DID_DRINK_BLOOD, 5 + random2(4));
+ }
+ }
}
else // no damage was done
{
@@ -1040,7 +1081,7 @@ int melee_attack::player_apply_misc_modifiers(int damage)
if (you.duration[DUR_MIGHT] > 1)
damage += 1 + random2(10);
- if (you.hunger_state == HS_STARVING)
+ if (you.hunger_state == HS_STARVING && you.species != SP_VAMPIRE)
damage -= random2(5);
return (damage);
@@ -1214,7 +1255,9 @@ int melee_attack::player_weapon_type_modify(int damage)
// All weak hits look the same, except for when the player
// has a non-weapon in hand. -- bwr
- if (damage < HIT_WEAK)
+ // Exception: vampire bats only bite to allow for drawing blood
+ if (damage < HIT_WEAK && (you.species != SP_VAMPIRE
+ || you.attribute[ATTR_TRANSFORMATION] != TRAN_BAT))
{
if (weap_type != WPN_UNKNOWN)
attack_verb = "hit";
@@ -1387,69 +1430,6 @@ bool melee_attack::player_monattk_hit_effects(bool mondied)
{
did_god_conduct(DID_UNHOLY, 1);
}
-
- if (you.species == SP_VAMPIRE && damage_brand == SPWPN_VAMPIRICISM)
- {
- if (defender->holiness() == MH_NATURAL
- && damage_done > 0 && !one_chance_in(5))
- {
- const int chunk_type = mons_corpse_effect( def->type );
-
- // don't drink poisonous or mutagenic blood
- if (chunk_type == CE_CLEAN || chunk_type == CE_CONTAMINATED)
- {
- mprf( "You draw %s's blood!",
- def->name(DESC_NOCAP_THE, true).c_str() );
-
- if (you.hp < you.hp_max)
- {
- int heal = 1 + random2(damage_done);
- if (heal > you.experience_level)
- heal = you.experience_level;
-
- if (chunk_type == CE_CLEAN)
- heal += 1 + random2(damage_done);
-
- inc_hp(heal, false);
- mpr("You feel better.");
- }
-
- if (you.hunger_state < HS_ENGORGED) // always the case
- {
- int food_value = 0;
- if (chunk_type == CE_CLEAN)
- food_value = 45 + random2avg(59, 2);
- else if (chunk_type == CE_CONTAMINATED)
- food_value = 22 + random2avg(29, 2);
-
- if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT)
- food_value -= 5 + random2(16);
-
- lessen_hunger(food_value, true);
- }
- did_god_conduct(DID_DRINK_BLOOD, 5 + random2(4));
- }
- }
- }
- else if (mondied && damage_brand == SPWPN_VAMPIRICISM)
- {
- if (mons_holiness(def) == MH_NATURAL
- && damage_done > 0 && you.hp < you.hp_max
- && !one_chance_in(5))
- {
- mpr("You feel better.");
-
- // more than if not killed
- int heal = 1 + random2(damage_done);
-
- inc_hp(heal, false);
-
- if (you.hunger_state != HS_ENGORGED)
- lessen_hunger(30 + random2avg(59, 2), true);
-
- did_god_conduct(DID_NECROMANCY, 2);
- }
- }
if (mondied)
return (true);
@@ -1759,28 +1739,65 @@ bool melee_attack::apply_damage_brand()
{
break;
}
-
- // We only get here if we've done base damage, so no
- // worries on that score.
- if (attacker->atype() == ACT_PLAYER)
- mpr("You feel better.");
- else if (attacker_visible)
+ // vampire bat form
+ if (you.species == SP_VAMPIRE && attacker->atype() == ACT_PLAYER
+ && you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT)
{
- if (defender->atype() == ACT_PLAYER)
- mprf("%s draws strength from your injuries!",
- attacker->name(DESC_CAP_THE).c_str());
- else
- mprf("%s is healed.",
- attacker->name(DESC_CAP_THE).c_str());
+ const int chunk_type = mons_corpse_effect( def->type );
+
+ // don't drink poisonous or mutagenic blood
+ if (chunk_type == CE_CLEAN || chunk_type == CE_CONTAMINATED)
+ {
+ mprf( "You draw %s's blood!",
+ def->name(DESC_NOCAP_THE, true).c_str() );
+
+ if (you.hp < you.hp_max)
+ {
+ int heal = 1 + random2(damage_done);
+ if (heal > you.experience_level)
+ heal = you.experience_level;
+
+ if (chunk_type == CE_CLEAN)
+ heal += 1 + random2(damage_done);
+
+ inc_hp(heal, false);
+ mpr("You feel better.");
+ }
+
+ if (you.hunger_state < HS_ENGORGED) // always the case
+ {
+ int food_value = 0;
+ if (chunk_type == CE_CLEAN)
+ food_value = 30 + random2avg(59, 2);
+ else if (chunk_type == CE_CONTAMINATED)
+ food_value = 15 + random2avg(29, 2);
+
+ lessen_hunger(food_value, true);
+ }
+ did_god_conduct(DID_DRINK_BLOOD, 5 + random2(4));
+ }
}
+ else { // handle weapon effects
+ // We only get here if we've done base damage, so no
+ // worries on that score.
+
+ if (attacker->atype() == ACT_PLAYER)
+ mpr("You feel better.");
+ else if (attacker_visible)
+ {
+ if (defender->atype() == ACT_PLAYER)
+ mprf("%s draws strength from your injuries!",
+ attacker->name(DESC_CAP_THE).c_str());
+ else
+ mprf("%s is healed.",
+ attacker->name(DESC_CAP_THE).c_str());
+ }
- {
int hp_boost = 0;
-
+
// thus is probably more valuable on larger weapons?
- if (weapon
- && is_fixed_artefact( *weapon )
+ if (weapon && is_fixed_artefact( *weapon )
&& weapon->special == SPWPN_VAMPIRES_TOOTH)
{
hp_boost = damage_done;
@@ -1791,12 +1808,12 @@ bool melee_attack::apply_damage_brand()
}
attacker->heal(hp_boost);
- }
- if (attacker->hunger_level() != HS_ENGORGED)
- attacker->make_hungry(-random2avg(59, 2));
-
- attacker->god_conduct( DID_NECROMANCY, 2 );
+ if (attacker->hunger_level() != HS_ENGORGED)
+ attacker->make_hungry(-random2avg(59, 2));
+
+ attacker->god_conduct( DID_NECROMANCY, 2 );
+ }
break;
case SPWPN_DISRUPTION: