Battle Eng

label battle\_engine:

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

```

```
   $ dice_1_status = "none"
   $ dice_2_status = "none"
   $ dice_3_status = "none"
   $ dice_4_status = "none"
   $ dice_5_status = "none"
   $ dice_6_status = "none"
   $ dice_7_status = "none"

   scene bg forest
   show y tough at left
   show monster normal
   with dissolve

```

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

```

```
   $ show_playerHP = True
   $ show_monsterHP = True

   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

           $ 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

           call update_dice
           call update_monster_dice
           call your_dice_pool
           call monster_dice_pool
           call update_status_turnend

```

```
       # Player turn

       call update_status_turnsta

       while player_turn=="player":

```

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

```

```
           $ re_roll_toggle = 0
           $ re_roll_menu = True

           call screen combat_button_UI

           $ result = _return

           if result == "reroll":
               call your_dice_pool
           elif result == "talk":
               call talk_monsters
           elif result == "fight":
               call player_attacks
           elif result == "endturn":
               #brake
               $ player_turn = "monster"

           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

           $ 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

```

```
           call update_dice
           call update_monster_dice
           call your_dice_pool
           call monster_dice_pool
           call update_status_turnend

       #Monsters move
       while player_turn=="monster":

           # re-roll all dice
           $ random_monster_attack = renpy.random.randint(1, 3)

           if random_monster_attack == 1:
               "%(target_enemie)s do nothing"
           elif random_monster_attack == 2:
               show monster attack
               show y hurt
               $ renpy.pause(2.0)
               show y tough
               show monster normal
               call stun_player
               "%(target_enemie)s stun you!"

           elif random_monster_attack == 3:
               show monster attack
               show y hurt
               $ renpy.pause(2.0)
               show y tough
               show monster normal
               "%(target_enemie)s hit you!"
               $ HP -= 10

           call show_dice
           call show_monster_dice

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

```

```
   "Battle is now over!"

   return

```