Undertale Boss Battles Script -

class PapyrusBattle(Battle):
    def __init__(self):
        self.enemy_name = "Papyrus"
        self.hp = 150
        self.mercy = 0
        self.turns = 0
        self.spare_threshold = 80
def act_effect(self, action):
    if action == "Flirt":
        self.mercy += 25
        show_text("Papyrus: NGAHHH! You're making me blush!")
    elif action == "Insult":
        self.mercy += 5
        show_text("Papyrus: I'LL FORGIVE THAT BECAUSE I'M GREAT!")
    elif action == "Trick":
        self.mercy += 15
        show_text("Papyrus: NYEH? A PUZZLE? WHERE??")
def enemy_attack(self):
    if self.turns < 2:
        return attack_patterns["Papyrus"][0]  # bones
    elif self.hp < 50:
        return attack_patterns["Papyrus"][2]  # blue attack
    else:
        return attack_patterns["Papyrus"][1]
def on_spare(self):
    show_text("Papyrus: I, THE GREAT PAPYRUS, SPARE YOU HUMAN!")
    end_battle(victory=True)


START → PLAYER_TURN → ENEMY_TURN → PLAYER_DODGE → CHECK_VICTORY → END
                ↑_______________↓ (repeat)

If Sans had a specific attack pattern that could be described with math, for example: Undertale Boss Battles Script

$$ \textDamage = 10 \times \textAttack Power $$ START → PLAYER_TURN → ENEMY_TURN → PLAYER_DODGE →

This could be part of a strategy discussion. If Sans had a specific attack pattern that

Before we dive into the boss battles, let's briefly overview the battle system in Undertale. The game uses a custom-built battle system, which allows for a mix of turn-based and real-time elements. The player can choose to either attack, defend, or use a special ability during battles.

// Step event - player turn
if (turn_over) 
    show_menu();
    turn_over = false;