Encounter

Encounters are the battles (FIGHTs) with enemies that either occur at random or in predetermined locations. During a battle, the protagonist can interact with an enemy in many different ways through ACTs, but the enemies present must be either killed or spared to end the encounter. Alternatively, fleeing can also end the battle, but this method does not always guarantee success, and can lead to a skipped turn instead.

During an encounter, the options FIGHT, ACT, ITEM, and MERCY, the name chosen at the beginning of the game, LV, and HP is all visible like in typical RPG setups.

Protagonist's turn
In the middle of the screen, some text is displayed in narrative style:
 * At the start of the encounter, flavor text is given on the nature of the encounter (e.g. "Whimsun approached meekly!")
 * After the first turn, the flavor text usually describes one of the monsters in battle, which may change depending on the ACT options the protagonist has chosen.
 * The flavor text can also describe the protagonist's actions whether it is from doing ACTs, or as a story element.

FIGHT
The protagonist is prompted to pick a monster to attack. The protagonist can attack one monster each turn.
 * If a monster can be spared to remove them from battle, their name may be colored yellow, white, or pink, depending on the conversation the protagonist had with the third frog in Room 21 (room_ruins13). Yellow is the default color for spareable monsters.
 * Selecting FIGHT will trigger a quick-time-event in which 1 bar (or more with certain weapons) slides across a meter, and "Z" must be pressed to attack. Hitting "Z" while the bar is at the center mark causes the most damage.
 * Allowing the bar(s) to slide all the way across the meter results in them fading out, and a miss. This method is equivalent to selecting Spare, except that it will not cause any monsters to leave the battle.
 * The protagonist's weapon determines the speed and number of bars, as well as the effect that plays after an attack if it is to succeed.
 * The Tough Glove has its own quick-time event where "Z" must be pressed four times as fast as possible to deal maximum damage.
 * If the attack depletes the monster's health, they dissipate into dust and fade out of the battle, effectively killing them. Normal monsters take a minimum of one to four hits to die while bosses can take much more. It is possible to kill some monsters in one hit on the Genocide Route.
 * Once a monster's HP is low enough, they can be spared. This method can be used to end a battle if one neglects the ACT menu. Bosses and mini-bosses are an exception.
 * It is possible to kill any monster or a boss in one hit before choosing to Spare them while their name is colored. This method is known as Betrayal and can trigger unique dialogue in certain circumstances. This method is useful if the protagonist has a low-tier weapon (likely from the lack of G) as the damage boost can effectively fix this issue.

ACT
The protagonist is prompted to select a monster, and is then given one or more ACT options which are specific to that monster: If a monster can be spared, then their name will be colored yellow, pink or white depending on the conversation with the third frog in the three-frog room in the Ruins.
 * The protagonist can always Check any monster in the encounter. However, there are exceptions (such as some Amalgamates).
 * ACTing is another way to end battles peacefully (And is usually the pacifist tactic players use as opposed to FIGHTing and draining their HP to a minimum).
 * In some situations, ACTing will end the next turn immediately, and the monster can be spared.
 * ACTs may need to be performed in a certain order to allow a monster to be spared (e.g. sparing Greater Dog).

ITEM

 * Using consumable items regains health. Some consumable items are capable of increasing stats.
 * Using equipment items other than the Bandage or Stick equips them.
 * Using the Bandage acts like a consumable item.
 * Using the Stick throws it. Using the Stick can have different effects play out, like making the Snowdin Canine Units and Endogeny immediately spareable, increasing the ratings on Mettaton EX's FIGHT, etc. After use, the protagonist "picks it back up" and can use it again.

MERCY
Sparing means that the protagonist does not want to fight.
 * Selecting Spare will remove any monster from battle if their name is colored.
 * The spare color begins as yellow, but can be changed to white and finally pink by talking to a Froggit at the midway point of the Ruins.
 * If the Spare option is not colored, selecting it does nothing in most situations, and merely results in skipping a turn.
 * Some monsters, notably bosses, require the protagonist to continue sparing even if their name is not colored to progress the encounter peacefully.
 * Selecting Flee will make an attempt to escape the encounter. If successful, the protagonist's heart is shown walking away, and the game returns to the overworld.

Enemy's turn
The enemy may have some dialogue before attacking; the protagonist can skip the forming dialogue with "X," then "Z." In some situations (Such as when the dialogue plays at a slower pace) the dialogue cannot be skipped.

The protagonist's SOUL is placed inside the Bullet Board. The enemy attacks the SOUL in the box. The SOUL can be controlled using arrow keys. The shape of the bullets used in enemy attacks varies, depending on the enemy being fought. When multiple enemies are fought, their attacks overlap in the Bullet Board.

In most boss battles (and the mini-boss, Muffet), the color of the SOUL is changed to a certain color. The enemies' attack colors also change in certain battles.

End conditions
An encounter may end through the following ways:

Win
All monsters are removed from battle. EXP and GOLD are rewarded depending on the monster(s) fought and whether the protagonist killed the monster(s) or did certain ACTs that give them GOLD. Monsters that are removed from battle are either grayed out with a certain sprite or absent from the battlefield entirely.

Lose
The protagonist's HP reaches 0. This results in a game over and the game loads to the last save point before the encounter. There are some exceptions when it comes to the SAVEs at certain points in the game (such as the elevators in Hotland). However, the outcome of a loss has exceptions during both of Photoshop Flowey's and Asriel's fights.

Flee
The protagonist flees from battle and returns to the overworld and is rewarded with EXP or GOLD for each monster killed or spared during the encounter.

Trivia

 * Screenshots of an earlier version of Undertale when it was called "UnderBound 2" reveal that "ACT" was originally called "TALK," "MERCY" was originally called "SPARE," and a "SPELL" button was planned to be included but was scrapped. This asset can still be found in the game's files.
 * Wearing the Bandage makes fleeing the battle 100% guaranteed, which can be useful for speedruns and Pacifists.
 * When pressing "X" during the protagonist's turn, the SOUL moves slower. This method can be useful if the protagonist is currently in tight sections where precise movement is needed. It can also be used to move slowly across the Bullet Board while enemies are directly shooting you, effectively taking a while to get to a corner, in which case, the turn is already over.
 * If a monster with no hurt sprite is spared, it is replaced with a grayed out Aaron sprite, which is the sparing placeholder sprite. This replacement is likely because Aaron's name is the first in the alphabet within the game files.