Skip to content

Instantly share code, notes, and snippets.

@anthonyronda
Last active January 29, 2020 10:08
Show Gist options
  • Save anthonyronda/015eb06cc9975c6f3b8e6f19bf56fcdf to your computer and use it in GitHub Desktop.
Save anthonyronda/015eb06cc9975c6f3b8e6f19bf56fcdf to your computer and use it in GitHub Desktop.
A combat example in ink
#title:Wuxia Kombat
#author:Anthony Ronda
#theme:dark
VAR my_health = 10
VAR enemy_health = 10
VAR my_dex = 11
VAR enemy_dex = 13
VAR my_stam = 5
VAR enemy_stam = 5
VAR my_str = 14
VAR enemy_str = 10
VAR attack_dmg = 0
VAR my_attack_spd = 0
VAR pinned = false
VAR second_swing = false
->battle
=== battle ===
I'm squaring up with the enemy.->roll_initiative
= roll_initiative
{characteristic_test(my_dex,enemy_dex):My speed gave me the first swing!->my_attack|The enemy moved with a greater initiative!->enemy_attack}
= my_attack
{my_stam==0:<> Those heavy attacks wore me out...{alter(my_attack_spd,-1)}}
{second_swing:Attack one:}
+ [Light punch]
~ attack_dmg = RANDOM(1,2)
~ alter(my_attack_spd, 2)
+ {my_stam && not pinned} [Heavy punch]
~ my_stam--
~ attack_dmg = RANDOM(2,4)
~ alter(my_attack_spd, 1)
+ [Light kick]
~ attack_dmg = RANDOM(2,3)
~ alter(my_attack_spd, 2)
+ {my_stam} [Heavy kick]
~ my_stam--
~ attack_dmg = RANDOM(3,4)
~ alter(my_attack_spd, -1)
-
{
-characteristic_test(my_dex+my_attack_spd,enemy_dex):
A direct hit! {attack_dmg} damage! {alter(enemy_health,-attack_dmg)}
-else:
They {~ducked|squatted|dodged|dove} out of peril!
}
~ pinned = false
{second_swing:{toggle(second_swing)}<> Attack two:->->}
{enemy_health>0:->enemy_attack|->finishing_blow}
= enemy_attack
+ [Parry]
{
-characteristic_test(my_str,enemy_str):
~ second_swing = true
I overpower them and get two swings in!->my_attack->
-else:
~ pinned = true
~ my_attack_spd = 0
My arm is pinned! Ouch!{alter(my_health,RANDOM(1,3))}
}
+ [Dodge]
{characteristic_test(my_dex,enemy_dex):I got out of the way just in time!|Ouch!{alter(my_health,RANDOM(1,3))}}
+ [Brace]
I absorbed some of the blow, {alter(my_health,RANDOM(0,1))}
<>but my {~leg{alter(my_dex,-1)}|arm{alter(my_str,-1)}} stings!
-
{my_health>0:->my_attack|->die}
= die
You keel over!#end
->END
= finishing_blow
The enemy is down on one knee, heaving in pain.
* [Finish them]I decapitate them with one final roundhouse kick!#end
* [Walk away]I think I've done enough damage for one weekend.#end
-
->END
=== function characteristic_test(x,y) ===
~ return x+RANDOM(1,20)>y+RANDOM(1,20)
=== function alter(ref x, y) ===
~ x += y
=== function toggle(ref x) ===
~ x = not x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment