static void Prefix(ApplyClassMechanics __instance, LevelUpState state, UnitDescriptor unit) { if (IsAvailable()) { Core.Debug($" - {nameof(ApplyClassMechanics)}.{nameof(ApplyClassMechanics.Apply)}({state.SelectedClass}[{state.NextClassLevel}], {unit})"); } }
static bool Prefix(ApplyClassMechanics __instance, LevelUpState state, UnitDescriptor unit) { if (IsAvailable() && Core.Mod.IsLevelLocked) { __instance.Apply_NoStatsAndHitPoints(state, unit); return(false); } return(true); }
private static void Postfix(ApplyClassMechanics __instance, LevelUpState state, UnitDescriptor unit) { try { if (state.NextLevel == 1) { foreach (Action <LevelUpState, UnitDescriptor> action in onChargenApply) { action(state, unit); } } } catch (Exception e) { Log.Error(e); } }
static void Postfix(ApplyClassMechanics __instance, LevelUpState state, UnitDescriptor unit) { if (IsAvailable()) { if (state.SelectedClass != null) { ForEachAppliedMulticlass(state, unit, () => { Logger.ModLoggerDebug($" - {nameof(ApplyClassMechanics)}.{nameof(ApplyClassMechanics.Apply)}*({state.SelectedClass}[{state.NextClassLevel}], {unit})"); __instance.Apply_NoStatsAndHitPoints(state, unit); }); } } }
static bool Prefix(ApplyClassMechanics __instance, ClassData classData, UnitDescriptor unit) { List<StatType> class_skills = new List<StatType>(); var combined_archetype = classData.Archetypes.Where(a => a.GetComponent<CombineArchetypes>() != null && a.ReplaceClassSkills).FirstOrDefault(); if (combined_archetype == null) { return true; } foreach (var s in combined_archetype.ClassSkills) { unit.Stats.AddClassSkill(s); } return false; }
public static void Apply_NoStatsAndHitPoints(this ApplyClassMechanics instance, LevelUpState state, UnitDescriptor unit) { if (state.SelectedClass != null) { ClassData classData = unit.Progression.GetClassData(state.SelectedClass); if (classData != null) { //GetMethodDel<ApplyClassMechanics, Action<ApplyClassMechanics, LevelUpState, ClassData, UnitDescriptor>> // ("ApplyBaseStats")(null, state, classData, unit); //GetMethodDel<ApplyClassMechanics, Action<ApplyClassMechanics, LevelUpState, ClassData, UnitDescriptor>> // ("ApplyHitPoints")(null, state, classData, unit); GetMethodDel <ApplyClassMechanics, Action <ApplyClassMechanics, ClassData, UnitDescriptor> > ("ApplyClassSkills")(null, classData, unit); GetMethodDel <ApplyClassMechanics, Action <ApplyClassMechanics, LevelUpState, UnitDescriptor> > ("ApplyProgressions")(null, state, unit); } } }
public static void Apply_NoStatsAndHitPoints(this ApplyClassMechanics instance, LevelUpState state, UnitDescriptor unit) { Mod.Trace($"Apply_NoStatsAndHitPoints: unit = {unit.CharacterName}, state.class = {(state.SelectedClass == null ? "NULL" : state.SelectedClass.Name)}"); if (state.SelectedClass != null) { var classData = unit.Progression.GetClassData(state.SelectedClass); if (classData != null) { //GetMethodDel<ApplyClassMechanics, Action<ApplyClassMechanics, LevelUpState, ClassData, UnitDescriptor>> // ("ApplyBaseStats")(null, state, classData, unit); //GetMethodDel<ApplyClassMechanics, Action<ApplyClassMechanics, LevelUpState, ClassData, UnitDescriptor>> // ("ApplyHitPoints")(null, state, classData, unit); ReflectionCache.GetMethod <ApplyClassMechanics, Action <ApplyClassMechanics, ClassData, UnitDescriptor> > ("ApplyClassSkills")(null, classData, unit); ReflectionCache.GetMethod <ApplyClassMechanics, Action <ApplyClassMechanics, LevelUpState, UnitDescriptor> > ("ApplyProgressions")(null, state, unit); } } }