Expert Guide: Draw

The internals of Noita's wand-building system operate much like a card game. This guide explains the mechanics of Draw, including Deck, Hand, and Discard, and how simple spells interact with these things. This guide provides a necessary perspective to understanding the more complex and unintuitive mechanics of certain spells, and builds a useful foundation for complicated wand-building in general.

Assume wands are no-shuffle unless otherwise specified.

## Basics: The Deck, the Hand, and the Discard

As you cast spells on a wand, the spells on that wand move between the following three zones:

The **Hand**, which contains the spell(s) that you are currently casting. It exists to prevent spells from being cast twice.

The **Deck**, which contains the spells that have not been cast yet. Before using a wand, the Deck contains all the spells on the wand. On no-shuffle wands, the Deck contains them in order.

The **Discard**, which contains the spells that have been cast (or skipped for other specific reasons). When you finish casting, the spells in the Hand are moved to the Discard.

The game will naturally move spells through these zones while casting with a wand. However, some particular spells further manipulate the zones when cast. There are two ways that this happens:

**Draw,** which means moving/"**draw**ing" a spell from the Deck to the Hand. This is the most common interaction, and fairly intuitive. Most projectile spells have no draw, most modifiers have one draw, and multicasts have several draw (corresponding to the number of the multicast, for example Double Spell has two draw).

**Discard**, which means moving/"**discard**ing" a spell from the Deck directly to the Discard (skipping the hand). Very few spells use this mechanic, including spells like the Divide By series and the Add Trigger series. The details of these spells and their discard mechanics will be covered in other guides.

Let's go over a few example wand/spell loadouts to solidify understanding of the Deck, Hand, and Discard zones. Familiarity with these concepts is necessary to fully understand more complex spells (like the Divide By and Add Trigger series, for example).

## Spell Evaluation

All of your spells (in the wand) begin in the Deck. For a non-shuffle wand that has not yet been cast, the Deck will consist of every spell on the wand, in the same order as they are in the wand.

Consider a wand with 1 Spell/Cast. When you click the mouse button to cast the wand, the wand draws the first spell from the Deck and puts it in the Hand. Then, the spell in the Hand is cast. The spell evaluates itself, and then finishes. The cast ends, and a visible effect (corresponding to the spell) is produced in the game, and the spell in the Hand is moved to the Discard.

That example contains one spell being evaluated, because the draw was one, but there are also cases where multiple spells may be evaluated at once. Multicast spells and modifiers draw one or more spells to the Hand as they are evaluated—a modifier produces an effect and then draws another spell, for example, while a Double Spell draws two spells. In each case, the Hand ends up with multiple spells (the modifier, and the modified spell; and the Double spell, plus the two spells after it). Here is an example involving spells drawing other spells:

Spells/Cast: 1

The spell evaluation tree for this wand (on the first cast) looks like this:

* Wand's Cast
	+ Damage Plus
		- Double Cast
			* Triple Cast
				+ Spark Bolt
				+ Spark Bolt
				+ Spark Bolt
			* Speed Up
				+ Spark Bolt

We can interpret this as follows:

1. The wand's initial cast draws Damage Plus from the Deck. Damage Plus is moved to the Hand and cast.
2. Damage Plus applies its effect and then draws one card. This happens to be Double Cast, which is moved to the hand and cast.
3. Double cast evaluates, It has no effect aside from drawing 2. First, it draws one card, which is Triple Cast, and evaluates it.
4. Triple Cast's effect is to Draw 3. The first card it draws is Spark Bolt. Spark Bolt is evaluated, and applies its effect (creating a projectile), but it does not draw any cards so the chain ends there.
5. Triple Cast draws its second and third cards, each of which are Spark Bolt. Both of them apply their effect and end their evaluation.
6. Triple Cast has now drawn all three cards, so it ends its evaluation.
7. We return to Double Cast. Now that we have completely evaluated its first Draw, it draws its second card. At this point, Speed Up is on the top of the Deck, so we draw it.
8. Speed up applies its effect and draws an additional card, which is spark bolt. Spark bolt finishes, then Speed up finishes.
9. We return again to Double cast, and it has now drawn both of its cards. It ends its evaluation.
10. Now, we go back to the wand's cast. Since this wand only has 1 Spells/Cast, the wand will not draw any more. When there is no more draw, evaluation ends and the projectiles fly out into the world.

So, the wand shoots out the projectiles. This wand produces four spark bolts, each with Damage Plus and Speed Up applied. At this point, all of the spells except for the Nuke are in the Hand. Now, everything currently in the hand is moved to the Discard as part of the casting process. Cast Delay is then applied before the next cast.

What happens if the wand is cast again? The answer is:

* Wand's Cast
	+ Nuke

Everything except for the Nuke is in the Discard, so when the wand draws a spell from the top of the Deck, it finds Nuke. Nuke is moved to the hand and cast. The Nuke projectile is launched into the world, and the Nuke spell is moved to the Discard. Then, something important happens.

Whenever a cast finishes, the game checks if the Deck is empty, and if so, a recharge is triggered. A recharge moves all spells from the Discard back to the Deck and sorts them in their proper order. Recharge Time is applied at this point, and when it finishes, the process starts again from the beginning, with spells back in the deck and ready to be drawn.

## Cast State

One thing that we glossed over in the previous section is how modifiers and projectiles are actually translating their effect into the world. An initial thought is that it might have something to do with the hand - maybe, at the end of evaluation, it reads through all of the spells in the hand and does something with them? This is a natural assumption, but it is incorrect. The Hand has nothing to do with it, and its main purpose is simply to keep track of what spells have already been a part of this cast so they cannot be drawn again. Wrapping can reach spells in the Discard but not the Hand, for instance.

What actually happens with spell evaluation is that there is an abstract "Cast State" that stores the effects of all the modifiers and projectiles that have been evaluated so far. For instance, when Damage Plus is cast, part of its effect is to modify the Cast State with "+10 Projectile Damage". If another Damage Plus is cast, that part of the Cast State is changed to "+20 Projectile Damage."

When a projectile is cast, two things happen: First, the projectile itself is added to the list of projectiles stored in the Cast State. Then, any statistics attached to the projectile modify the statistics already present in the cast state. The projectile's Cast Delay and Spread are added to the Cast Delay and Spread of the Cast State, as well as any other statistics the projectile might have. Modifiers are exactly the same, except they do not add a projectile to the Cast State, and they draw a spell at the end of their evaluation.

When the evaluation of a cast completes (which happens when no more spells are doing any drawing, or there are no spells to draw), all of the projectiles stored in the Cast State are shot out, each of them with all of the modifiers that have been stored in the cast state applied. This is why one Damage Plus applies to every projectile in the Casting Block.

Note that no reference is made to any of the spells in the Deck, Hand, or Discard - only the Cast State is used when the spells are actually fired. This is important because some spells, like Wand Refresh, remove spells from the Hand while leaving the Cast State untouched.

Lastly, a note about recharging: If a modifier or projectile has a Recharge Time statistic, that will be added to a separate value. Multiple casts with multiple Cast States may happen before the wand recharges, so the Recharge Time value is separate from each individual Cast State. That being said, it is changed by spells in exactly the same way as the Cast State.

## Wrapping

So, you've heard of wrapping in the past. How do we explain it with this new framing? The answer is simple: When a spell tries to draw but there is nothing in the Deck, every spell in the Discard is moved to the Deck and reordered. The draw then proceeds - this is what a wrap is. It is very simple, but there's an additional detail: When a wrap occurs, a flag is set in the game that makes it so that the wand will recharge immediately after the wand's current cast finishes. That's why a wand starts at the beginning again even after a wrap casts the first couple spells.

Let's do an example. Spells/Cast: 1

Double Cast > Spark Bolt > Spark Bolt > Spark Bolt > Light

1. The wand draws Double Cast.
2. Double Cast draws both Spark Bolts.
3. No spells are drawing anything more, so the cast finishes and the two Spark Bolts are shot.
4. Double Cast and the Spark bolts are moved from the Hand to the Discard.
5. Cast Delay is applied.
6. A new cast begins; Spark Bolt is drawn and shot and discarded, cast delay is applied.
7. A new cast begins; the wand draws Light.
8. Light tries to draw, but there is nothing in the Deck. A wrap is initiated. Double Cast and the three Spark Bolts are returned to the Deck.
9. Light can now complete its draw; it draws Double Cast.
10. Double Cast draws two Spark Bolts.
11. No more draw, the cast ends and the Spark Bolts are shot and discarded.
12. At this point, Light, Double Spell, and two Spark Bolts are in the Discard. Nothing is in the hand, and there is one Spark Bolt in the deck.
13. If the wand were to try to draw, it could draw spark bolt, but it does not try. Instead, it recharges the wand immediately because of the flag that was set when Light forced a wrap.

### Wrapping and Spells/Cast

A semi-important note is that draw generated by the wand itself cannot cause wrapping. For instance, when a 3 Spells/Cast wand with one projectile left in the Deck tries to draw for the second time, it will not wrap the wand even if there are available spells in the Discard. That is, the following wand will not wrap:

Spells/Cast: 3

It will shoot 3 spark bolts twice, then only a single spark bolt, even through there are ample spark bolts in the Discard to wrap to. This can be circumvented by having a spell do the wrapping, then letting the wand draw only after the wrap finishes:

Spells/Cast: 3

This wand will shoot 3 spark bolts twice, and then:

1. The wand draws Spark Bolt
2. The wand draws Light, and since spells can cause wrapping, the Discard is returned to the Deck when Light tries to draw. Light draws Spark Bolt.
3. The wand, for its third draw, draws the second Spark Bolt that has been returned to the Deck.
4. The wand recharges.

## Triggers

Triggers are the final thing we need to talk about in this introduction to the mechanics of Draw. You have likely noticed that modifiers applied to a spell with a trigger on it will not apply to the spells cast by that trigger and vice versa. How do we explain this? The answer is that trigger spells actually create an entirely new Cast State. The old Cast State is saved and set aside, and a new Cast State is used to keep track of everything that will be cast by the trigger. Once the evaluation of the spells inside the trigger completes, that Cast State is then finalized and attached to the trigger projectile, to be cast when the trigger detonates. Then, the old Cast State is reinstated, and normal evaluation continues.

Note that the hand and deck remain relatively unchanged during this process - the main mechanism that makes triggers work is the creation of the new Cast State.

Let's run an example (Spells/Cast: 1):

Here's how this is evaluated:

1. The wand draws Homing. Homing modifies the Cast State.
2. Homing draws Piercing. Piercing applies both the ability to pierce and -15 projectile damage to the Cast State. It also sets the Cast State's friendly\_fire value to True.
3. Piercing draws Spark Bolt with Trigger. Spark Bolt with Trigger saves the old cast state, sets it aside, and creates a new Cast State.
4. Spark Bolt with Trigger then draws Triple Cast.
5. Triple Cast draws Damage Up. Damage Up modifies the new cast state with +10 projectile damage.
6. Damage Plus draws Digging Bolt. Digging Bolt adds a projectile to the new Cast State but does not draw anything.
7. Digging Bolt completes. Damage Plus completes. Triple Cast draws the two remaining Digging Bolts, which each draw nothing and complete. Triple cast then completes.
8. Now, we return to the evaluation of Spark Bolt with Trigger. What happens now is we create a new projectile. The projectile we create is a Spark Bolt with the effect of casting the newly created Cast State when its trigger detonates.
9. The original Cast State is restored to its place. The newly created and custom projectile is added to the original Cast State. Spark Bolt with Trigger then finishes its evaluation.
10. Piercing completes, then Homing completes, then the wand's cast completes. When the wand's cast completes, the entire thing is cast.
11. At this point the Cast State includes the changes from Piercing, the changes from Homing, and the custom projectile created by Spark Bolt with Trigger. When the trigger detonates, three Digging Bolts with Damage Plus will be spawned.

That's triggers in a nutshell. The separation of cast states allows some cool effects - for instance, this wand shoots a spark bolt with friendly\_fire enabled, but enough negative damage that it won't do any damage even if it hits the player. It will, however, spawn high-damage Digging Bolts on contact - but since those are part of a separate cast state, they don't have friendly\_fire enabled and won't deal the player damage either. So this wand, even though it uses Piercing, damages enemies and not the player through the use of separate cast states.

## Conclusion

Hopefully you have a good understanding of how Draw works, along with the Deck, Hand, and Discard. The examples in this guide go into extreme detail on every step of the process to make sure you have a strong grasp on exactly what is happening, because that nuance will be very useful when it comes to understanding how spells like the Greek Letters, the Divides, and various other late-game spells are actually working.

Thanks for reading! If you want to learn more about general wand mechanics, you can check out the Calling and Recursion Guide.

If you want to learn about how specific spells work, you can read either the Divide By Guide (you're ready for it now) or the List of Advanced Spell Details (recursion guide recommended).

Written by Zoldort with help from Dipshit McGee (not-knower of Bolts and Blasts).