First off, there’s a fair bit of code to this one. Forgive the length please, if you will. (The length is actually what I’m looking to cut down )
So I’ve got two snakes: A rattlesnake and a king snake. Both can be killed with either a gun or a shovel. (Tho I still need to work out how to make the ‘attack’ verb take a second noun to specify which to use … but I know that’s somewhere in the manual / examples)
The code works, but it seems a bit inefficient considering that the “Instead” rules for each one are virtually identical. I’m thinking it could all be consolidated (perhaps) into a single “Instead” rule attached to the “Attack” verb itself.
… Then again, perhaps making each killable thing have it’s own “Instead” rule for such makes for cleaner and more easily readable code. And easier to edit. Thoughts?
Anyhow, the code …
Chapter - The Rattlesnake
The rattlesnake is an animal. Understand "snake", "rattler", "viper", and "serpent" as the rattlesnake. The rattlesnake can be alive or dead. The rattlesnake is alive. The rattlesnake can be passive or aggressive. The rattlesnake is aggressive.
The description is "An Olive tan body with dark brown blotches across its back, unevenly fringed with white. Yep. This is one of them western rattlesnakes folks have warned you about, for sure. Quite venomous, so you best not get bit.[line break]It's tongue flicks in and out as it stares directly at you[if aggressive], rattling its tail violently, demonstrating that it is clearly irritated by your presence[end if].".
Instead of attacking the rattlesnake:
If the rattlesnake is dead:
Say "While your fear of snakes is understandable, you can't kill what's already dead.";
Rule succeeds;
If the player is carrying the shovel:
say "Well now. That's certainly one dead rattlesnake. You nearly chopped it in half with your now-bloody spade.";
Now the rattlesnake is dead;
Now the description is "The threat of the rattler still lingers over its limp body and the beauty of its diamond-patterned skin.";
Rule succeeds;
If the player is carrying the revolver:
say "With a bang, a puff of smoke, and the smell of black powder, the rattler is no more.";
Now the rattlesnake is dead;
Now the description is "Where the head and fangs of the viper once were, there is now only a charred and bloody stump.";
Rule succeeds;
Say "With what do you intend to kill it, your face?".
[Add a rumor in the saloon that bears are afraid of rattlesnakes]
Chapter - The King snake
The king snake is an animal.The printed name is "California mountain king snake". Understand "king snake", "California king snake", "California king snake", "mountain snake", "mountain king snake", "mountain king snake", "California mountain king snake", "California mountain king snake", "snake" and "serpent" as the king snake. The king snake can be alive or dead. The king snake is alive. The king snake can be passive or aggressive. It is passive.
The description is "As the saying goes, 'Red touch yellow kills a fellow. Red touch black, friend of Jack.' The red, yellow, and black bands on this snake indicate clearly that it is a California mountain king snake. Though often confused with the highly venomous coral snake, the king snake is completely harmless.".
Instead of attacking the king snake:
If the king snake is dead:
Say "While your fear of snakes is understandable, you can't kill what's already dead.";
Rule succeeds;
If the player is carrying the shovel:
say "Well now. That's certainly one dead king snake. You nearly chopped it in half with your now-bloody spade.";
Now the king snake is dead;
Now the description is "Being hewn asunder by your shovel, the pattern of its rings no longer matters.";
Rule succeeds;
If the player is carrying the revolver:
say "With a bang, a puff of smoke, and the smell of black powder, the king snake is no more.";
Now the king snake is dead;
Now the description is "There is little left of the king snake to describe.";
Rule succeeds;
Say "With what do you intend to kill it, your face?".