static void Postfix(LevelUpState state, UnitDescriptor unit) { if (IsAvailable()) { Main.multiclassMod.AppliedMulticlassSet.Clear(); Main.multiclassMod.UpdatedProgressions.Clear(); // get multi-class setting HashSet <string> selectedMulticlassSet = unit.GetMulticlassSet(); if (selectedMulticlassSet == null || selectedMulticlassSet.Count == 0) { return; } // applying classes StateReplacer stateReplacer = new StateReplacer(state); foreach (BlueprintCharacterClass characterClass in Main.multiclassMod.CharacterClasses) { if (characterClass != stateReplacer.SelectedClass && selectedMulticlassSet.Contains(characterClass.AssetGuid)) { stateReplacer.Replace(null, 0); if (new SelectClass(characterClass).Check(state, unit)) { Logger.ModLoggerDebug($" - {nameof(SelectClass)}.{nameof(SelectClass.Apply)}*({characterClass}, {unit})"); unit.Progression.AddClassLevel_NotCharacterLevel(characterClass); //state.NextClassLevel = unit.Progression.GetClassLevel(characterClass); //state.SelectedClass = characterClass; characterClass.RestrictPrerequisites(unit, state); //EventBus.RaiseEvent<ILevelUpSelectClassHandler>(h => h.HandleSelectClass(unit, state)); Main.multiclassMod.AppliedMulticlassSet.Add(characterClass); } } } stateReplacer.Restore(); // applying archetypes ForEachAppliedMulticlass(state, unit, () => { foreach (BlueprintArchetype archetype in state.SelectedClass.Archetypes) { if (selectedMulticlassSet.Contains(archetype.AssetGuid)) { AddArchetype addArchetype = new AddArchetype(state.SelectedClass, archetype); if (addArchetype.Check(state, unit)) { addArchetype.Apply(state, unit); } } } }); } }