Hedgehog's Spiny Status.

https://attnam.com/topics/Hedgehog-s-Spiny-Status

The Cathedral of Attnam > Other Coding

#1 Aug 10, 2014, 6:14 pm Hide

Zayre

So, I had a thought. The Hedgehog has a special effect where if you attack it unarmed, you get damaged by it's quills... Is there a way to take that effect, and apply it to certain armors; or even to certain shields?
#2 Aug 10, 2014, 8:13 pm Hide

4zb4

Probably, considering we've implemented acid shields that spill on opponents. As for how exactly I wouldn't know, my C knowledge is still lacking.
#3 Aug 10, 2014, 9:32 pm Hide

Pent

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).
#4 Aug 10, 2014, 9:43 pm Hide

4zb4

I'd really be interested in adding a bunch of novelty items along the same vein that aren't really useful but are neat uses of the code.
For example, artifact weapons that look extremely similar to the already existing ones but with typos that have bad effects - e.g. Miolak that occasionally blasts YOU, or an Eplyron that occasionally turns your arms into bananas.
#5 Aug 11, 2014, 7:23 am Hide

red_kangaroo

@Pent

Heh, wielding that spiked shield and a whip of thievery would be quite a bit of fun.
#6 Aug 12, 2014, 11:55 am Hide

Zayre

4zb4 wrote
I'd really be interested in adding a bunch of novelty items along the same vein that aren't really useful but are neat uses of the code.
For example, artifact weapons that look extremely similar to the already existing ones but with typos that have bad effects - e.g. Miolak that occasionally blasts YOU, or an Eplyron that occasionally turns your arms into bananas.

This. Much of this.
#7 Aug 12, 2014, 1:38 pm Hide

red_kangaroo

4zb4 wrote
(...) turns your arms into bananas.

Maybe Loricatus could have a chance to turn either your weapon or your arms into banana flesh when upset, to prevent the easy abuse of Loricatus Free Banana Snack?
#8 Aug 12, 2014, 2:47 pm Hide

Somagu

I feel like that's a little dramatic for a negative god effect, personally. Plus, he's a blacksmith god, so that effect would make less sense.
#9 Aug 12, 2014, 3:12 pm Hide

JoKe

Extending the effect to random pieces of armor would be a good way to make effective use of the trick much harder and would make more sense than having your arms turn to bananas.
#10 Aug 12, 2014, 3:21 pm Hide

Eagle V

Or the weapon (or armor) could be turned into spoiled banana.
#11 Aug 12, 2014, 5:06 pm Hide

4zb4

I think Eagle's method would work best to prevent the exploit. You still have the effective end result of an unusable weapon (banana) but now you only have the equivalent of a spoiled banana's worth of nutrition in your hand. Though I could complain about the fact that at least a banana weapon can be changed back, I won't because that's pretty much a waste of a SoCM in my opinion.
#12 Aug 12, 2014, 6:34 pm Hide

Pent

4zb4 wrote
I think Eagle's method would work best to prevent the exploit. You still have the effective end result of an unusable weapon (banana) but now you only have the equivalent of a spoiled banana's worth of nutrition in your hand. Though I could complain about the fact that at least a banana weapon can be changed back, I won't because that's pretty much a waste of a SoCM in my opinion.

If the weapon was +10 or something and you screwed up and turned it to banana then it could be worth a SoCM to recover it. As far as the actual trick is concerned, its usefulness is somewhat curbed by the fact that praying to a pissed off Loricatus can result in hostile angels killing you. Hunger is rarely an issue once you get past the UT anyways, so clever use of the god mechanics if you're in a bind and need food doesn't seem too bad.
#13 Aug 12, 2014, 7:14 pm Hide

4zb4

On the other hand, we're talking about IVAN here and having your +10 weapon turn into a banana because of something that would be entirely your fault does not sound out of place.
#14 Aug 12, 2014, 10:00 pm Hide

Batman?

4zb4 wrote
On the other hand, we're talking about IVAN here and having your +10 weapon turn into a banana because of something that would be entirely your fault does not sound out of place.

I second this.