The reaction to the sudden arrival of Trixie, Rarity and Applejack to the castle was immediate. It couldn't be different, since Trixie had utterly destroyed what passed by "wards" for a chaos master like Discord (mostly, things that turned you into a fish if you tried to pass through) in order to actually enter the castle with a teleport. It was loud and obvious, which would be fine if the team was serving as a distraction, but they were in fact the only attack force. Attracting all the attention was a problem, but one they would have to surmount. Trixie knew this would happen, but decided that it was better than wasting any more time.
But anyway, the reaction was immediate, and the first threat they faced was a bunch of paintings throwing themselves at them. And that wasn't all, because the subjects of the paintings started coming halfway out of their portraits, and they started charging magic (most were unicorns, but the earth ponies were managing a glow from their hooves and the pegasi from their wings). Both Rarity and Applejack knew that Trixie wouldn't be able to use a big spell so soon after that teleport, so the farmer raised a hoof and hastily charged magic before bringing it down and making the floor shake, making the earth pony and unicorn portraits stumble. Then Rarity activated her trusty telekinesis and one-upped her, fouling the pegasi portrait's wings and at the same time pulling on the hooves of the others, making all the chaos portraits fall to the ground.
Upon seeing that, Trixie didn't hesitate. She started galloping in the direction of the portraits while charging magic, and released her spell before they had a chance to get up.
"Perfect Illusion: Space Warp!" But instead of hitting the portraits, Trixie targetted the castle itself, taking advantage of the great amount of chaotic energy that had subsumed it to make the castle itself think the ponies should be a few rooms ahead (the maximum she could get on such short notice). This was essentially tricking the castle into chaotic teleporting them. Upon having a moment to breathe, Trixie called Applejack, who focused on her Eyes of Truth again and indicated a direction. The Knight and her apprentices resumed their movement through the castle, and it took more than half a minute for the next layer of defenses to hit them, enough time for Rarity to ask about something.
"Trixie dear... What's that floating sphere you have there?" Rarity was referring to a sphere of light that was floating beside the showmare.
"That's my way of being able to use big spells easily." Trixie said proudly "It's the Sphere of Charge, a special magical construct that can contain a big amount of magical power for me to use at any time. I actually finished creating the construct today, but didn't have a chance to charge one with magic, but the magical formation made it easy to do so now."
"Ah get it." Applejack said "Then Ah guess there should be a reason why ya haven't got more than one of those."
"Very perceptive of you, Applejack." Trixie sighed "This thing is actually fairly hard to control and takes a lot of concentration to maintain. I can't do more than one yet."
Their response to that would have to wait, because the three were attacked again, this time by a squidlike creature apparently made out of tons of pieces of armor fused together awkwardly. It moved on seventeen tentacles and quickly got up close to them. However, this time Trixie was completely ready to deal with problem, and she charged up a spell to show Rarity and Applejack that she would field that one.
"Perfect Illusion: Mistaken Movement!" And this time she attacked the opponent directly. Trixie would have moved them forward again if she could, since time was of the essence, but chaos magic resisted doing the same thing consecutively, so it would be very hard and tiring to force the castle to comply. Instead, Trixie decided to simply make the obstacle in front cease to be one, and her spell was designed to hinder the target's ability to control its own movements. Which would be specially effective on something that had such a complicated way of moving.
And it worked, the chaotic squid fell on its side and started twitching, unable to get its "legs" back under itself. The three ponies passed it from the side opposite to the legs and kept going.
And that was when the castle decided to stop being cute and actually start attacking by itself. Floor and ceiling bent and met each other like a closing jaw, the walls started growing hands, hooves, horns and weirder apendages to try to grasp, crush, skewer and generally harm the ponies, entire sections of architeture set themselves on fire, vomited acid or started freezing up. It was much harder for Trixie to deal with than the comparatively straightforward castle defenses of Sombra, and she would have been totally unable to do it were it not for her experience dealing with Twilight's chaotic spells, which meant she could predict what the castle was trying to do by feeling the energy, and she could interfere with the chaotic magic effects via her illusions. The fact that the "mind" behind all those attacks was fairly simple and couldn't easily deal with the interference made it easier.
She couldn't have done it by herself though. Having to deal with the continuous stream of attacks from the castle would take away her magic faster than it could replenish itself, and Trixie would probably have to use her Sphere of Charge in a single powerful attack in order to temporarily disable the castle and give her the chance to keep going. However, she wasn't alone, Rarity and Applejack perfectly understood that their best role in this battle would be to buy Trixie some time to recover. They took turns doing so, since neither of them was skilled enough to deal with the threats presented by the castle without exhausting their own magic reserves, and the three ponies settled in a rhythm that went Applejack, Trixie, Rarity, Trixie again and back to Applejack, maximizing their effectiveness.
Rarity was mostly using her telekinesis to deal with things (removing pieces of the ground to act as shields, breaking supports to bring down parts of the roof, holding back things that were thrown at them), but also managed to make good use of the anti-chaos spell (she was getting a lot of practice with it), and even managed to take some basic unicorns spells a lot further than she would have believed possible, like when she transmutated an attacking carpet into salt, and when she used her gem-finding spell to fly towards a candelabra. Applejack, on the other hand, was a lot more limited on what she could do, having to keep manipulating the envinronment by using her Eyes of Truth combined with her own innate earth pony magic to locate weak points both structural and magical, and she soon discovered that the excess chaos magic all around made it so it was actually easier to do complicated shapings of the earth than it would be to simply break things. Applejack kept the ground under their hooves moving to make them faster, created her own earth apendages to counter-attack and even created cannons to shoot at whatever was a threat. She was actually feeling like a unicorn.
While Trixie, of course, was the MVP. Each of her spells had a much bigger effect than either Applejack or Rarity could do, allowing the three ponies to cross for a bigger distance before the castle "recovered" and sent the next attack after them. Trixie's illusions seemed to have no end to them, creating countless copies of the three to confuse the targetting of the attacks, making parts of the castle read as "intruders" and be blasted by the defenses, increasing the effectivity of her apprentices by using a spell that made them believe they could do more, actually giving them the ability, creating a temporally ally via a spell that made the chaos magic think it would be a good idea to "give them a fighting chance"... Her two apprentices understood more and more why Trixie was one of the protectors of the realm.
Still, all three of the ponies were getting more and more tired, it was mostly their sheer determination to save the princesses that kept Applejack and Rarity from weakening, and even with her special training, Trixie was starting to have trouble concentrating. Her mental fatigue was, in fact, the biggest issue. She was still looking at the chaotic fight and having to maintain her Sphere of Charge, not to mention all the complicated spells she was doing. Thankfully, they managed to reach the end before getting to their limits.
"Almost there!" Applejack shouted, then she stomped on the ground, making it break and forcing Rarity to use her telekinesis to help make their descent into the lower floor more soft. She also quickly cleared away the cloud of dust formed by their landing, allowing all three of the ponies to finally see their goal.
Celestia and Luna were trapped together, which really made it easier to use one single spell to free both (as Trixie had planned). That was the good news, the bad news was the fact that Discord seemed to have given special attention to the construction of their prison. The whole room was a single, massive chaotic being, and it made every other chaotic being they had seem before seem straightforward. The ground and walls seemed to have the consistence of a tongue and were constantly contracting and relaxing like a beating heart. The walls on their sides were full of eyes and other facial features, as well as windows, lamps and nails. The ground was full of leg-like tendrils, made of rocks, water, glass and all sorts of other materials, and containing claws, fangs, knives and other threatening, pointy things. The wall in front of them was the place the princesses were trapped in, and protuding from it were tentacles made from all sorts of small animals and objects connected together, and each tentacle seemed to have its own magic.
This was such an impossible creature that it was only the energy it was constantly draining from the princesses that kept its existence stable.
Trixie assessed the situation quickly, and gave her apprentices some very simple instructions.
"Give me time to charge this spell, and this will be over."
Then she started galloping on the direction of the princesses, charging magic at the same time.
Applejack and Rarity were only a step behind, and they took their focus to the limit, knowing their teacher was trusting them to protect her. Just before they got to the tendrils, Applejack overtook Trixie and pushed her magic down, to beyong the floor of the room until she found actual ground she could manipulate. That earth was brought upwards and formed a barrier around the charging ponies, a barrier that had an arrowlike tip and kept moving at the speed of the galloping ponies like a high-speed tank, and started to plow through the tendrils. Rarity, for her part, used her telekinesis to the very limit, both forcing the tentacles to point in other directions and throwing bits of stone at lethal speeds to try and damage them. She couldn't get all the tentacles, but Applejack's earth tank managed to resist the attacks it had to. This lasted for a few seconds.
And Trixie finished charging her spell.
"In the middle of chaos, my route is firm..."
And Trixie teleported.
She only went a few meters forward, enough to be able to touch the wall with the princesses, but doing so at the very heart of the chaos Discord had created made it the hardest teleport the azure unicorn had ever done in her life. Even Twilight's teleportation counter-measures didn't force her to go to such lenghts to bypass them. Trixie had exhausted every scrap of power in her body, and it would take more time than she had to recover enough magic to do anything impressive.
But she didn't need to wait, because her Sphere of Charge was still there. And as soon as the teleportation sinished, Trixie started a new spell.
"Those divided will fall..."
A spell has three components. The first is the very will to change the world. The chanting done before using certain spells was a way to focus the will to allow greater feats of magic. The second was the energy needed for the spell, and Trixie could use the energy she had prepared. The third was the structure of the spell, the spell formula that directed the magic.
This was the part that gave Trixie trouble.
Despite being taken by surprise, the tentacles on the wall reacted quickly enough that the Knight only had seven tenths of a second to build her spell. Usually this would be far more than enough, but this was the last defense Discord had put to keep the princesses contained. This was a creature of chaos so powerful and complex it resisted any normal methods that could be used on others, so Trixie had to do something particularly special.
The showmare Knight expanded her awareness and wrote the spell formula as she took in the state of each part of the creature. It would be impossible if she didn't have experience with Twilight's chaos magic, and even then, there were some things she had never seen before and had to work out counters to from first principles. The formula kept getting more and more ridiculously complex, adapting to affect every part and every effect and every scrap of energy of the creature. Trixie abandoned her remote viewing spell, knowing she simply had no way of maintaining her concentration on it while creating that spell.
The azure unicorn experienced a subjective time of minutes during the small window of time she had, simply because her sheer concentration made her hyper-aware of every thousandth of a second. Creating that spell was like a journey through several dangerous lands, and by the time it was over, Trixie felt slightly different herself. But she didn't have time to think about it.
"Perfect Illusion: Chaos Break!"
And the stored magical power Trixie had been carrying exploded into the horrendously complicated spell formula Trixie had just put together, and then expanded, infusing itself in every single bit of the creature, where the spell took effect.
Chaos Break was a complicated spell, but simple to explain. It made half of the creature perceive the other half as being made of pure order, its very opposite. And did this for both halves. The monster attacked itself in the most basic of ways, spending an insane amount of magic in a fruitless attempt to remove the other half, which was doing exactly the same thing. The thing dissolved, dumping the ponies in another room. Trixie saw that the princesses were free.
That was when the pain hit.
"AAAAARGHHH!" Trixie screamed, holding her head.
It was like something was splitting her head open. Doing such a complex spell so fast had strained Trixie's mind more than anything she had ever done. Trixie tried to endure the pain for two excruciating seconds, before she felt wings coming around herself, and realized there were no enemies present, so she didn't have to act tough. Trixie let tears come to her eyes and sobbed quietly while her teacher did her best to confort her.
Meanwhile, Princess Luna was talking with Rarity and Applejack.
"So you are some of the apprentices I've heard so much about. Your actions really are worthy of heroes." Luna said praisingly.
"Thank you, your highness, you are too kind." Rarity said politely,
"That was just what Ah had to do, Princess." Applejack said her own piece.
"It seems like you have been pushing yourselves hard. How do you feel now?" Luna asked, casting a spell to remove fatigue.
"That's amazing! Thank you, Princess!" Rarity felt like she could do the entire adventure all over again.
Applejack had similar thoughts, and she saw that Trixie was receiving the same treatment from Celestia.
"Hello, Princess." Trixie said when her headache became easier to bear.
"Hello, to you too, my student." Celestia said "How are things going?"
Trixie felt well enough to reestabilish her remote vision spell, and her blood ran cold.
"Princess! You have to send us back, now!" Trixie shouted, and joined her magic with Celestia's in a practiced way, making a hasty teleportation spell that sent the three heroic ponies back to Ponyville.
Celestia knew things were bad because of how Trixie had acted, so she made her decision quickly.
"Luna, go free this city from chaos, I'll see what I can do to help against Discord."
Luna nodded and teleported out, and Celestia did a remote vision spell of her own, hoping things would not end up in the worst case scenario.