From b3e4e8a219229ea90b3c3cfacc91ed625e12f7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gallet?= Date: Sun, 21 Jun 2020 20:14:30 +0200 Subject: [PATCH] Skip Rosie fight --- SWD2Randomizer/Patcher.cs | 116 ++++++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 37 deletions(-) diff --git a/SWD2Randomizer/Patcher.cs b/SWD2Randomizer/Patcher.cs index 4fc12d0..b89f7fd 100644 --- a/SWD2Randomizer/Patcher.cs +++ b/SWD2Randomizer/Patcher.cs @@ -22,6 +22,7 @@ public void PatchAll() PatchTriple(); PatchOasis(); PatchBlueprints(); + PatchRosie(); } /* Make the ignition axe effective against Priest Glorious */ @@ -76,53 +77,27 @@ public void PatchHook() /* Open Oasis front gate */ public void PatchOasis() { - string hubPatch = Path.Combine(baseDir, "Patchsets", "TheHub", "the_hub_patch_entrance.le"); + string levels = Path.Combine(baseDir, "Definitions", "levels.xml"); XmlDocument doc = new XmlDocument(); try { - doc.Load(hubPatch); - } - catch (Exception) - { - Console.WriteLine("caught exception"); - } - - XmlNode door = doc.SelectSingleNode("//CustomEntity[Id='32586370']"); - - if (door != null) - door["Property"]["Value"].InnerText = "True"; - -/* XmlNode target = doc.SelectSingleNode("//Connection[TargetId='32566844']"); - target["TargetId"].InnerText = "32575030"; -*/ - doc.Save(hubPatch); - - string quests = Path.Combine(baseDir, "Definitions", "quests.xml"); - - try - { - doc.Load(quests); + doc.Load(levels); } catch (Exception) { Console.WriteLine("caught exception"); } - XmlNode questHub1 = doc.SelectSingleNode("//Quest[@Name='quest_find_the_hub']"); - questHub1.Attributes["Template"].Value = "SIDE_QUEST"; - questHub1.RemoveChild(questHub1["UnlockedBy"]); - questHub1.RemoveChild(questHub1["PopupMap"]); - questHub1.RemoveChild(questHub1["Pointer"]); - - XmlNode questHub2 = doc.SelectSingleNode("//Quest[@Name='quest_reload_the_hub']"); - questHub2.Attributes["Template"].Value = "SIDE_QUEST"; - questHub2.RemoveChild(questHub2["UnlockedBy"]); + XmlNode hubIntro = doc.SelectSingleNode("//Level[@Name='the_hub']/LayerFilters/Filter[@Layer='filter_intro']"); + hubIntro.ParentNode.RemoveChild(hubIntro); - XmlNode questRosie = doc.SelectSingleNode("//Quest[@Name='quest_talk_to_rosie']"); - questRosie["UnlockedBy"].InnerText = "quest_report_to_mayor_jackhammer"; + XmlNode hubPostIntro = doc.SelectSingleNode("//Level[@Name='the_hub']/LayerFilters/Filter[@Layer='filter_post_intro']"); + hubPostIntro.InnerXml = @" + + "; - doc.Save(quests); + doc.Save(levels); } /* Lower the price of triple grenade blueprint */ @@ -321,12 +296,12 @@ public void PatchIntro() QuestName String - quest_reload_the_hub + quest_enter_temple ObjectiveName String - obj_reload_the_hub + obj_enter_temple Increase @@ -379,5 +354,72 @@ public void PatchBlueprints() doc.Save(upgradeList); } + + /* Make Rosie fight trivial */ + public void PatchRosie() + { + string hubmain = Path.Combine(baseDir, "Patchsets", "TheHub", "the_hub_patch_main.le"); + + XmlDocument doc = new XmlDocument(); + try + { + doc.Load(hubmain); + } + catch (Exception) + { + Console.WriteLine("caught exception"); + } + + XmlNode doorLevel = doc.SelectSingleNode("//ScriptEntity[Id='32595987']/Property[Name='DestinationLevel']"); + doorLevel["Value"].InnerText = "the_hub_cave_boss_saving_rusty"; + + XmlNode doorEntity = doc.SelectSingleNode("//ScriptEntity[Id='32595987']/Property[Name='DestinationEntity']"); + doorEntity["Value"].InnerText = ""; + + doc.Save(hubmain); + + + string bosses = Path.Combine(baseDir, "Definitions", "entities.bosses.xml"); + + try + { + doc.Load(bosses); + } + catch (Exception) + { + Console.WriteLine("caught exception"); + } + + XmlNode rosie = doc.SelectSingleNode("//Entity[@Name='rosie_boss']"); + + rosie["Health"]["Health"].InnerText = "1999"; + rosie["Health"]["HurtShakeAmount"].InnerText = "2"; + + for (int i = rosie["BossRosieComponent"]["Phases"].ChildNodes.Count - 1; i >= 0; i--) + { + XmlNode rosiePhase = rosie["BossRosieComponent"]["Phases"].ChildNodes[i]; + if (rosiePhase.Name == "Phase") + { + if (rosiePhase.Attributes["Index"].Value == "0") + { + continue; + } + else if (rosiePhase.Attributes["Index"].Value == "1") + { + rosiePhase.Attributes["DisabledSignalEnd"].Value = "disabled_end_late"; + continue; + } + else if (rosiePhase.Attributes["Index"].Value == "6") + { + rosiePhase.Attributes["Index"].Value = "2"; + continue; + } + } + + rosie["BossRosieComponent"]["Phases"].RemoveChild(rosiePhase); + } + + doc.Save(bosses); + } } }