UNIT temp1 = @U("Scantid (Desert)")
UNIT temp2 = @U("Ursadon (Ice World)")
UNIT Answer = @U("Kakaru (Twilight)")
UNIT Multiplier = @U("Floor Gun Trap")
UNIT Multiplicand = @U("Ragnasaur (Ash World)")
INTEGER BinaryCountOff1 = 15 // This sets the max dividend to 2^16 // If you change the 5 here you must also change it at line 14
INTEGER BinaryCountOff2 = BinaryCountOff1
INTEGER Variable1 = 0
INTEGER Variable2 = 0
TRIGGER
OWNERS: @P(1)
CONDITIONS:
ACTIONS:
Comment("Multiplication")
ENDT
FOR ReplicateEverything = 0 TO 15 DO // This sets the max dividend to 2^16 // If you change the 5 here you must also change it at line 6
Variable2 = BinaryCountOff2
FOR Variable1 = BinaryCountOff2 TO 0 BY -1 DO
TRIGGER
OWNERS: @P(1)
CONDITIONS:
	Switch(@S("Switch3"), @Set)
	Deaths(@CurrentPlayer, @AtLeast, 2^BinaryCountOff1, Multiplier)
	Deaths(@CurrentPlayer, @AtLeast, 2^Variable2, Multiplicand)
ACTIONS:
	SetDeaths(@CurrentPlayer, @Subtract, 2^Variable2, Multiplicand)
	SetDeaths(@CurrentPlayer, @Add, (2^BinaryCountOff1) * (2^Variable2), Answer)
	SetDeaths(@CurrentPlayer, @Add, 2^Variable2, temp1)
	PreserveTrigger()
	Comment("")
	ENDT
Variable2 = Variable2 - 1
ENDL
FOR Variable1 = BinaryCountOff1 TO 0 BY -1 DO
TRIGGER
OWNERS: @P(1)
CONDITIONS:
	Switch(@S("Switch3"), @Set)
	Deaths(@CurrentPlayer, @AtLeast, 2^Variable1, temp1)
ACTIONS:
	SetDeaths(@CurrentPlayer, @Subtract, 2^Variable1, temp1)
	SetDeaths(@CurrentPlayer, @Add, 2^Variable1, Multiplicand)
	PreserveTrigger()
	Comment("")
	ENDT
ENDL
TRIGGER
OWNERS: @P(1)
CONDITIONS:
	Switch(@S("Switch3"), @Set)
	Deaths(@CurrentPlayer, @AtLeast, 2^BinaryCountOff1, Multiplier)
ACTIONS:
	SetDeaths(@CurrentPlayer, @Subtract, 2^BinaryCountOff1, Multiplier)
	SetDeaths(@CurrentPlayer, @Add, 2^BinaryCountOff1, temp2)
	PreserveTrigger()
	Comment("")
	ENDT
BinaryCountOff1 = BinaryCountOff1 - 1
ENDL
FOR Variable1 = BinaryCountOff2 TO 0 BY -1 DO
TRIGGER
OWNERS: @P(1)
CONDITIONS:
	Switch(@S("Switch3"), @Set)
	Deaths(@CurrentPlayer, @AtLeast, 2^Variable1, temp2)
ACTIONS:
	SetDeaths(@CurrentPlayer, @Subtract, 2^Variable1, temp2)
	SetDeaths(@CurrentPlayer, @Add, 2^Variable1, Multiplier)
	PreserveTrigger()
	Comment("")
	ENDT
ENDL
