|
From: Jarmo K. <jar...@cs...> - 2007-07-23 12:16:20
|
On Fri, 20 Jul 2007, jp...@mi... wrote:
> One major change concerns the fighting system. I should probably have simply
> copied your methods, as I suppose you've done a lot testing. The problem was
> that I started out with an older version of you patch that was lacking biting,
> so I added that manually and when I later saw you'd added it for a later
> version I tried to merge the two versions.
> The idea is that vampires get the (new) Fangs mutation, so unarmed attacks can
> be of the biting type. For vampires in particular, 2/3 of all other unarmed
> attacks are changed to biting instead.
> These unarmed attacks are rare (at least for UC skill 2), so you hardly see it
> in the beginning of a game. When biting, there's a chance the vampire will
> attempt to draw blood depending on its hunger state (1/8 when satiated or full,
> 1/4 when hungry, 1/2 when starving), but they will never draw blood from
> poisonous or mutagenic creatures (though I think making them ignore these
> safety measures when starving could make sense). So far, I've never seen any of
> my Vampires actually drinking blood from a living creature. For bats that works
> reliably (though I dropped the probability and reduced the nutrition gain).
I have now studied this fighthing thing more closely and it looks very nice.
But there was no code to actually implement SPWPN_VAMPIRICISM effect for
auxiliary unarmed combat, it was in main attack code. Bats get
SPWPN_VAMPIRICISM brand for their main attack so that is why it was working.
It is quite confusing because attack brands are handeled in three different
places: monster dies, monster doesn't die and auxiliary unarmed.
Here is a patch that should fix SPWPN_VAMPIRICISM effect.
I also removed attack damage reduction from starving vampires.
Also for some reason there was no res_negative_energy checking in
SPWPN_VAMPIRICISM code when monsters died, so I added that too.
But no res_negative_energy checking for biting, that is not necromancy
(DID_DRINK_BLOOD vs DID_NECROMANCY).
>>>>>>>> patch starts
--- source_orig/fight.cc 2007-07-22 15:09:14.000000000 +0300
+++ source/fight.cc 2007-07-23 14:53:47.000000000 +0300
@@ -862,6 +862,46 @@
if (mons_holiness(def) == MH_HOLY)
did_god_conduct(DID_KILL_ANGEL, 1);
+
+ 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
{
@@ -1039,7 +1079,7 @@
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);
@@ -1387,9 +1427,10 @@
did_god_conduct(DID_UNHOLY, 1);
}
- if (you.species == SP_VAMPIRE && damage_brand == SPWPN_VAMPIRICISM)
+ if (mondied && damage_brand == SPWPN_VAMPIRICISM)
{
- if (defender->holiness() == MH_NATURAL
+ if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT
+ && defender->holiness() == MH_NATURAL
&& damage_done > 0 && !one_chance_in(5))
{
const int chunk_type = mons_corpse_effect( def->type );
@@ -1417,23 +1458,18 @@
{
int food_value = 0;
if (chunk_type == CE_CLEAN)
- food_value = 45 + random2avg(59, 2);
+ food_value = 30 + 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);
+ food_value = 15 + random2avg(29, 2);
lessen_hunger(food_value, true);
}
- did_god_conduct(DID_DRINK_BLOOD, 5 + random2(4));
+ did_god_conduct(DID_DRINK_BLOOD, 5 + random2(4));
}
}
- }
- else if (mondied && damage_brand == SPWPN_VAMPIRICISM)
- {
- if (mons_holiness(def) == MH_NATURAL
+ else if (mons_holiness(def) == MH_NATURAL
&& damage_done > 0 && you.hp < you.hp_max
+ && !(defender->res_negative_energy() > 0)
&& !one_chance_in(5))
{
mpr("You feel better.");
@@ -1758,44 +1794,82 @@
{
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)
+ if (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 );
- {
- int hp_boost = 0;
-
- // thus is probably more valuable on larger weapons?
- if (weapon
- && is_fixed_artefact( *weapon )
- && weapon->special == SPWPN_VAMPIRES_TOOTH)
+ // don't drink poisonous or mutagenic blood
+ if (chunk_type == CE_CLEAN || chunk_type == CE_CONTAMINATED)
{
- hp_boost = damage_done;
+ 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
+ }
+ else {
+ // 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)
{
- hp_boost = 1 + random2(damage_done);
+ 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());
}
- attacker->heal(hp_boost);
- }
+ {
+ int hp_boost = 0;
+
+ // thus is probably more valuable on larger weapons?
+ if (weapon
+ && is_fixed_artefact( *weapon )
+ && weapon->special == SPWPN_VAMPIRES_TOOTH)
+ {
+ hp_boost = damage_done;
+ }
+ else
+ {
+ hp_boost = 1 + random2(damage_done);
+ }
- if (attacker->hunger_level() != HS_ENGORGED)
- attacker->make_hungry(-random2avg(59, 2));
+ attacker->heal(hp_boost);
+ }
+
+ if (attacker->hunger_level() != HS_ENGORGED)
+ attacker->make_hungry(-random2avg(59, 2));
- attacker->god_conduct( DID_NECROMANCY, 2 );
+ attacker->god_conduct( DID_NECROMANCY, 2 );
+ }
break;
case SPWPN_DISRUPTION:
<<<<<<< patch ends
--
Jarmo Kielosto
|