From 119c43e5e8b53f6cf5eb47b3dd6549c0819b037e Mon Sep 17 00:00:00 2001 From: Miepee Date: Thu, 22 Feb 2024 21:18:42 +0100 Subject: [PATCH] Make hitting metroids with charge beam and other beams show a message Fix #149 --- YAMS-LIB/Program.cs | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/YAMS-LIB/Program.cs b/YAMS-LIB/Program.cs index 9c8df76..9320186 100644 --- a/YAMS-LIB/Program.cs +++ b/YAMS-LIB/Program.cs @@ -1,4 +1,5 @@ -using System.Globalization; +using System.ComponentModel.Design; +using System.Globalization; using System.Reflection; using System.Text.Json; using NaturalSort.Extension; @@ -1166,11 +1167,38 @@ void RotateTextureAndSaveToTexturePage(int rotation, UndertaleTexturePageItem te // Make Charge Beam always hit metroids foreach (string name in new[] { - "gml_Object_oMAlpha_Collision_439", "gml_Object_oMGamma_Collision_439", "gml_Object_oMZeta_Collision_439", "gml_Object_oMZetaBodyMask_Collision_439", + "gml_Object_oMAlpha_Collision_439", "gml_Object_oMGamma_Collision_439", "gml_Object_oMZeta_Collision_439", "gml_Object_oMOmegaMask2_Collision_439", "gml_Object_oMOmegaMask3_Collision_439" }) { - gmData.Code.ByName(name).ReplaceGMLInCode("&& global.missiles == 0 && global.smissiles == 0", ""); + var codeEntry = gmData.Code.ByName(name); + codeEntry.ReplaceGMLInCode("&& global.missiles == 0 && global.smissiles == 0", ""); + if (codeEntry.GetGMLCode().Contains(""" + else + { + """)) + { + + + codeEntry.ReplaceGMLInCode(""" + else + { + """, + """ + else + { + if (oBeam.chargebeam) popup_text("Unequip beams to deal Charge damage") + """); + } + else + { + codeEntry.AppendGMLInCode(""" + else + { + if (oBeam.chargebeam) popup_text("Unequip beams to deal Charge damage") + } + """); + } } // Replace Metroids counters with DNA counters