Wait, acid shields
spill acid?
I always assumed they were just effective at shielding against acid or something and never used them.
Anyways,
here's the code for the hedgehog's spine defense:
void hedgehog::SpecialBodyDefenceEffect(character* Enemy, bodypart* BodyPart, int Type)
{
if(Type != WEAPON_ATTACK && RAND() & 1)
{
if(Enemy->IsPlayer())
ADD_MESSAGE("%s spines jab your %s!", CHAR_POSSESSIVE_PRONOUN, BodyPart->GetBodyPartName().CStr());
else if(CanBeSeenByPlayer() || Enemy->CanBeSeenByPlayer())
ADD_MESSAGE("%s spines jab %s!", CHAR_POSSESSIVE_PRONOUN, Enemy->CHAR_NAME(DEFINITE));
Enemy->ReceiveBodyPartDamage(this, 1 + (RAND() & 1), PHYSICAL_DAMAGE, BodyPart->GetBodyPartIndex(), YOURSELF, false, false, true, false);
Enemy->CheckDeath(CONST_S("killed by the pointy spines of ") + GetName(INDEFINITE), this);
}
}
So basically if you hit it without a weapon you have a 50% chance of taking 1-2 damage to the bodypart you hit it with. You could easily cannibalize that code along with, say,
the acid shield's, and come up with something like this:
void spikedshield::BlockEffect(character* Blocker, character* Attacker, item* Weapon, int Type)
{
if(Type != WEAPON_ATTACK)
{
if(CanBeSeenByPlayer() || Enemy->CanBeSeenByPlayer())
ADD_MESSAGE("%s is stabbed by the spikes of the shield!", Attacker->CHAR_DESCRIPTION(DEFINITE));
/* Damage could be whatever; this is just the formula for Mjolak's bonus damage. */
Enemy->ReceiveBodyPartDamage(this, 5 + (RAND() % 6), PHYSICAL_DAMAGE, BodyPart->GetBodyPartIndex(), YOURSELF, false, false, true, false);
}
}
This example would do damage every time you block an unarmed attack (rather than the 50% chance of the hedgehog's) because punching/biting metal spikes has got to hurt. Doing something similar with armor would be a bit more complicated, since there are no armors that have effects like this, and as such you'd need to figure out where to actually place the call to the armor's retaliation function (probably in the
character::TakeHit function somewhere).