Skip to content

Enemy actions

This directory contains all the enemy actions logic contained in DoAction. They are important and complex enough to warrant its own directory in the BattleControl documentation.

An enemy action is any piece of logic that is specific to the case where the actor sent to DoAction is an enemy party member. In that case, the actionid is interpreted as the enemydata index and the enemy party member's enemy id determines the action logic that will be processed.

Anything else is detailed in the DoAction documentation. For the player actions, check the player actions documentation.

How enemy actions work and how to read their documentation

This section can be served as a guide to the enemy action documentations linked below as it explains how an action is typically organised and how the documentation reflects that.

Each enemy entry has one action, but its complexity allows them to perform many different tasks within that same action. While each actions is free to do anything, they tend to follow a loosely defined structure that flows in this order:

  • Pre move logic (optional)
  • Move selection (mandatory)
  • Move logic slated for usage (mandatory)
  • Post move logic (optional)

The move concept

A "move" in an enemy action page is loosely defined as a specific code path within the enemy action where they perform specific tasks at the expense of others. There isn't any concrete concept of a "move", but it exists loosely throughout the various enemy actions implementations. In fact, they don't have any names so each enemy documentations will indentify them by a number and a description that mostly reflects what the move does.

Each moves contains all the damage pipeline and their high level logic. The logic doesn't contain everything, but it contains enough to identify the animations, audio and most importantly, the block timings from the player side. Each moves also contains notices about modifiers applied such as nonphysical and dontusecharge, see the DoAction documentation to learn more about them.

The decision of which move to use is often complex and it involves another key concept of enemy actions: the move selection process.

The move selection process

An enemy action typically (there's some exceptions) don't operate deterministically with each other. They have a decision making process that frequently involves RNG or other more deterministic conditions. This process exists in various forms, but a very common one is generating a number using weighted RNG odds and use that number as a switch statement whose arms leads to the different moves's logic. This isn't always the case and the action might employ a mix of methods to make this decision, but the end goal is the same: there's always a decision process in which a move gets selected in the end.

This process is what is reffered to as the "move selection" process. Every actions is assumed to have one in the documentation pages as the vast majority does have a process to determine this. It helps to reason that this concept exists even though there is nothing preventing an action from doing anything outside of this and there's no concept that defines this formally. The move selection also might not always have the same odds: enemies can decide to change the weights of them under certain conditions. In all cases, the documentation will always have a move selection section that documents this process.

About rerolls and redirection

This selection process however isn't always simple as selecting a move and using it right away. Several enemies might not want to use certain moves under certain conditions. Due to the way the enemy actions are commonly done, the prefered method to implement this is rejection sampling: let the move selection process select a move, but falback if it's found that the move shouldn't be used.

This creates a distinction between when a move is SELECTED and when it is USED. The former might not always implies the latter as it's possible the falback is to use another move instead or to leverage the enemy action loop by issuing a continue directive to the enemy action loop.

Enemy action loop

The enemy action loop is a special loop that encloses every enemy actions logic in a "while(true)" block. This isn't infinite since the loop always breaks out once the action is done, but it allows actions to issue a "continue" directive on it.

What this will do is restart the action logic without actually ending the action. It's essentially used as a more complex "goto" statement, but specific to enemy actions logic. The main usage of this feature is when a move is selected, but its usage was deemed to not fufill their requirements. Since enemy actions would rather prefer to use refjection sampling, issuing a continue directive allows to reroll the move selection process because it's something that's typically done very early in the action logic.

Not all actions employ this method (it might not always be feasible), but a lot do which is enough to mention it specifically as the enemy action loop.

data slots

Every actor has a data field which is an int array, but it's exclusively reserved for enemy actions. It's a general purpose integer array to keep track of various information that the enemy needs to preserve accross multiple actor turns (as each actor turn is a separate DoAction call). It's an optional features: enemies don't have to use it, but it's there if they need it.

The enemy action is what decides the amount of slots to use if any and their entire semantics or valid values. Due to this, each documentation has a section about their usage if they are used. Typically, the initialisation of the field is done if it's not null as the starting value on the enemy's first actor turn is null.

About HardMode changes

While HardMode already affects the enemydata loading process to scale some stats with the difficulty, this isn't the only way enemies changes with it. Each action very frequently introduces a tailored set of changes if HardMode returns true. It's used so much that DoAction has a local declared called "hardmode" which is set to the return of HardMode which enemy actions logic can consult easily.

Due to how important these logic changes are in enemy actions with difficulty scaling, each enemies actions will have a dedicated section covering all the changes if HardMode returns true or any other relevant difficulty scaling information.

About assumptions

Not all enemies are expected to function in all situations. There are enemies which are expected to operate in certain conditions, but there's nothing in the action logic that would enforce those condtions. In other words, they are assumed.

Enemy actions documentation will contain a section that details what is assumed and why the enemy wouldn't work properly if those assumptions aren't respected.

About out of actions logic

Enemies might have specific logic done outside of DoAction. If that's the case, the enemy actions pages will contain sections to indicate them.

Enemy actions table

Since the vast majority of the enemies in the game have their own action logic, their links will be listed per enemy id in the following table:

ID Name English Name Notes
0 CordycepsAnt Zombiant
1 Mushroom Jellyshroom
2 Spuder Spider
3 Zasp Zasp
4 Cactus Cactiling
5 Pseudoscorpion Psicorp
6 Thief Thief
7 Bandit Bandit
8 ArmoredPoly Inichas
9 Seedling Seedling
10 FlyingSeedling Flying Seedling This enemy has no action logic
11 MakiTutorial Maki
12 MothWeb Web This enemy has no action logic
13 SpuderReal Spider This enemy has no action logic
14 Sneil Numbnail
15 Mothiva1 Mothiva
16 Acornling Acornling
17 Weevil Weevil
18 MrTester Mr. Tester
19 AngryPlant Venus' Bud
20 FlyTrap Chomper
21 Acolyte Acolyte Aria
22 AcolyteVine Vine This enemy has no action logic
23 Beetle Kabbu
24 VenusBoss Venus' Guardian
25 WaspTrooper Wasp Trooper
26 WaspBomber Wasp Bomber
27 WaspDriller Wasp Driller
28 WaspHealer Wasp Scout
29 Midge Midge
30 Underling Underling
31 Scarlet Monsieur Scarlet
32 GoldenSeedling Golden Seedling
33 Sandworm Arrow Worm
34 Carmina Carmina
35 SeedlingKing Seedling King
36 MidgeBroodmother Broodmother
37 Plumpling Plumpling
38 Flowering Flowerling
39 Burglar Burglar
40 BanditLeader Astotheles
41 MotherChomper Mother Chomper
42 Ahoneynation Ahoneynation
43 BeeBot Bee-Boop
44 BeeTurret Security Turret
45 ShockWorm Denmuki
46 BeeBoss Heavy Drone B-33
47 MenderBot Mender
48 Abomihoney Abomihoney
49 Scorpion Dune Scorpion
50 SandWyrm Tidal Wyrm
51 Kali Kali
52 Zombee Zombee
53 Zombeetle Zombeetle
54 ZombieRoach The Watcher
55 PeacockSpider Peacock Spider
56 Bloatshroom Bloatshroom
57 Krawler Krawler
58 Cape Haunted Cloth
59 SandWall Sand Wall
60 IceWall Ice Wall
61 CursedSkull Warden
62 WaspKingIntermission Wasp King
63 JumpingSpider Jumping Spider
64 MimicSpider Mimic Spider
65 LeafbugNinja Leafbug Ninja
66 LeafbugArcher Leafbug Archer
67 LeafbugClubber Leafbug Clubber
68 SkullCaterpillar Madesphy
69 Centipede The Beast
70 ChomperBrute Chomper Brute
71 Mantidfly Mantidfly
72 WaspGeneral General Ultimax
73 WildChomper Wild Chomper
74 TermiteSoldier Cross
75 TermiteNasute Poi
76 PrimalWeevil Primal Weevil
77 FalseMonarch False Monarch
78 Mothfly Mothfly
79 MothflyCluster Mothfly Cluster
80 Ironclad Ironnail
81 ToeBiter Belostoss
82 Ruffian Ruffian
83 Strider Water Strider
84 DivingSpider Diving Spider
85 Cenn Cenn
86 Pisci Pisci
87 DeadLanderA Dead Lander α
88 DeadLanderB Dead Lander β
89 DeadLanderG Dead Lander γ
90 WaspKing Wasp King
91 EverlastingKing The Everlasting King
92 Maki Maki
93 Kina Kina
94 Yin Yin
95 UltimaxTank ULTIMAX Tank
96 Zommoth Zommoth
97 Fisherman Riz
98 Pitcher Devourer
99 SandWyrmTail Tail
100 PisciWall Rock Wall This enemy has no action logic
101 KeyR Ancient Key
102 KeyL Ancient Key
103 Tablet Ancient Tablet
104 PitcherFlytrap Flytrap
105 FireKrawler FireKrawler This enemy has no action logic
106 FireWarden FireWarden This enemy has no action logic
107 FireCape FireCape This enemy has no action logic
108 IceKrawler IceKrawler This enemy has no action logic
109 IceWarden IceWarden This enemy has no action logic
110 TANGYBUG |glitchy,1|TANGYBUG|glitchy|
111 Stratos Stratos
112 Delilah Delilah