using Assets.Scripts.Player;
using Node = Assets.Scripts.Events.GameEvent.Node;
using Option = Assets.Scripts.Events.GameEvent.Option;

namespace Assets.Scripts.Events
{
    public class SpecialEvents : EventBuilder
    {
        public SpecialEvents () : base(Act.Epilogue) { }

        protected override void AddEvents() {
            AddSpecificEvent("Intro",
                new Node("Since time immemorial, great heroes rose to the challenge when the forces of evil threatened their homelands. The time has come once again - a dark power stirs in the castle ruins beyond the village of the damned, and great heroes were sent to deal with it...",
                    new Option("Continue") {
                        NextNode = new Node("However, when great heroes fail, the Queen calls forth all the brave people she can find. When those too failed, she resorted to hiring unemployed mercenaries down at the local pub. What could you say? This whole evil rising stuff has been bad for the economy.",
                            new Option("Continue") {
                                NextNode = new Node("You are led to the castle by a woman in her 30s. She wears the clothes of the streets, but her beauty is like royalty. She's been sent by the Queen to find adventurers for this task, and she's now leading you to an audience with the Chancellor, who shall arrange the details.",
                                    new Option("Accept this glorious task"),
                                    new Option("Reluctantly accept this task"),
                                    new Option("Refusal of the call to adventure") {
                                        NextNode = new Node("Well, we all know how permanent those refusals are. You're going anyway.",
                                            new Option("Fine."),
                                            new Option("Actually, I wanted to go back to the main menu...") {
                                                NextNode = new Node("Argh, seriously? But wh- Ah, nevermind. What do I care, anyway. I hope you're happy with the knowledge that the world shall be consumed by darkness and you don't even care.") {
                                                    PostEffect = c => c.GoToMainMenu()
                                                }
                                            }
                                        )
                                    }
                                )
                            }
                        )
                    }
                )
            );

            AddSpecificEvent("GameOver",
                new Node("\"My Queen, we have received news that the unemployed mercenaries that you've hired to rid us of evil have failed.\" \"Sigh... let's try again, there's an endless supply of those, anyway.\"", new Option("Game Over")) {
                    PostEffect = c => c.GoToMainMenu()
                }
            );

            AddSpecificEvent("Finale",
                new Node("At last, all the trust and 30 gold that Her Majesty entrusted to some unemployed adventurers at a local pub has paid off. Dracula lies defeated. You can sense the darkness receding... slightly. Somehow, something seems off. Is this really the end?",
                    new Option("Continue") {
                        NextNode = new Node("Unable to shake the feeling that you're forgetting something, you ponder what it might be, as you stare at a very life-like statue of a necromancer woman, in front of you. The chanting of the cultists can be faintly heard in the distance, and you decide that you've done your job, and should just go home, now.") {
                            PostEffect = c => c.GoToCredits()
                        }
                    }
                )
            ).TriggerCondition = stats => stats.CultistsDefeated < 3;

            AddSpecificEvent("TrueFinale",
                new Node("Dracula and the Necromancer that summoned him lie defeated. You've done your duty, and beyond. You've cleansed this land of evil for another century. You think back to all the sacrifices you've made in the trip, and smile. It was worth it - that thought entertains you as you travel back home.",
                    new Option("Continue") {
                        NextNode = new Node("Upon hearing that you had actually not only completed your quest, somehow, but also defeated the true mastermind behind it, the Queen seems content with the 30 gold she spent on you. A modest banquet is thrown in your honour, and tales of your efforts endure through the ages...",
                            new Option("Continue") {
                                NextNode = new Node("\"Are you not satisfied, my Queen?\", says the Chancellor. \"Sigh... I'll just miss hanging around with those unemployed adventurers at the pub, pretending to be a city girl, trying to find those brave enough to follow my quest.\" \"Well, worry not, my liege... we can always arrange for a Necromancer again.\"") {
                                    PostEffect = c => c.GoToCredits()
                                }
                            }
                        )
                    }
                )
            ).TriggerCondition = stats => stats.CultistsDefeated == 3;
        }
    }
}
