Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LincolnGroupGameSub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lgraham6
LincolnGroupGameSub
Commits
69e788d1
Commit
69e788d1
authored
3 months ago
by
igriffith4
Browse files
Options
Downloads
Patches
Plain Diff
Add new file
parent
b602d892
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Add new file
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
combatSystem_Example
+71
-0
71 additions, 0 deletions
combatSystem_Example
with
71 additions
and
0 deletions
combatSystem_Example
0 → 100644
+
71
−
0
View file @
69e788d1
"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!"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment