Skip to content

Commit

Permalink
Track bosses in MW
Browse files Browse the repository at this point in the history
Fixes #218
  • Loading branch information
Miepee committed Jul 4, 2024
1 parent 0cc5dec commit d0d071d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions YAMS-LIB/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ public static void Main(string am2rPath, string outputAm2rPath, string jsonPath)

// Multiworld stuff
Multiworld.Apply(gmData, decompileContext, seedObject);
AddBossMWTracking.Apply(gmData, decompileContext, seedObject);

// Write back to disk
using (FileStream fs = new FileInfo(outputAm2rPath).OpenWrite())
Expand Down
30 changes: 30 additions & 0 deletions YAMS-LIB/patches/AddBossMWTracking.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using UndertaleModLib;
using UndertaleModLib.Decompiler;
using UndertaleModLib.Models;

namespace YAMS_LIB.patches;

public class AddBossMWTracking
{
public static void Apply(UndertaleData gmData, GlobalDecompileContext decompileContext, SeedObject seedObject)
{
// Guardian
gmData.Code.ByName("gml_Object_oBoss1Head_Step_0").ReplaceGMLInCode("sfx_play(sndBoss1Death)", "sfx_play(sndBoss1Death); global.collectedItems += \"Guardian|1,\"; send_location_and_inventory_packet();");
gmData.Code.ByName("gml_Object_oBoss1Head_Collision_382").ReplaceGMLInCode("sfx_play(sndBoss1Death)", "sfx_play(sndBoss1Death); global.collectedItems += \"Guardian|1,\"; send_location_and_inventory_packet();");

// Arachnus
gmData.Code.ByName("gml_Object_oArachnus_Step_0").ReplaceGMLInCode("sfx_play(sndArachnusDeath)", "sfx_play(sndArachnusDeath); global.collectedItems += \"Arachnus|1,\"; send_location_and_inventory_packet();");

// Torizo
gmData.Code.ByName("gml_Object_oTorizo2_Step_0").ReplaceGMLInCode("sfx_play(sndTorizoDeath)", "{ sfx_play(sndTorizoDeath); global.collectedItems += \"Torizo|1,\"; send_location_and_inventory_packet(); }");

// Tester
gmData.Code.ByName("gml_Object_oTester_Step_0").ReplaceGMLInCode("sfx_play(sndTesterDeath)", "sfx_play(sndTesterDeath); global.collectedItems += \"Tester|1,\"; send_location_and_inventory_packet();");

// Serris
gmData.Code.ByName("gml_Object_oErisHead_Step_0").ReplaceGMLInCode("sfx_play(sndErisDeath)", "sfx_play(sndErisDeath); global.collectedItems += \"Serris|1,\"; send_location_and_inventory_packet();");

// Genesis
gmData.Code.ByName("gml_Object_oGenesis_Step_0").ReplaceGMLInCode("sfx_play(sndGenesisDeath)", "sfx_play(sndGenesisDeath); global.collectedItems += \"Genesis|1,\"; send_location_and_inventory_packet();");
}
}

0 comments on commit d0d071d

Please sign in to comment.