Battle Engine

1. Battle
2. Monster battle engage!

1. call "monster"

1. randomize first\_round =="monster":

call battle\_engine

if player\_turn == "victory":

```
   "You have vanquished the %(target_enemie)s!"
   "You gain %(monster_experience)d EXP!"
   $ xp += monster_experience

```

elif player\_turn == "diplomatic\_victory":

```
   "The %(target_enemie)s retreets!"
   $ diplomatic_xp = monster_experience/2
   $ xp += diplomatic_xp
   "You gain %(diplomatic_xp)d EXP!"

```

call level\_upp

```
#######################################################################################
#######################################################################################
#### START UPP SKRIPT #################################################################
#######################################################################################
#######################################################################################

```

label start:

```
   $ experience = 0
   $ level = 1
   $ klass = "warrior"
   $ str = 5
   $ int = 5
   $ con = 5
   $ cha = 5
   $ dex = 5
   $ dice = 2

```

```
   #######################################################################################
   #### combat values sett ###############################################################
   #######################################################################################

```

```
   $ diplomatic_xp = 0
   $ battle_continue = True
   $ re_roll = 2
   $ re_roll_menu = True
   $ player_turn=="none"

```

```
   $ damage = 0
   $ first_round = "none"

```

```
   #######################################################################################
   #### Your dice pool ###################################################################
   #######################################################################################

```

```
   $ dice_1 = "none"
   $ dice_2 = "none"
   $ dice_3 = "none"
   $ dice_4 = "none"
   $ dice_5 = "none"
   $ dice_6 = "none"
   $ dice_7 = "none"

```

```
   $ re_roll_dice1 = True
   $ re_roll_dice2 = True
   $ re_roll_dice3 = True
   $ re_roll_dice4 = True
   $ re_roll_dice5 = True
   $ re_roll_dice6 = True
   $ re_roll_dice7 = True

```

```
   $ sword_dice = 0
   $ combo_dice = 0
   $ shield_dice = 0
   $ magic_dice = 0
   $ talk_dice = 0
   $ hart_dice = 0

```

```
   # Warrior dice
   # $ dice_1 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'talk', 'combo'])
   # Rouge
   # $ dice_1 = renpy.random.choice(['sword', 'shield', 'talk', 'combo', 'combo', 'magic'])
   # Mage
   # $ dice_1 = renpy.random.choice(['sword', 'shield', 'talk', 'combo', 'magic', 'magic'])
   # Bard
   # $ dice_1 = renpy.random.choice(['sword', 'shield', 'talk', 'combo', 'talk', 'magic'])
   # Clearic
   # $ dice_1 = renpy.random.choice(['sword', 'hart', 'hart', 'shield', 'talk', 'magic'])

```

```
   #######################################################################################
   #### Monster dice pool ################################################################
   #######################################################################################

```

```
   $ target_enemie = "none"
   $ monster_HP = 0
   $ monster_experience = 0
   $ monster_dice = 0

```

```
   $ monster_dice_1 = "none"
   $ monster_dice_2 = "none"
   $ monster_dice_3 = "none"
   $ monster_dice_4 = "none"
   $ monster_dice_5 = "none"
   $ monster_dice_6 = "none"
   $ monster_dice_7 = "none"

```

```
   $ re_roll_monster_dice1 = True
   $ re_roll_monster_dice2 = True
   $ re_roll_monster_dice3 = True
   $ re_roll_monster_dice4 = True
   $ re_roll_monster_dice5 = True
   $ re_roll_monster_dice6 = True
   $ re_roll_monster_dice7 = True

```

```
   $ sword_monster_dice = 0
   $ combo_monster_dice = 0
   $ shield_monster_dice = 0
   $ magic_monster_dice = 0
   $ talk_monster_dice = 0
   $ hart_monster_dice = 0

```

```
#######################################################################################
#######################################################################################
#### LEVEL UPP SKRIPT #################################################################
#######################################################################################
#######################################################################################

```

label level\_upp:

```
   "Congratulations!"
   "You have leveled up!!"

```

```
   # rise to lvl 2
   if experience >= 100 and level == 1:
       $ level += 1
       $ str += 2
       $ int += 1
       $ con += 2
       $ cha += 1
       $ dex += 2
       $ dice += 1

```

```
   # rise to lvl 3
   if experience >= 250 and level == 2:
       $ level += 1
       $ str += 2
       $ int += 1
       $ con += 2
       $ cha += 1
       $ dex += 2
       $ dice += 1

```

```
   "You are now lvl %(level)d!"

```

```
   return

```

```
#######################################################################################
#######################################################################################
#### BATTLE ENGINE ####################################################################
#######################################################################################
#######################################################################################

```

label battle\_engine:

```
   $ re_roll = 2
   $ re_roll_menu = True
   $ battle_continue = True

```

```
   "You have encountered a %(target_enemie)s!"

```

```
   while battle_continue==True:

```

```
       if first_round=="player":
           $ re_roll = 2

```

```
           $ re_roll_dice1 = True
           $ re_roll_dice2 = True
           $ re_roll_dice3 = True
           $ re_roll_dice4 = True
           $ re_roll_dice5 = True
           $ re_roll_dice6 = True
           $ re_roll_dice7 = True

```

```
           call your_dice_pool
           call monster_dice_pool

```

```
       # Player turn
       if first_round==False:

```

```
               "what actions do you wish to do?"
                       "what actions do you wish to do?"
                       "Attack" if sword_dice>=2:
                           $ damage = sword_dice+str
                           "You hit %(target_enemie)s for %(damage)d damage."
                           $ sword_dice = 0
                           if dice_1 == "sword":
                               $ dice_1 = "used"
                           if dice_2 == "sword":
                               $ dice_2 = "used"
                           if dice_3 == "sword":
                               $ dice_3 = "used"
                           if dice_4 == "sword":
                               $ dice_4 = "used"
                           if dice_5 == "sword":
                               $ dice_5 = "used"
                           if dice_6 == "sword":
                               $ dice_6 = "used"
                           if dice_7 == "sword":
                               $ dice_7 = "used"

```

```
                       "Shield Smash" if sword_dice>=1 and shield_dice>=1 and combo_dice>=1:
                           $ damage = 5
                           "You hit %(target_enemie)s for %(damage)d damage."
                           "%(target_enemie) is stunned!"
                           $ sword_dice -= 1
                           $ combo_dice -= 1
                           $ shield_dice -= 1

```

```
                       "Combo Strike" if combo_dice>=3:
                           $ damage = combo_dice+str*2
                           "You hit %(target_enemie)s for %(damage)d damage."
                           $ combo_dice = 0

```

```
                       "Flee":
                           if talk_dice+renpy.random.randint(1, 20)>= 10:
                               "You flee the battle!"
                               $ player_turn = "none"
                               $ battle_continue = False
                           else:
                               "The monster blocks your way!"
                               $ player_turn = "monster"

```

```
                       "I change my mind":
                           pass

```

```
                       y "Hello?"
                       "I kill puny human!!"
                       $ player_turn="monster"
                   if cha+talk_dice>=7:
                       y "Surender or die!"
                       "Monster" "I surrender!!"
                       $ player_turn="diplomatic_victory"
                       $ battle_continue = False
                   else:
                       y "Hello monster!"
                       "Monster" "Hello self human!"

```

```
                           "What dice do you wish to re roll?"
                           "Change %(dice_1)s" if re_roll_dice1==False:
                               $ re_roll_dice1 = True
                           "Do not change %(dice_1)s" if re_roll_dice1==True:
                               $ re_roll_dice1 = False
                           "Change %(dice_2)s" if re_roll_dice2==False:
                               $ re_roll_dice2 = True
                           "Do not change %(dice_2)s" if re_roll_dice2==True:
                               $ re_roll_dice2 = False
                           "Change %(dice_3)s" if dice>=3 and re_roll_dice3==False:
                               $ re_roll_dice3 = True
                           "Do not change %(dice_3)s" if dice>=3 and re_roll_dice3==True:
                               $ re_roll_dice3 = False
                           "Change %(dice_4)s" if dice>=4 and re_roll_dice4==False:
                               $ re_roll_dice4 = True
                           "Do not change %(dice_4)s" if dice>=4 and re_roll_dice4==True:
                               $ re_roll_dice4 = False
                           "Change %(dice_5)s" if dice>=5 and re_roll_dice5==False:
                               $ re_roll_dice5 = True
                           "Do not change %(dice_5)s" if dice>=5 and re_roll_dice5==True:
                               $ re_roll_dice5 = False
                           "Change %(dice_6)s" if dice>=6 and re_roll_dice6==False:
                               $ re_roll_dice6 = True
                           "Do not change %(dice_6)s" if dice>=6 and re_roll_dice6==True:
                               $ re_roll_dice6 = False
                           "Change %(dice_7)s" if dice>=7 and re_roll_dice7==False:
                               $ re_roll_dice7 = True
                           "Do not change %(dice_7)s" if dice>=7 and re_roll_dice7==True:
                               $ re_roll_dice7 = False

```

```
                           "Roll the dice": # make a variable for requirement that at least one dice is chosen to be reroll.
                               call your_dice_pool
                               $ re_roll -= 1
                               #brake
                               $ re_roll_menu = False
                           "I change my mind":
                               $ re_roll_menu = False

```

```
               "End turn":
                   #brake
                   $ player_turn = "monster"

```

```
           $ re_roll_menu = True

           if monster_HP<=0:
               $ player_turn="victory"
               $ battle_continue = False

```

```
       if first_round=="monster":
           $ re_roll = 2

```

```
           $ re_roll_dice1 = True
           $ re_roll_dice2 = True
           $ re_roll_dice3 = True
           $ re_roll_dice4 = True
           $ re_roll_dice5 = True
           $ re_roll_dice6 = True
           $ re_roll_dice7 = True

```

```
           call your_dice_pool
           call monster_dice_pool

       #Monsters move
       while player_turn=="monster":

           # re-roll all dice

```

```
           # Use attacks

```

```
           if HP<=0:
               jump game_over
           else:
               "Your turn"
               player_turn = "player"

```

```
   return

```

```
#######################################################################################
#######################################################################################
#### YOUR DICE POOL ###################################################################
#######################################################################################
#######################################################################################

```

label your\_dice\_pool:

```
   $ sword_dice = 0
   $ combo_dice = 0
   $ shield_dice = 0
   $ magic_dice = 0
   $ talk_dice = 0
   $ hart_dice = 0

```

```
   if re_roll_dice1==True:
       #if not not dice_1=="used" and not dice_1==""
       $ dice_1 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'talk', 'combo'])
       $ re_roll_dice1 = False
   if dice_1=="sword":
       $ sword_dice += 1
   elif dice_1=="combo":
       $ combo_dice += 1
   elif dice_1=="shield":
       $ shield_dice += 1
   elif dice_1=="magic":
       $ magic_dice += 1
   elif dice_1=="talk":
       $ talk_dice += 1
   elif dice_1=="hart":
       $ hart_dice += 1

```

```
   if re_roll_dice2==True:
       $ dice_2 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'talk', 'combo'])
       $ re_roll_dice2 = False
   if dice_2=="sword":
       $ sword_dice += 1
   elif dice_2=="combo":
       $ combo_dice += 1
   elif dice_2=="shield":
       $ shield_dice += 1
   elif dice_2=="magic":
       $ magic_dice += 1
   elif dice_2=="talk":
       $ talk_dice += 1
   elif dice_2=="hart":
       $ hart_dice += 1

```

```
   if re_roll_dice3==True and dice>=3:
       $ dice_3 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'talk', 'combo'])
       $ re_roll_dice3 = False
   if dice_3=="sword":
       $ sword_dice += 1
   elif dice_3=="combo":
       $ combo_dice += 1
   elif dice_3=="shield":
       $ shield_dice += 1
   elif dice_3=="magic":
       $ magic_dice += 1
   elif dice_3=="talk":
       $ talk_dice += 1
   elif dice_3=="hart":
       $ hart_dice += 1

```

```
   if re_roll_dice4==True and dice>=4:
       $ dice_4 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'talk', 'combo'])
       $ re_roll_dice4 = False
   if dice_4=="sword":
       $ sword_dice += 1
   elif dice_1=="combo":
       $ combo_dice += 1
   elif dice_4=="shield":
       $ shield_dice += 1
   elif dice_4=="magic":
       $ magic_dice += 1
   elif dice_4=="talk":
       $ talk_dice += 1
   elif dice_4=="hart":
       $ hart_dice += 1

```

```
   if re_roll_dice5==True and dice>=5:
       $ dice_5 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'talk', 'combo'])
       $ re_roll_dice5 = False
   if dice_5=="sword":
       $ sword_dice += 1
   elif dice_5=="combo":
       $ combo_dice += 1
   elif dice_5=="shield":
       $ shield_dice += 1
   elif dice_5=="magic":
       $ magic_dice += 1
   elif dice_5=="talk":
       $ talk_dice += 1
   elif dice_5=="hart":
       $ hart_dice += 1

```

```
   if re_roll_dice6==True and dice>=6:
       $ dice_6 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'talk', 'combo'])
       $ re_roll_dice6 = False
   if dice_6=="sword":
       $ sword_dice += 1
   elif dice_6=="combo":
       $ combo_dice += 1
   elif dice_6=="shield":
       $ shield_dice += 1
   elif dice_6=="magic":
       $ magic_dice += 1
   elif dice_6=="talk":
       $ talk_dice += 1
   elif dice_6=="hart":
       $ hart_dice += 1

```

```
   if re_roll_dice7==True and dice>=7:
       $ dice_7 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'talk', 'combo'])
       $ re_roll_dice7 = False
   if dice_7=="sword":
       $ sword_dice += 1
   elif dice_7=="combo":
       $ combo_dice += 1
   elif dice_7=="shield":
       $ shield_dice += 1
   elif dice_7=="magic":
       $ magic_dice += 1
   elif dice_7=="talk":
       $ talk_dice += 1
   elif dice_7=="hart":
       $ hart_dice += 1

```

```
   call armor_bonuses

```

```
   return

```

```
#######################################################################################
#######################################################################################
#### MONSTER DICE POOL ################################################################
#######################################################################################
#######################################################################################

```

label monster\_dice\_pool:

```
   $ sword_monster_dice = 0
   $ combo_monster_dice = 0
   $ shield_monster_dice = 0
   $ magic_monster_dice = 0
   $ talk_monster_dice = 0
   $ hart_monster_dice = 0

```

```
           $ monster_dice_1 = renpy.random.choice(['sword', 'sword', 'shield', 'pass', 'pass', 'pass'])
       elif target_enemie == "goblin":
           $ monster_dice_1 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'pass', 'combo'])
       $ re_roll_dice1 = False
   if monster_dice_1=="sword":
       $ sword_dice += 1
   elif monster_dice_1=="combo":
       $ combo_dice += 1
   elif monster_dice_1=="shield":
       $ shield_dice += 1
   elif monster_dice_1=="magic":
       $ magic_dice += 1
   elif monster_dice_1=="hart":
       $ hart_dice += 1

```

```
   if re_roll_monster_dice2==True and monster_dice>=2:
       if target_enemie == "slime":
           $ monster_dice_2 = renpy.random.choice(['sword', 'sword', 'shield', 'pass', 'pass', 'pass'])
       elif target_enemie == "goblin":
           $ monster_dice_2 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'pass', 'combo'])
       $ re_roll_monster_dice2 = False
   if monster_dice_2=="sword":
       $ sword_dice += 1
   elif monster_dice_2=="combo":
       $ combo_dice += 1
   elif monster_dice_2=="shield":
       $ shield_dice += 1
   elif monster_dice_2=="magic":
       $ magic_dice += 1
   elif monster_dice_2=="hart":
       $ hart_dice += 1

```

```
   if re_roll_monster_dice3==True and monster_dice>=3:
       if target_enemie == "slime":
           $ monster_dice_3 = renpy.random.choice(['sword', 'sword', 'shield', 'pass', 'pass', 'pass'])
       elif target_enemie == "goblin":
           $ monster_dice_3 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'pass', 'combo'])
       $ re_roll_monster_dice3 = False
   if dice_3=="sword":
       $ sword_dice += 1
   elif monster_dice_3=="combo":
       $ combo_dice += 1
   elif monster_dice_3=="shield":
       $ shield_dice += 1
   elif monster_dice_3=="magic":
       $ magic_dice += 1
   elif monster_dice_3=="hart":
       $ hart_dice += 1

```

```
   if re_roll_monster_dice4==True and monster_dice>=4:
       if target_enemie == "slime":
           $ monster_dice_4 = renpy.random.choice(['sword', 'sword', 'shield', 'pass', 'pass', 'pass'])
       elif target_enemie == "goblin":
           $ monster_dice_4 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'pass', 'combo'])
       $ re_roll_monster_dice4 = False
   if monster_dice_4=="sword":
       $ sword_dice += 1
   elif monster_dice_1=="combo":
       $ combo_dice += 1
   elif monster_dice_4=="shield":
       $ shield_dice += 1
   elif monster_dice_4=="magic":
       $ magic_dice += 1
   elif monster_dice_4=="hart":
       $ hart_dice += 1

```

```
   if re_roll_monster_dice5==True and monster_dice>=5:
       if target_enemie == "slime":
           $ monster_dice_5 = renpy.random.choice(['sword', 'sword', 'shield', 'pass', 'pass', 'pass'])
       elif target_enemie == "goblin":
           $ monster_dice_5 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'pass', 'combo'])
       $ re_roll_monster_dice5 = False
   if monster_dice_5=="sword":
       $ sword_dice += 1
   elif monster_dice_5=="combo":
       $ combo_dice += 1
   elif monster_dice_5=="shield":
       $ shield_dice += 1
   elif monster_dice_5=="magic":
       $ magic_dice += 1
   elif monster_dice_5=="hart":
       $ hart_dice += 1

```

```
   if re_roll_monster_dice6==True and monster_dice>=6:
       if target_enemie == "slime":
           $ monster_dice_6 = renpy.random.choice(['sword', 'sword', 'shield', 'pass', 'pass', 'pass'])
       elif target_enemie == "goblin":
           $ monster_dice_6 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'pass', 'combo'])
       $ re_roll_monster_dice6 = False
   if monster_dice_6=="sword":
       $ sword_dice += 1
   elif monster_dice_6=="combo":
       $ combo_dice += 1
   elif monster_dice_6=="shield":
       $ shield_dice += 1
   elif monster_dice_6=="magic":
       $ magic_dice += 1
   elif monster_dice_6=="hart":
       $ hart_dice += 1

```

```
   if re_roll_monster_dice7==True and monster_dice>=7:
       if target_enemie == "slime":
           $ monster_dice_7 = renpy.random.choice(['sword', 'sword', 'shield', 'pass', 'pass', 'pass'])
       elif target_enemie == "goblin":
           $ monster_dice_7 = renpy.random.choice(['sword', 'sword', 'shield', 'shield', 'pass', 'combo'])
       $ re_roll_monster_dice7 = False
   if monster_dice_7=="sword":
       $ sword_dice += 1
   elif monster_dice_7=="combo":
       $ combo_dice += 1
   elif monster_dice_7=="shield":
       $ shield_dice += 1
   elif monster_dice_7=="magic":
       $ magic_dice += 1
   elif monster_dice_7=="hart":
       $ hart_dice += 1

```

```
   #call/use monster bonuses

```

```
   return

```

```
#######################################################################################
#######################################################################################
#### MONSTER DICE POOL ################################################################
#######################################################################################
#######################################################################################

```

label armor\_bonuses:

```
   $ magic_dice += 2

```

```
#######################################################################################
#######################################################################################
#### OTHER STUUUFFFFFF ################################################################
#######################################################################################
#######################################################################################

```

    $ d20roll = renpy.random.randint(1, 20)

    dice\_max #set by lvl

    dice\_left = dice\_max

    while not dice\_left == 0:

        # random dice

        $items.append(renpy.random.choice(['bannanan', 'Apple', 'mellon']))

        if dice = apple:

            apple\_count += 1

        #-=-

        #-=-

        call armor\_bonus

        call skill\_bonus

        dice\_left -= 1

    call class\_options

    $ items = []

    $ items.append("spaghetti")

    $ items.append("spaghetti")

    if "spaghetti" in items and "bob" in items and "spaghetti" in items:

        "show some test text."

    "Sure thing, I have [items] in my backpack."

    $ items.remove("spaghetti")

    "Sure thing, I have [items] in my backpack."

    $ items = []

    $ items.append("spaghetti")

    $ items.append("spaghetti")

    if "spaghetti" in items and "bob" in items and "spaghetti" in items:

        "show some test text."

    "Sure thing, I have [items] in my backpack."

    $ items.remove("spaghetti")

    "Sure thing, I have items in my backpack."

    $ count = 10

    while count > 0:

        "T-minus [count]."

        $ count -= 1

    "Liftoff!"

```
```

    #- if “apple” in inventory:

    #- if “bat” not in inventory:

    "..."

    if bel == "q1" and if not stabby == "none" and princess == "bob":

        "Test box."

    if not bel == "bob" and not stabby == "bob" and not princess == "bob":

        "Test box."

    jump map