(text-color: yellow)[COMBAT (EN) `** Version 1.1.42 **`<br>(c) Thierry Videlaine - February-April 2020<hr>]
In the forest
You're walking along a path, at the heart of the forest.
[[Continue->Clearing]]{
(set: $CoupeCoupe to (dm:
"Name","his short sword",
"Room", "Goblin",
"Kind", "W",
"MAXDAMAGE", 6,
"S1", "--",
"F1", "--",
"S2", (a: "ND001", "ND002", "ND003"),
"F2", (a: "NE001", "NE002", "NE003"),
))
(set: $Dagger01 to (dm:
"Name", "a dagger",
"Room", "Player",
"Kind", "W",
"MAXDAMAGE", 6,
"S1", (a: "NB004", "NB001"),
"F1", (a: "Nc001", "Nc004"),
"S2", "--",
"F2", "--",
))
(set: $Dagger02 to (dm:
"Name", "a kobold dagger",
"Room", "--",
"Kind", "W",
"MAXDAMAGE", 4,
"S1", "--",
"F1", "--",
"S2", (a: "ND005"),
"F2", (a: "NE002"),
))
(set: $Feet to (dm:
"Name", "your feet",
"Room", "--",
"Kind", "W",
"MAXDAMAGE", 4,
"S1", (a: "NB005"),
"F1", (a: "Nc005"),
"S2", (a: "ND004"),
"F2", (a: "NE001", "NE003"),
))
(set: $Shield to (dm:
"Name", "his shield",
"Room", "Kobold03",
"Kind", "W",
"MAXDAMAGE", 4,
"S1", "--",
"F1", "--",
"S2", (a: "ND006"),
"F2", (a: "NE004"),
))
(set: $Sword01 to (dm:
"Name","your sword",
"Room", "Player",
"Kind", "W",
"MAXDAMAGE", 8,
"S1", (a: "NB001", "NB002", "NB003"),
"F1", (a: "Nc001", "Nc002", "Nc003"),
"S2", "--",
"F2", "--",
))
(set: $Goblin to (dm:
"Name", "the goblin",
"Room", "Clearing",
"Kind", "M",
"W", (a: $CoupeCoupe, $Feet),
"AC", 13,
"HP", 20,
"MaxHP", 20,
"Shield", 0,
"Panic", -1,
"PanicMsg", 0,
"ScoreValue", 50,
))
(set: $Kobold01 to (dm:
"Name", "the small kobold",
"Room", "Duel02",
"Kind", "M",
"W", (a: $Dagger02),
"AC", 10,
"HP", 10,
"MaxHP", 10,
"Shield", 0,
"Panic", 3,
"PanicMsg", "NF001",
"ScoreValue", 25,
))
(set: $Kobold02 to (dm:
"Name", "the big kobold",
"Room", "Duel02",
"Kind", "M",
"W", (a: $Dagger02, $Feet),
"AC", 10,
"HP", 12,
"MaxHP", 12,
"Shield", 0,
"Panic", -1,
"PanicMsg", 0,
"ScoreValue", 25,
))
(set: $Kobold03 to (dm:
"Name", "the fat kobold",
"Room", "Duel02",
"Kind", "M",
"W", (a: $Dagger02, $Shield),
"AC", 10,
"HP", 14,
"MaxHP", 14,
"Shield", 1,
"Panic", -1,
"PanicMsg", 0,
"ScoreValue", 30,
))
(set: $Vial to (dm:
"Name", "a vial full of elixir",
"Room", "--",
"Kind", "T",
))
(set: $Gold to (dm:
"Name", "30 gold pieces",
"Room", "--",
"Kind", "T",
))
(set: $Objects to (dm:
"Dagger01", $Dagger01,
"Dagger02", $Dagger02,
"Feet", $Feet,
"Goblin", $Goblin,
"Kobold01", $Kobold01,
"Kobold02", $Kobold02,
"Kobold03", $Kobold03,
"Shield", $Shield,
"Sword01", $Sword01,
"CoupeCoupe", $CoupeCoupe,
"Vial", $Vial,
"Gold", $Gold,
))
(set: $Numbers to (a: 0, 0))
(set: $Enemies to (a:))
(set: $CombatHeader to (a:))
(set: $Debug to 0)
(set: $Events to (a:))
(set: $Foe to 0)
(set: $InLoop to 0)
(set: $LocAfter to "")
(set: $MaxScore to 170)
(set: $Panicked to 0)
(set: $Picked to "---")
(set: $Places to (a:))
(set: $R01 to 0)
(set: $R02 to 0)
(set: $RoomBack to 0)
(set: $Score to 0)
(set: $AttackRoll to 0)
(set: $Choice to 0)
(set: $List to 0)
(set: $myCombat01 to 0)
(set: $Opponent to 0)
(set: $Parry to 0)
(set: $SkipBlow to 0)
(set: $HisAC to 0)
(set: $HisHP to 0)
(set: $HisMaxHP to 0)
(set: $HisMaxDamage to 0)
(set: $HisName to "")
(set: $HisScorevalue to 0)
(set: $HisWeapon to 0)
(set: $PlayerAC to 14)
(set: $PlayerHP to 30)
(set: $PlayerMaxHP to 30)
(set: $PlayerMaxDamage to 8)
(set: $PlayerW to (a: $Sword01, $Dagger01, $Feet))
(set: $PlayerWeapon to $Sword01)
(set: $Title to "The combat begins")
(display: "Populate")
}
A clearing<hr>
You have reached a small clearing and you have stopped to take a break, when the (link-reveal: "goblin")[(show: ?1)] comes out from behind a tree.
{|1)[(text-color: magenta)[The goblin is a dirty little man with long, greasy, grimy hair, with long pointed ears, wearing a loincloth, breeches and old leather sandals, who awakens your immediate repulsion. He has a short sword, which he draws straight away, and he looks at you, grumbling.
<br>]]}
\Obviously, you'll have to fight.\
(set: $Opponent to $Goblin)
(display: "Setup Opponent")
[[Continue->Duel01]]$Title<hr>
{
(display: "Combat01")
(set: $Title to "The fight goes on")}
(if: $HisHP < 1)[
(set: $myCombat01 to 0)
[[Continue->ClearingA]]
]
(else-if: $PlayerHP < 1)[
(set: $myCombat01 to 0)
(link: "Quit")[(go-to: "Game Over")]
]
(else:)[
|1>[]
]
{
(if: $myCombat01 is 1)[
(replace: ?1)[
What do you want to do?<br>
<br>[[Keep fighting->Duel01]]
<br>(link: "Change weapon")[(display: "Pick Your Weapon")]
]
]
}{
(set: $CombatHeader to (a: "NA001", "NA002", "NA003"))
(set: _s1 to (either: ...$CombatHeader))
(set: _s2 to _s1 of $Printouts)
_s2
(set: $myCombat01 to 1)
(display: "Fight")
}{
(set: _initiative to (either: 1, 2, 3, 4, 5, 6))
(if: _initiative < 4)[
(display: "His Attack")
(display: "Your Attack")
]
(else:)[
(display: "Your Attack")
(display: "His Attack")
]
(if: $PlayerHP < 1)[<br><br>He got you ! You're dead, now.]
(else:)[
(if: $HisHP > 0)[
<br>Your opponent has $HisHP hit points left, out of a maximum $HisMaxHP.
]
(else:)[
<br>Congratulations, you got him! He's dead.
(set: $Score to it + $HisScoreValue)
]]
}{
(if: $SkipBlow is 0)[
(if: $PlayerHP > 0)[
(set: _S1 to $PlayerS1)
(set: _K to (either: ..._S1))
(set: _Msg to _K of $Printouts)
<br>_Msg
(set: $AttackRoll to (random: 1, 20))
(if: $AttackRoll >= $HisAC)[
(set: _Damage to (random: 1, $PlayerMaxDamage))
<br>You hit him, causing _Damage point(s) of damage.
(set: $HisHP to it - _Damage)
]
(else:)[
(set: _F1 to $PlayerF1)
(set: _K to (either: ..._F1))
(set: _Msg to _K of $Printouts)
<br>_Msg
]]]
(else:)[(set: $SkipBlow to 0)]
}
<h2>Game Over</h2>
{
(if: $HisHP > 0)[
(display: "Pick His Weapon")
(set: $AttackRoll to (random: 1, 20))
(if: $AttackRoll >= $PlayerAC)[
(set: _S2 to S2 of $HisWeapon)
(set: _K to (either: ..._S2))
(set: _Msg to _K of $Printouts)
<br>_Msg
(set: _Damage to (random: 1, $HisMaxDamage))
<br>He hits you, causing _Damage point(s) of damage.
(set: $PlayerHP to it - _Damage)
]
(else:)[
(set: _F2 to F2 of $HisWeapon)
(set: _K to (either: ..._F2))
(set: _Msg to _K of $Printouts)
<br>_Msg
]]
}{
(if: $PlayerHP < 0)[(set: $PlayerHP to 0)]
(replace:?Sidebar)[<br>Hit Points : $PlayerHP out of $PlayerMaxHP<br>]
(set: _names to (datanames: $Objects))
(if: length of _names > 0)[
(append: ?Sidebar)[<br>You have:]
(for: each _name, ..._names)[
(set: _Thing to _name of $Objects)
(if: Room of _Thing is "Player")[
(set: _s to Name of _Thing)
(append: ?Sidebar)[<br> - _s]
]
]
]
(append: ?Sidebar)[<br><br>Your score: $Score out of $MaxScore]
}{
(set: $Printouts to (dm:
"NA001", "Keeping your eyes on your opponent, you slowly turn around each other.",
"NA002", "He steps forward, his eyes fixed on you and foaming with rage.",
"NA003", "You have no illusions: it is a fight to the death.",
"NB000", "--",
"NB001", "You attack him.",
"NB002", "You change your blade's hand and you strike him.",
"NB003", "You strike him with your sword !",
"NB004", "You attack him with your dagger !",
"NB005", "You give him a big kick !",
"NC000", "--",
"Nc001", "You attack, but he manages to parry your blow.",
"Nc002", "You try to strike him, but you miss.",
"Nc003", "He skillfully dodges your attack. The guy is agile!",
"Nc004", "He steps back and keeps out of range.",
"Nc005", "But he avoids it.",
"ND000", "--",
"ND001", "He tries a jab.",
"ND002", "He lunges forward.",
"ND003", "He strikes with his short sword !",
"ND004", "He tries a swift kick!",
"ND005", "He strikes with his dagger!",
"ND006", "He hits you in the face with his shield!",
"NE000", "--",
"NE001", "His attack is clumsy and he misses you.",
"NE002", "You step backward, staying out of reach.",
"NE003", "Fortunately, you avoid his attack.",
"NE004", "He tries to hit you with his shield, but you step back.",
"NF000", "--",
"NF001", "He's had enough and he runs away, yelping.",
))
}{
(set: $HisAC to AC of $Opponent)
(set: $HisHP to HP of $Opponent)
(set: $HisMaxHP to MaxHP of $Opponent)
(set: $HisScoreValue to ScoreValue of $Opponent)
(set: $HisShield to Shield of $Opponent)
(set: $HisPanic to Panic of $Opponent)
(set: $HisPanicMsg to PanicMsg of $Opponent)
(set: $PlayerMaxDamage to MAXDAMAGE of $PlayerWeapon)
(set: $PlayerS1 to S1 of $PlayerWeapon)
(set: $PlayerF1 to F1 of $PlayerWeapon)
(set: $List to (a: "---"))
(for: each _item, ...$PlayerW)[
(set: $List to it + (a: Name of _item))
]
}{
(set: _s to "You pick: ")
_s (dropdown: bind $Choice, ...$List)
(event: when $Choice is not "---")[
(set: $SkipBlow to 1)
(if: $Choice is "your sword")[
(set: $PlayerWeapon to (1) of $PlayerW)
]
(else-if: $Choice is "a dagger")[
(set: $PlayerWeapon to (2) of $PlayerW)
]
(else-if: $Choice is "your feet")[
(set: $PlayerWeapon to (3) of $PlayerW)
]
(set: $PlayerMaxDamage to MAXDAMAGE of $PlayerWeapon)
(set: $PlayerS1 to S1 of $PlayerWeapon)
(set: $PlayerF1 to F1 of $PlayerWeapon)
]
}
{
(set: _weapons to W of $Opponent)
(set: $HisWeapon to (either: ..._weapons))
(set: $HisMaxDamage to MAXDAMAGE of $HisWeapon)
}In a clearing<hr>
You can see the goblin's body.
[[Go to East->M13]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to North->M09]]
[[Go to West->ClearingA]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to South->M13]]
[[Go to North->M05]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to North->M01]]
[[Go to South->M09]]
[[Go to East->M06]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to East->M02]]
[[Go to South->M05]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to East->M03]]
[[Go to West->M01]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to West->M02]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to South->M08]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to East->M07]]
[[Go to West->M05]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to East->M08]]
[[Go to West->M06]]
[[Go to South->M11]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to North->M04]]
[[Go to West->M07]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to North->M07]]
[[Go to South->M15]]
[[Go to East->M12]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to West->M14]]
[[Go to North->M11]]
[[Go to East->M16]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
[[Go to West->M11]]
[[Go to East->Path]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to East->M15]]
[[Go to North->M10]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to West->M15]]In a thick undergrowth<hr>
Narrow passages, twisty, muddy and all alike, look like the only way of making progress.
{|1>[]<br>|2>[]}
[[Go to South->M14]]{
(set: $Places to (a: "M01", "M02", "M03", "M04", "M05", "M06", "M07", "M08", "M09", "M10", "M11", "M13", "M14", "M15", "M16"))
(set: _N to $Places's length)
(set: _X to (random: 1, _N))
(set: _St to (_X) of $Places)
(set: Room of (Vial of $Objects) to _St)
(set: $Places to it - (a: _St))
(set: _N to $Places's length)
(set: _X to (random: 1, _N))
(set: _St to (_X) of $Places)
(set: Room of (Gold of $Objects) to _St)
(set: $Places to it - (a: _St))
}(if: $Debug is 1)[
(text-color: magenta)[
`*** DEBUG ***`
Vial of $Objects
]
]
{
(set: _R to (passage:))
(set: _N to name of _R)
(if: _N is Room of (Vial of $Objects))[
(set: _C to Name of (Vial of $Objects))
(set: _C to "<br>You can see " + it + ".")
(replace: ?1)[_C<br><br>]
(append: ?1)[
(link: "Take the vial")[
(set: $Events to it + (a: (dm:
"Delay", 3,
"Room", "Drink Elixir",
"Msg", "Drink the elixir",
)))
(set: Room of (Vial of $Objects) to "Player")
(replace: ?1)[]
(go-to: _N)
]
]
]
}{
(set: _R to (passage:))
(set: _N to name of _R)
(if: _N is Room of (Gold of $Objects))[
(set: _C to Name of (Gold of $Objects))
(set: _C to "<br>You can see " + it + ".")
(replace: ?1)[_C<br><br>]
(append: ?1)[
(link: "Take the gold pieces")[
(set: Room of (Gold of $Objects) to "Player")
(replace: ?1)[]
(set: $Score to it + 30)
(go-to: _N)
]
]
]
}{
You drink the elixir and you feel much better!
(set: $PlayerHP to $PlayerMaxHP)
(set: $Score to it + 10)
(set: Room of (Vial of $Objects) to "--")
}{
(if: length of $Events > 0)[
(set: $R02 to length of $Events)
(set: $R01 to 1)
(live: 10ms)[
(set: _EV to ($R01) of $Events)
(set: _D to Delay of _EV)
(set: _D to _D - 1)
(if: _D is 0)[
(set: $Events to it - (a: ($R01) of $Events))
(if: Room of _EV is "--")[
(set: _S1 to Msg of _EV)
(append: ?1)[_S1]
]
(else:)[
(set: _S1 to Msg of _EV)
(set: _S2 to Room of _EV)_
(append: ?2)[(link: _S1)[(display: _S2)]
]
]
(set: $R02 to length of $Events)
(if: $R02 > 0)[(set: $R01 to 1)]
(else:)[(stop:)]
]
(else:)[
(set: Delay of _EV to _D)
(set: ($R01) of $Events to _EV)
(set: $R01 to $R01 + 1)
(if: $R01 > $R02)[(stop:)]
]
]
]
}Walking<hr>
You are walking along a narrow path.
{|1>[]<br>|2>[]}
[[Go to West->M12]]
[[Go to East->Path01]]In front of a menhir<hr>
{
|1>[]<br><br>|2>[]
(if: (1) of $Numbers is 0)[
(set: $CombatHeader to (a: "NA001", "NA002", "NA003"))
(set: $Enemies to (a: "Kobold01", "Kobold02", "Kobold03"))
(set: $LocAfter to "Path02")
(set: (1) of $Numbers to 1)
(set: $Fighting to 1)
]
(if: $Fighting is 1)[
(if: $Picked is "---")[(set: $HisName to (either: ...$Enemies))]
(else:)[
(set: $HisName to $Picked)
(set: $Picked to "---")
]
(set: $Opponent to $HisName of $Objects)
(display: "Setup Opponent")
(display: "Next Turn")
(set: (2) of $Numbers to (random: 1, 6))
(if: (2) of $Numbers < 4)[(display: "Fight01")]
(else:)[(display: "Fight02")]
]
(if: $Fighting is 1)[
(append: ?2)[
<br><br>What do you want to do?
<br>[[Keep fighting->Duel02]]
<br>(link: "Change weapon")[(display: "Pick Your Weapon")]
(if: length of $Enemies > 1)[
<br>(link: "Choose your opponent")[(display: "Pick Foe")]
]
<br>(link: "Parry the next blow")[
(set: $SkipBlow to 1)
(set: $Parry to 4)
]
<br>(link: "Run Away")[(go-to: "Abandon")]
]
]
}$Numbers
========
1 = Duel02 ( Room )
2 = Initiative in a fight
{
(set: _S1 to (Name of $HisName of $Objects))
(set: _S1 to "You are facing " + it + ".")
(set: _S2 to (either: ...$CombatHeader))
(set: _S2 to (_S2 of $Printouts))
(replace: ?1)[_S1<br>_S2]
}{
(set: $Panicked to 0)
(display: "You Attack")
(set: (HP of $Opponent) to $HisHP)
(set: ($HisName of $Objects) to $Opponent)
(if: $Panicked is 0)[
(display: "Pick His Weapon")
(display: "He Attacks")
]
}In front of a menhir<hr>
You can see the dead kobolds.{
(if: $SkipBlow is 0)[
(if: $PlayerHP > 0)[
(set: _S1 to $PlayerS1)
(set: _K to (either: ..._S1))
(set: _Msg to _K of $Printouts)
(append: ?1)[<br><br>_Msg]
(set: _N to $HisAC)
(if: $HisShield is 1)[(set: _N to it + 2)]
(set: $AttackRoll to (random: 1, 20))
(if: $AttackRoll >= _N)[
(set: _Damage to (random: 1, $PlayerMaxDamage))
(append: ?1)[<br>You hit him, causing _Damage point(s) of damage.]
(set: $HisHP to it - _Damage)
]
(else:)[
(set: _F1 to $PlayerF1)
(set: _K to (either: ..._F1))
(set: _Msg to _K of $Printouts)
(append: ?1)[<br>_Msg]
]]]
(else:)[(set: $SkipBlow to 0)]
(if: $HisHP > 0)[
(append: ?1)[<br><br>Your opponent has $HisHP hit points left, out of a maximum $HisMaxHP.]
(if: ($HisPanic > -1) and ($HisHP <= $HisPanic))[
(set: $Panicked to 1)
(set: _St to $HisPanicMsg of $Printouts)
(append: ?1)[<br><br>_St]
(display: "Remove Opponent")
]
]
(else:)[
(append: ?1)[<br><br>Congratulations, you got him! He's dead.]
(display: "Remove Opponent")
]
}In front of a menhir<hr>
Three kobolds were hidden behind the menhir and now they step forward and come at you, sneering.
Kobolds are made in three sizes, this year: small, big and fat. Obviously the fat one is the chief, because he has a shield.
[[Continue->Duel02]]{
(set: $Score to it + $HisScoreValue)
(set: $Enemies to it - (a: $HisName))
(if: length of $Enemies is 0)[
(replace: ?2)[(link: "Continue")[(go-to: $LocAfter)]]
(set: $Fighting to 0)
]
}{
(if: $HisHP > 0)[
(if: $Parry > 0)[(set: $PlayerAC to it + $Parry)]
(set: $AttackRoll to (random: 1, 20))
(if: $AttackRoll >= $PlayerAC)[
(set: _S2 to S2 of $HisWeapon)
(set: _K to (either: ..._S2))
(set: _Msg to _K of $Printouts)
(append: ?1)[<br><br>_Msg]
(set: _Damage to (random: 1, $HisMaxDamage))
(append: ?1)[<br>He hits you, causing _Damage point(s) of damage.]
(set: $PlayerHP to it - _Damage)
]
(else:)[
(set: _F2 to F2 of $HisWeapon)
(set: _K to (either: ..._F2))
(set: _Msg to _K of $Printouts)
(append: ?1)[<br><br>_Msg]
]]
(if: $Parry > 0)[
(set: $PlayerAC to it - $Parry)
(set: $Parry to 0)
]
}{
(display: "Pick His Weapon")
(display: "He Attacks")
(display: "You Attack")
(set: (HP of $Opponent) to $HisHP)
(set: ($HisName of $Objects) to $Opponent)
}{
(set: $List to (a: "---"))
(for: each _item, ...$Enemies)[
(set: $Foe to _item of $Objects)
(set: $List to it + (a: Name of $Foe))
]
(set: _s to "You attack: ")
_s (dropdown: bind $Choice, ...$List)
(event: when $Choice is not "---")[
(if: $Choice is "the small kobold")[(set: $Picked to "Kobold01")]
(else-if: $Choice is "the big kobold")[(set: $Picked to "Kobold02")]
(else-if: $Choice is "the fat kobold")[(set: $Picked to "Kobold03")]
]
}Oh, but you can't just run away like that...
<h2>Game Over<h2>