Expert Guide: Divide By Spells

The Divide By Spells are a series of very powerful spells with the effect of making copies of other spells. They work on just about any spell in the game, including themselves, with passives being a notable exception. They have a decent number of interesting traits that makes them exceptionally difficult to make proper use of, though. In some senses, the Divide By spells contain some of Noita's most difficult mechanics. The aim of this guide is to describe these strange traits and how to either avoid them or make use of them well.

It's extremely recommended to have read the Draw Guide before reading this. You will not understand much of what is said here if you do not have a very good understanding of what is happening in the draw guide. If, instead, you want a lighter introduction to Divides that covers most of the useful facts, the Divide By page will suit you well.

## Simple Divides

All Divide By spells fundamentally do the same thing. They do it different numbers of times, but the method is the same.

A single Divide By N spell can be summarized by the following actions:

1. Memorize the spell on the top of the deck. This is the target spell.
2. Cast a single copy of the target spell that is not allowed to draw
3. Cast N - 1 copies of the target spell that are allowed to draw
4. Discard the spell that’s currently on the top of the deck.

Instead of casting the target spell, the Divide spell casts a bunch of copies of the target, then discards it so the real version is never cast. That’s the idea, at least. Steps 2 and 3 in the summary above leads to a lot of often unintuitive behaviors for the spell. In a simple case though, like when a Divide targets most projectile spells (or any spell that doesn't draw), everything works as expected.

Simple example:

To start with, here's what happens, in detail, when Divide By 10 is drawn and cast:

1. It memorizes the spell on the top of the deck (Spark Bolt).
2. It casts a copy of Spark Bolt that cannot draw.
3. It casts 9 copies of Spark Bolt that can draw (Spark Bolt can't draw anything to begin with so 2 and 3 behave the same).
4. It discards the top card of the deck, which is Spark Bolt.

Here everything goes as expected and the wand produces 10 Spark Bolts.

## Dividing a Modifier

However, things are different and more complicated when a Divide is used on a spell that can draw, like this modifier:

1. D10 memorizes the spell on the top of the deck (Damage Plus).
2. It casts a copy of Damage Plus that cannot draw.
3. Then it casts the second copy of Damage Plus, which is allowed to draw. Since Damage Plus is a modifier, it does draw and it will draw the top card of the deck, the original Damage Plus.
4. The just-drawn original Damage Plus is immediately cast. Like its copy, it also draws once from the top of the deck, and this time Spark Bolt is there.
5. Now Spark Bolt is immediately cast, adding itself to the cast state from where it will later enter the world. Spark bolt has no draw which means that we're done with the draw of the second copy of Damage Plus.
6. D10 casts the third copy of Damage Plus, and it draws, but there is nothing left in the deck so we move on to the next one, This repeats until all copies have been cast.
7. After D10 has casted all of its copies, it then discards the top card in the deck. However, there are no more cards in the deck, so nothing can be discarded!

So we can definitely see some strangeness going on here. Not only did we end up with 11 instances of Damage Plus being cast instead of 10, the spells were cast in a dubious order. They were evaluated like this:

D10 > Damage Plus (copy 1) > Damage Plus (copy 2) > Damage Plus (original) > Spark Bolt > Damage Plus (copies 3-10)

## Discard Displacement

The above is quite bizarre, eh? Well, it only gets worse. In that example, D10’s final discard was harmless since there was nothing left in the deck. But look at this:

What happens here? In an ideal world, the expected result would be casting two Spark Bolts each with two Damage Plus modifiers attached. It is not so. Since the second copy of Damage Plus draws the original Damage plus, which in turn draws Spark Bolt, the top card on the deck is now the second Spark Bolt. When D2 finishes copying and tries to discard its target spell is actually the second Spark Bolt. So, the D2 goes right on ahead and discards it, despite the fact that the Spark Bolt wasn't what it was originally copying. This property is called "Discard Displacement," and it can either be a royal pain or a clever tool.

In this case, we are left with three instances of Damage plus and only one of Spark Bolt when double cast draws Wand Refresh. Note that Wand Refresh is in this example because otherwise the second draw from Double Spell would actually wrap the wand, move the second Spark Bolt back from the Discard to the Deck, and draw it. In other cases, this discard mechanic will not be so lenient in producing normal-seeming outcomes.

This example also showcases the first interesting trait of Divide By, its discard, and the ability to displace it. How to avoid and how to use this trait will be discussed in the end of the guide.

## Mechanics of Multiple Divides

If you're confused about the above sections, please try to figure everything out solidly by rereading or referring to the Draw guide, because it will only get more complicated from here.

Here's a simple example using multiple Divides:

The expected behavior here when D10 is drawn would be D10 making copies of the D4, which is the top card of the deck. D4 would then copy the top card of the deck which is.. D4 again? That doesn't look right. And that's because it isn't.

The second interesting trait of Divide By spells, "Iteration" makes its first noticeable appearance. When a Divide By spell is cast, it has an internal counter called "Iteration" increased. This iteration counter is what decides what spell to target for copying, and how many spells it should discard on resolution. In all of our previous examples, the iteration counter has been 1. This is always the case when dealing with only a single Divide By spell.

However, when a Divide By spell copies another Divide By spell, the iteration counter increases by 1. So, in the above example, D10's iteration is 1, while the D4's iteration is 2 (D10's iteration + 1).

When the iteration counter is 1, the Divide spell targets the first spell from the top of the deck. When it's 2, it targets the second spell from the top of the deck. if it's 3, the third, and so on.

So, let's take another look at this example with knowledge of how iteration works and figure out what's happening.

The D10 has iteration = 1, so it targets the first card in the deck, which is the D4. The copy of the D4 has iteration = 2, having been told that fact by the D10 that cast it. As such, it looks at the second spell from the top of the deck, which is Spark Bolt. It then casts 4 copies of Spark Bolt. The copy of D4 finishes, evaluation returns to the D10, which makes another copy of D4, which targets Spark Bolt again, casting 4 Spark Bolts. In total, 40 Spark bolts are cast, just as one would expect.

But wait! We forgot to discard when D4 finished! Whenever a Divide By finishes evaluation, it discards the top card on the deck, right? So, the first copy of D4 should... discard the real D4. Then, the next copy of D4 should try to look at the second card in the deck... which is nothing, because there's only Spark Bolt in the deck. Oops? As you can guess, this is not what actually happens, and we are missing a detail.

That detail, and the last peculiarity about the iteration count, is that Divides will only cause discards at the end of their evaluation if their iteration count is 1. That is, if it's the very first Divide in a chain of Divides. So, the copy of D4 with iteration = 2 will not discard anything as it finishes, and the state of the deck is preserved. And so evaluation returns directly to the D10, and it casts its second copy of the D4, which can properly target the second card in the deck, which is Spark Bolt. everything is well.

However, to support this change, D10 has to discard the extra card that D4 didn't. So, at the end of it all, the D10 discards two cards - both the D4 and the Spark Bolt. That way, Spark Bolt ends up being cast exactly 40 times, no more, no less.

So a Divide actually discards a number of cards equal to the iteration count of the final Divide in the chain, thus discarding all the spells involved in that chain. The way this happens behind the scenes is that, just as the iteration counter is passed down the chain of Divides, the maximum depth of the chain is passed back up to the initial Divide. The initial Divide then uses that number to know how much to discard.

Okay, nice! That's how the iteration counter works. Again, this was an example that behaved exactly as we expected, but - of course - not all examples will be like that. The next one in particular. Time to apply our knowledge.

## Multiple Divides on a Modifier

What happens? Try to work it out for yourself, as practice, before continuing. You should have the information you need.

Here's the (very complicated and verbose) result. Try to understand it all, everything here is based on what you've learned so far, and this is the heart of how Divides work. Here we go:

* D10 targets D4
* D10 casts copy of D4 with draw disabled
	+ Copy of D4 (iter 2) targets Damage Plus (second card in deck)
	+ Copy of D4 casts copy of Damage Plus with draw disabled
		- Damage is added, nothing else happens
	+ Copy of D4 casts copy of Damage Plus with draw enabled
		- Damage is added, but a draw happens
		- The top card in the deck is the real D4. It is drawn and cast.
			* The real D4 has iteration 1, since it was not cast by another Divide
			* Real D4 targets the top card in the deck (Damage Plus)
			* Real D4 casts copy of Damage Plus with draw disabled
				+ Damage is added, nothing else happens
			* Real D4 enables draw and casts the second copy of Damage Plus
				+ Damage is added, then the top card of the deck is drawn and cast. It is the real Damage Plus
					- Real Damage Plus adds damage and draws a card. It draws Spark Bolt
						* Spark bolt prepares itself for later, does nothing else
			* Real D4 casts the third and fourth copy of Damage plus that it memorized
				+ The two copies each add damage and draw, but the deck is empty at this point
			* Real D4 finishes evaluation and discards one card, but the deck is empty
	+ Evaluation returns all the way back to the copy of D4 that D10 made.
	+ Copy of D4 casts two more copies of the Damage Plus that it memorized
		- Each of the add damage and draw a spell, but the deck is empty, so nothing happens.
	+ Copy of D4 checks if it should discard anything, but it is iteration = 2, so it does not.
	+ Copy of D4 reports that it was the final Divide in the chain and sends this information back to D10
* Evaluation returns to D10. It saves the maximum chain depth of 2.
* D10 casts its second copy of the D4 that it memorized.
	+ Copy of D4 with iteration 2 looks to the second card in the deck as its target.
	+ There is no second card in the deck. This copy of D4 can't do anything. It completes.
* D10 casts the third through tenth copy of the D4 that it memorized.
	+ None of them do anything, since there is no second card in the deck.
	+ Every one of them tell D10 that the chain is 2 Divides deep.
* D10 has finished making copies. Now, to discard. Every one of its copies returned the same max iteration value of 2.
	+ If this is somehow not the case, the D10 actually only cares about what the last copy told it. In this case, it's still 2.
* D10 discards the top 2 cards from the deck. The deck is empty, so this does nothing, but it tries.
* D10 completes. The end.

What was the final result? If you count, 9 Damage Pluses were cast in total, instead of the 40 that you would expect by an intuitive estimation. You can perform this test in game to verify the result. If you do, add elemental damage instead of projectile damage so that it won't get removed by the negative damage of the Divide spells.

In any case, 9 out of 40 is pretty bad. We would like our Divides to not work like this. Is there a way to fix them? The next mechanic will show us how.

## Iteration limit

The final mechanic of Divides is the iteration limit. It's definitely one of the more well-known of the Divide By spell's mechanics, and it exists in order to prevent you from creating utterly obscene numbers of copies, In short, there is a limit to how many Divides you can put in a row and still get results.

The way that this works, specifically, is that when a Divide spell is cast, it checks its iteration counter. If it is too high, it acts as a Divide By 1: It does targeting as is expected for its iteration level, but it only casts a single copy of its target. That copy, as with the first copy of all Divides, does not have draw enabled. Can you see how this can help? Drawing from the deck in the middle of evaluating the Divide chain destroyed it, and this is a way to prevent all draw.

The idea is that if the final Divide in a chain is only making copies that do not draw, and all the earlier Divides are only making copies of later Divides (which do not draw), then nothing in the entire chain is generating any draw at all. This means that the state of the deck will remain unchanged while all of the Divides properly finish executing.

So, what are the specifics? When does a Divide By spell turn into a D1? As the name "Iteration Limit" implies, it's based on the iteration counter. For a D10, iteration = 3 is too much. For D3 and D4, iteration = 4 is too much. and for D2, iteration = 5 is too much. If any Divide spell is at or above that iteration counter, it will only make a single copy that does not draw.

That means that D10 > D10 > D4 > D2 produces the maximum number of copies possible, clocking in at 800. And additional Divides would be past their recursion limit. Note that a reordering, as in D4 > D10 > D10 > D2, would not work, because then the second D10 would have iteration = 3, which is too high. It must be exactly D10 > D10 > D4 > D2. However, this will produce half of the copies with draw enabled for 400 hypothetical draw, so this exact setup will only work well on a projectile which will not draw at all.

To maximize copies on things other than projectiles, we need to make use of the iteration limit. Here's a way to do so:

How can we use this to our advantage? Take a look:

Ready to do another evaluation tree? This is the last one, and it's much simpler than before.

* Double Cast
	+ D10 (1) targets D10 (2)
	+ D10 (1) casts copy of D10 (2)
		- Copy of D10 (2) targets D10 (3)
		- Copy of D10 (2) casts first copy of D10 (3)
			* Copy of D10 (3) targets Damage Plus
			* D10 (3) casts copy of Damage Plus with draw disabled
				+ Damage Plus adds damage but cannot draw, so nothing else happens
			* D10 (3) is past the iteration limit, so immediately terminates after 1 copy
		- Copy of D10 (2) casts its remaining 9 copies of D10 (3) one by one
			* Each copy of D10 (3) makes a single copy of Damage Plus
				+ None of the copies of Damage Plus can draw, since they are each the first copy
			* Each D10 (3) reports that it is the bottom of the Divide chain
		- Copy of D10 (2) completes and reports that it is the second from the end of the Divide chain
	+ Evaluation returns to D10 (1)
	+ D10 (1) casts the remaining 9 copies of D10 (2)
		- They all proceed exactly as the first one did, ultimately casting 10 copies of Damage Plus each
		- Each reports that they are second from the end of a Divide By chain
	+ D10 goes to discard. It knows that it is third from the end of the chain, so it discards 3.
	+ The top card in the deck in now Spark bolt
* Evaluation returns to the original Double Cast, which uses its remaining draw to draw Spark Bolt.
	+ Spark bolt is cast.

And so we get 100 copies of Damage Plus, each with no draw with which to ruin the deck. Note that without the original Double Cast, the Spark Bolt would not have been drawn at all, leading to 100 Damage Pluses being cast without any projectiles for a worthless effect. But with the Double Cast, we got what we wanted, which was 100 Damage Plus on a single Spark Bolt.

The lesson here is that if you want to use Divide on a spell that causes draw, like a modifier, either use a D1 equivalent at the end of the Divide chain to cancel all draw, or use only a single Divide and be ready to deal with the fact that it will draw a whole lot of the rest of your wand while casting copies of the modifiers.

(Using a D2 > D10 will also work for 20 copies, because the deck has not collapsed yet when the second D10 copy is made, but anything higher than a D2 will still only create those same 20 copies).

That's mostly everything! If you've gotten this far and understand it, you can call yourself a Divide By expert. It's one of the most powerful spells in the game, so use it well!

## Miscellany

There are some other tidbits that ought to be in a definitive guide on the Divide By spells, but they are isolated bits of less important knowledge, so they're all going into this section.

### Dividing Mu

Mu is a curious case. It’s a prime target to be divided, because doing so is equivalent to dividing all of the other modifiers on your wand, but it doesn’t really work so well. This is because Mu also manipulates the dont\_draw flag in the process of copying modifiers, and so Mu ends up overwriting the fact that Divide has told it not to draw anything. Mu will always draw 1, regardless of whether or not it had draw disabled. This is a nuisance! The D1 trick to cancel draw does not work, and so it’s seemingly impossible to cast more than 21 copies of Mu at once (with D2 > D10 > Mu). If you do want to divide a Mu, you’ve got to deal with the draw it generates. Usually the best way to do this is to place it at the end of the wand, when the deck is empty and draw does nothing.

### The Damage Penalty

You might wonder how the negative damage of the Divide By spells works. The answer is that it’s applied to the Cast State once every time an instance of a Divide spell is cast. That means that for D10 > spark bolt, one damage penalty of -37.5 is applied. For D10 > D10 > spark bolt, 11 damage penalties are applied. In the earlier example of Double Cast > D10 > D10 > D10 > Damage Plus > Spark Bolt, 111 damage penalties are applied, each of them -37.5 damage each. So, there are obviously some drawbacks - the example doesn’t end up doing any damage whatsoever. However, D10 is a late-game spell, and its damage reductions are negligible in the face of Gold to Power (adds 10k damage per application after you've farmed infinite money) or Blood to Power (adds more).

### Cast Delay, Recharge Time, and Mana Drain of Copied Spells

All of them are irrelevant and discarded. Only the first Divide out of a whole chain of Divides and its target will do any of the three above things. All of them will reduce damage, however.

### Wrapping Strangeness

Wrapping happens when a card tries to draw from the deck, but it is empty and the discard has some cards in it. Normally, using spells in a cast will leave them in the hand and unable to be wrapped to, but the Divide spells send cards to the discard instead of leaving them in the hand. Therefore, you can wrap to them without starting a new cast. This leads to strange consequences.

Let's reexamine the latest example, but change one thing:

Instead of a Double Spell, we have a Quad Spell. What do you think will happen? It's, like everything else, somewhat strange. The first and second casts do the same thing as the example above, namely casting 100 copies of Damage Plus and the lone Spark Bolt. At that point, the discard contains D10, D10, and Damage plus, having been discarded by the first D10, and the hand contains Quad Spell, D10, and Spark Bolt.

What happens when the Quad Spell takes its third draw? The wand wraps, of course, leaving the D10 > D10 > Damage Plus in the deck. This evaluation will proceed exactly as we have seen before, casting 21 copies of Damage Plus and drawing through the entire deck. Then, when Quad Spell takes its fourth draw, the deck is empty. So in the end, we are left with 21 extra copies of Damage plus by adding a single extra draw and wrapping the wand in an unintuitive way. This can be beneficial, and it can be a pain in the ass. Just be aware.

## Conclusion

That's all! I hope you enjoyed the guide and now understand these spells more than you did before.

Written by Zoldort with help from Mahtisauvanoita Nira.

For further reading on gritty wandbuilding details, check out the Calling and Recursion Guide and the List of Advanced Spell Details.