i7 / kerkerkruip

Kerkerkruip - the interactive fiction roguelike game
kerkerkruip.org
84 stars 13 forks source link

"defender is at parry" looks wrong #341

Closed mciul closed 8 years ago

mciul commented 10 years ago

Hacking up the code for #339, I removed the Fanatics of Aite, only to discover that this line in Kerkerkruip Systems no longer compiles:

            if the total damage is greater than 0 or defender is at parry:

A similar line appears later in Kerkerkruip Systems with "the defender is at parry."

I think it should be "global defender" to distinguish it from the Defender of Aite.

You know how I love phrases. How about creating a phrase to decide if "the attack is being parried?" Or to avoid problems with ranged weapons, a phrase to check whether "weapons are clashing?"

curiousdannii commented 10 years ago

Those typos would have caused some mysterious bugs!

Phrases are okay, but it doesn't make much difference in this case because there's only one global defender to check the status of.

mciul commented 10 years ago

I like phrases because they can clarify what meaning you are getting at, and that can be updated as new effects change the situation.

I see several lines that check whether the global defender is at parry. I wouldn't change the ones that involve gauntlets, but all of the others that I noticed involve contact between the global attacker weapon and the global defender weapon. I'd like to see perhaps a dynamic relation:

To decide whether (first item - a thing) is in contact with (second item - a thing):
   if second item is the global attacker weapon and first item is not the global attacker weapon, decide on whether or not second item is clashing with first item;
   if first item is not the global attacker weapon, no;
   if the global defender is at parry and the second item is the global defender weapon, yes;
   if the total damage is greater than 0 and the second item is the global defender, yes;
   no.

Clashing relates a thing (called the first weapon) to a thing (called the second weapon) when the first weapon is in contact with the second weapon. The verb to be making contact with implies the clashing relation.

Now (I think) you can say "if an electricity thing is making contact with an iron thing" or "if the scythe of oxidation is making contact with an iron thing" or "the claymore is making contact with a weapon" or "if the global attacker weapon is making contact with something, say 'Weakened by heat, [the global attacker weapon] [are] destroyed!'"

mciul commented 9 years ago

I'm working on a phrase that will work in most of these cases without wasting a lot of time. You can check out what I've done in this branch:

https://github.com/i7/kerkerkruip/commit/2d951711741677aec38f585b65ffd698516bfabf#diff-3

I have a question about how weapon contact should behave, though. For example, suppose you've read a protection scroll, and you parry an attack from Fafhrd. Fafhrd beats your defence rating, but the protection reduces his damage to 0. If I'm reading the code right, this will trigger the claymore's special power and could shatter your weapon. In this case, I think the question goes to how protection works: Does the spell cause your defensive move to succeed retroactively? Or does it simply cancel the damage that the attacker's weapon is doing to your body? In the former case, it would be fine for your weapon to be destroyed by the claymore, but in the latter case, it doesn't make sense.

How do you think this situation should behave?

mciul commented 9 years ago

Here's another borderline question about weapon contact:

If you parry the chain golem with the scythe of oxidation, the lashing chains rust, but the chain golem does not. Likewise, if you hit the chain golem with the scythe of oxidation, the chain golem rusts but the lashing chains don't. Do you think that's right?

Hmm... that actually looks like the same behavior as for the unguentum argenti. Unless I'm wrong... what is the thinking here?

VictorGijsbers commented 9 years ago

I'm thinking of the protection spell this way: it activates when you get hit, and then cancels the damage. This means that the current interaction with the claymore is wrong -- when protection fires, the parry was unsuccessful, and the weapon shouldn't break. So I think it needs to be changed.

In general, we are using damage = 0 as a condition for whether the attack hit, and perhaps we shouldn't do that.

As for the chain golem, I guess there's something to say for having them both rust at the same time.

mciul commented 9 years ago

I think I can fix the protection problem, but I am going to add a global variable called "the attack hit" or something like that. I've been adding code to Kerkerkruip Attack Additions, but I'll put them in Inform ATTACK if you prefer.

But I'll put off any chain golem changes till I have everything else working...

mciul commented 9 years ago

I seem to have discovered a bug in the scythe of oxidation. What I said earlier wasn't quite right: If the chain golem parries you, the chains rust as you'd expect. But if you parry the chain golem, you get a very weird result:

Rolling 4 + 1 (inherent bonus) - 2 (defender parrying) + 1 (parrying with the scythe of oxidation) = 4, the chain golem does not overcome your defence rating of 50.

Having hit the scythe of oxidation, you rust!

I will fix that when I refactor the scythe to use my new phrase.

Hmm... fixing that had unexpected results. The chains are considered a ranged weapon, so the phrase I wrote does not consider them to have touched the scythe of oxidation. So - are the chain golem's chains really a ranged weapon? Can they be parried? Do they remain in contact with the chain golem or are they flung away permanently? Do we have to have a distinction between "shooting" ranged weapons and "whip" ranged weapons?

And does the chain golem ever choose to parry? Is it allowed to parry with the chains?

mciul commented 9 years ago

I found another clue about the chain golem:

Aftereffects rule (this is the lion's shield rule):
    if the global defender wears the lion's shield and the global defender is at-block:
        if the total damage is 0:
            if the global attacker weapon is not ranged or the global attacker weapon is a natural weapon:

This seems to suggest that the chains do remain connected to the chain golem. I don't know whether this can be generalized or if we should always make exceptions for natural ranged weapons. But I'm going to add this clause to my phrase.

curiousdannii commented 9 years ago

Maybe we should add a third category: melee, ranged and projectile. Ranged would be for rope or chain like things, while projectile would be for weapons that break contact with the user.

mciul commented 9 years ago

That would allow us to make a distinction between Bodmall's natural weapon and the chain golem's natural weapon. I don't like adding more weapon properties, though!

curiousdannii commented 9 years ago

I wasn't thinking a new property but instead changing the ranged property to three way value. We could use some definitions so that for most of the code ranged and projectile could be grouped so that only the code that needs to distinguish them would have to be changed. (I.e., call the values melee, connected and projectile, and have a phrase saying Definition: a weapon is ranged if it is connected or projectile.)

mciul commented 9 years ago

Ok, I think I'm going to do this. Any objection to calling it 'hand-to-hand' instead of melee, just so we don't overload the melee property?

VictorGijsbers commented 9 years ago

Nope, sounds good.

mciul commented 9 years ago

Oh, and how about calling the middle one 'tethered' and make 'ranged' into an adjective meaning 'tethered or projectile?'

VictorGijsbers commented 9 years ago

I like that.

mciul commented 9 years ago

Ok, mostly done. I'm just pondering one thing: Israfel's fires, the lion's shield, and the armour of thorns all do damage to the attacker if the attacker got close enough. The question is, did the chain golem get close enough? Does a tethered weapon make the attacker vulnerable only if it is a natural weapon?

VictorGijsbers commented 9 years ago

It seems logical that a tethered weapon only makes you vulnerable if it is a natural weapon, yes. So that would hold for the chain golem.

mciul commented 9 years ago

Ok, I think I'm finally done with this. Let me know if I wrecked anything! :)

mciul commented 9 years ago

Hmmm... actually I think there's still some cleanup to do, but the tests are passing at least.

mciul commented 9 years ago

Another question: Right now Israfel's flames and the armour of thorns do damage if the attacker did damage. Should they also do damage if the attack hit but the damage was reduced to 0?

mciul commented 9 years ago

Heat code in Kerkerkruip Systems needs an update.

mciul commented 8 years ago

I was right. If you search for "defender is at parry" you'll find two offending instances in the heat can cause weapons to break rule. I think the glass cannon could use an update in this regard as well, and maybe the greasy gauntlets.

Hmmm.... I don't know when this happened, but currently the code for the glass cannon looks like this:

        if the global defender is at parry and the total damage is 0:
            if a random chance of total damage in 10 succeeds:
                say "The impact [bold type]shatters the glass cannon[roman type].";
                remove the glass cannon from play;
            otherwise:
                say "The glass cannon [bold type]survives the impact[roman type], but barely.";
                decrease weapon damage bonus of glass cannon by 2.

"a random chance of total damage in 10" never succeeds when the total damage is 0...

mciul commented 8 years ago

I think this is all done now!