Skip to content
Snippets Groups Projects
Commit 69e788d1 authored by igriffith4's avatar igriffith4
Browse files

Add new file

parent b602d892
No related branches found
No related tags found
1 merge request!2Add new file
"Combat System with Counterattack" by Isaiah Griffith
The Arena is a room. "You are in the arena, ready for battle."
A person has a number called defense-value. The defense-value of a person is usually 5.
The player has a number called health. The health of the player is 100.
The player carries a weapon. The weapon has a number called damage-value. The damage-value of the weapon is usually 10.
A person has a number called health. The health of a person is usually 100.
The goblin is a person in the Arena. The defense-value of the goblin is 3. The health of the goblin is 50.
The ogre is a person in the Arena. The defense-value of the ogre is 7. The health of the ogre is 80.
Attacking someone with is an action applying to one visible thing and one carried thing.
Understand "attack [someone] with [something]" as attacking someone with.
Checking health is an action without any visible thing.
Understand "check health" as checking health.
Carry out checking health:
say "You have [health of the player] health remaining.";
Carry out attacking someone with:
if the noun is not a person:
say "You can't attack that!";
otherwise:
let target be the noun;
let attack-roll be a random number from 1 to 10;
say "You roll [attack-roll] to hit [target].";
if attack-roll > the defense-value of the target:
say "Hit! You deal [damage-value of the second noun] damage.";
decrease the health of the target by the damage-value of the second noun;
if the health of the target is 0 or the health of the target is less than 0:
say "[The target] has been defeated!";
remove the target from play;
otherwise:
say "[The target] dodges your attack!";
After attacking someone with:
if the goblin is in the Arena:
goblin-counterattacks;
if the ogre is in the Arena:
ogre-counterattacks;
To goblin-counterattacks:
let goblin-attack-roll be a random number from 1 to 10;
if goblin-attack-roll > the defense-value of the player:
let goblin-damage be a random number from 5 to 10;
say "The goblin strikes back and deals [goblin-damage] damage to you!";
decrease the health of the player by goblin-damage;
if the health of the player is 0 or the health of the player is less than 0:
end the story saying "You have been defeated by the goblin!";
otherwise:
say "The goblin tries to hit you, but misses!";
To ogre-counterattacks:
let ogre-attack-roll be a random number from 1 to 10;
if ogre-attack-roll > the defense-value of the player:
let ogre-damage be a random number from 8 to 15;
say "The ogre charges at you and deals [ogre-damage] damage!";
decrease the health of the player by ogre-damage;
if the health of the player is 0 or the health of the player is less than 0:
end the story saying "You have been defeated by the ogre!";
otherwise:
say "The ogre swings, but you dodge just in time!";
When play begins:
say "You face a goblin and an ogre. Prepare to attack!"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment