public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { return(this.prerequisite1.Check(selectionState, unit, state) && this.prerequisite2.Check(selectionState, unit, state)); }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { return(race == unit.Progression.Race); }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { return(this.base_prerequsite.Check(selectionState, unit, state) || this.alternative_prerequsite.Check(selectionState, unit, state)); }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { return((unit.Get <UnitPartFullProficiency>()?.hasFullProficiency(category)).GetValueOrDefault() != not); }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { return(unit.GetSpellbook(character_class) != null); }
// If we're gaining a level of prestige class that skips a caster level (e.g. level 5 of Dragon Disciple), // see if we already took enough Prestigious Spellcaster ranks to make up for it. If so, then we should // gain a caster level now. static bool ShouldGainCasterLevelOnLevelUp(LevelUpState state, UnitDescriptor unit) { var selectedClass = state.SelectedClass; if (prestigiousSpellcaster == null || !prestigiousSpellcasterClasses.Contains(selectedClass)) { return(false); } // See if we have the matching prestigious spellcaster feat. var fact = GetSpellcasterFact(unit, selectedClass); if (fact == null) { return(false); } // If we already took the Prestigious Spellcaster feat for this skipped caster level, we can gain the level now. var spellSkipLevels = selectedClass.GetComponent <SkipLevelsForSpellProgression>().Levels; int skipIndex = Array.IndexOf(spellSkipLevels, state.NextClassLevel); Log.Write($" checking for skipped spell level, found: {skipIndex}, from skips: " + String.Join(" ", spellSkipLevels)); if (skipIndex >= 0) { var rank = fact.GetRank(); Log.Write($" Prestigious Spellcaster {fact.Blueprint.name} rank {rank}"); if (rank > skipIndex) { // We already took prestigious spellcaster for this level, so we need to gain a caster level. return(true); } } return(false); }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { return(unit.Progression.GetClassLevel(this.CharacterClass) < 1); }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { return(unit.Ensure <UnitPartSelfEvolution>().hasEvolution(evolution) != not);; }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { return(unit.Ensure <UnitPartSelfEvolution>().getNumEvolutionPoints() >= amount || unit.Progression.Features.HasFact((BlueprintFact)this.feature)); }
public void HandleSelectClass(UnitDescriptor unit, LevelUpState state) { if (Owner == unit) { // handle subsequent level ups after level 1 Apply(state); } }
static void Postfix(LevelUpState __instance, UnitDescriptor unit, LevelUpState.CharBuildMode mode) { if (IsAvailable() && Core.Mod.IsLevelLocked) { //__instance.SetFieldValue(nameof(LevelUpState.NextLevel), unit.Progression.CharacterLevel); __instance.AttributePoints = 0; } }
static void Postfix(LevelUpState state, UnitDescriptor unit) { if (IsAvailable()) { Core.Mod.AppliedMulticlassSet.Clear(); Core.Mod.UpdatedProgressions.Clear(); // get multiclass setting HashSet <string> selectedMulticlassSet = Core.Mod.LevelUpController.Unit.IsMainCharacter ? MainCharSet : (state.IsCharGen() && unit.IsCustomCompanion()) ? CharGenSet : CompanionSets.ContainsKey(unit.CharacterName) ? CompanionSets[unit.CharacterName] : null; if (selectedMulticlassSet == null || selectedMulticlassSet.Count == 0) { return; } // applying classes StateReplacer stateReplacer = new StateReplacer(state); foreach (BlueprintCharacterClass characterClass in Core.Mod.CharacterClasses) { if (characterClass != stateReplacer.SelectedClass && selectedMulticlassSet.Contains(characterClass.AssetGuid)) { stateReplacer.Replace(null, 0); if (new SelectClass(characterClass).Check(state, unit)) { Core.Debug($" - {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)); Core.Mod.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); } } } }); } }
static bool Prefix(ApplyClassMechanics __instance, LevelUpState state, UnitDescriptor unit) { if (IsAvailable() && Core.Mod.IsLevelLocked) { __instance.Apply_NoStatsAndHitPoints(state, unit); return(false); } return(true); }
static void Prefix(LevelUpState state, UnitDescriptor unit, BlueprintProgression progression) { if (IsAvailable()) { ProgressionData progressionData = unit.Progression.SureProgressionData(progression); int nextLevel = progressionData.Blueprint.CalcLevel(unit); Core.Debug($" - {nameof(LevelUpHelper)}.{nameof(LevelUpHelper.UpdateProgression)}({state.SelectedClass}[{state.NextClassLevel}], {unit}, {progression}) - NextLevel: {nextLevel}"); } }
public static void SetSpellbook(this CharBPhaseSpells instance, BlueprintCharacterClass characterClass) { LevelUpState state = Game.Instance.LevelUpController.State; BlueprintCharacterClass selectedClass = state.SelectedClass; state.SelectedClass = characterClass; ReflectionCache.GetMethod <CharBPhaseSpells, Action <CharBPhaseSpells> >("SetupSpellBookView")(instance); state.SelectedClass = selectedClass; }
static bool Prefix(LevelUpState state, ClassData classData, UnitDescriptor unit) { int hitDie = (int)classData.CharacterClass.HitDie; BlueprintCharacterClass characterClass = classData.CharacterClass; int nextLevel = state.NextLevel; int num2 = !BlueprintRoot.Instance.Progression.CharacterClasses.Contains(characterClass) || !unit.IsPlayerFaction ? hitDie / 2 + nextLevel % 2 + 1 : (nextLevel > 1 ? hitDie / 2 + nextLevel % 2 : hitDie); unit.Stats.HitPoints.BaseValue += num2; return(false); }
protected override void Apply(LevelUpState state) { Log.Write($"{GetType().Name}: trying to unselect"); var selection = state.Selections.FirstOrDefault(s => s.SelectedItem?.Feature == Fact.Blueprint); if (selection != null) { Log.Write($"Unselecting selection {selection.Index}"); Game.Instance.UI.CharacterBuildController.LevelUpController.UnselectFeature(selection); } }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { if (selectionState != (FeatureSelectionState)null && selectionState.IsSelectedInChildren((IFeatureSelectionItem)this.base_feature)) { return(false); } return(unit.Progression.Features.Enumerable.Where(p => p.Blueprint == this.base_feature).Any(this.CheckFeature)); }
public static bool IsCharGen(this LevelUpState state) { var companionNames = Game.Instance?.Player?.AllCharacters.Where(c => !c.IsMainCharacter).Select(c => c.CharacterName).ToList(); var isCompanion = companionNames?.Contains(state.Unit.CharacterName) ?? false; if (isCompanion) { return(false); } return(state.Mode == LevelUpState.CharBuildMode.CharGen || state.Unit.CharacterName == "Player Character"); }
static bool Prefix(LevelUpState state, ClassData classData, UnitDescriptor unit) { unit.Stats.GetStat(StatType.BaseAttackBonus).BaseValue += calculateExtraBab(classData, unit); unit.Stats.GetStat(StatType.SaveFortitude).BaseValue += calculateExtraSave(classData, unit, state.NextClassLevel, c => c.FortitudeSave); unit.Stats.GetStat(StatType.SaveReflex).BaseValue += calculateExtraSave(classData, unit, state.NextClassLevel, c => c.ReflexSave); unit.Stats.GetStat(StatType.SaveWill).BaseValue += calculateExtraSave(classData, unit, state.NextClassLevel, c => c.WillSave); return(false); }
public void HandleSelectClass(UnitDescriptor unit, LevelUpState state) { if (applied) { return; } if (Owner == unit) { Apply(state); applied = 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); } }
protected override void Apply(LevelUpState state) { if (CharacterClass != state.SelectedClass) { return; } var spellbook = Owner.Progression.GetClassData(CharacterClass).Spellbook; var spellSelection = state.DemandSpellSelection(spellbook, spellbook.SpellList); int existingNewSpells = spellSelection.LevelCount[SpellLevel]?.SpellSelections.Length ?? 0; Log.Write($"Adding spell selection to level {SpellLevel}"); spellSelection.SetLevelSpells(SpellLevel, 1 + existingNewSpells); }
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); }); } } }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { foreach (var p in prerequisites) { if (!p.Check(selectionState, unit, state)) { return(false); } } return(true); }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { foreach (ClassData classData in unit.Progression.Classes) { BlueprintSpellbook spellbook = classData.Spellbook; if (spellbook != null) { return(true); } } return(false); }
static void Prefix(SelectFeature __instance, LevelUpState state, UnitDescriptor unit) { if (IsAvailable()) { BlueprintCharacterClass sourceClass = (GetMethodDel <SelectFeature, Func <SelectFeature, LevelUpState, FeatureSelectionState> > ("GetSelectionState")(__instance, state)?.Source as BlueprintProgression)?.GetSourceClass(unit); if (sourceClass == null) { Core.Debug($" - {nameof(SelectFeature)}.{nameof(SelectFeature.Apply)}({state.SelectedClass}[{state.NextClassLevel}], {unit}) - {__instance.Selection}, {__instance.Item}"); } else { Core.Debug($" - {nameof(SelectFeature)}.{nameof(SelectFeature.Apply)}({sourceClass}[{unit.Progression.GetClassLevel(sourceClass)}], {unit}) - {__instance.Selection}, {__instance.Item}"); } } }
bool IFeatureSelection.CanSelect(UnitDescriptor unit, LevelUpState state, FeatureSelectionState selectionState, IFeatureSelectionItem item) { if (!item.Param.HasValue) { return(false); } if (HasNoSuchFeature) { var feat = item.Param.Value.Blueprint as BlueprintFeature; if (feat != null && unit.HasFact(feat)) { return(false); } } return(CanSelect(unit, item.Param.Value)); }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { foreach (ClassData classData in unit.Progression.Classes) { BlueprintSpellbook spellbook = classData.Spellbook; if (spellbook != null && (!this.OnlySpontaneous || spellbook.Spontaneous) && spellbook.GetComponent <PsychicSpellbook>() != null && unit.DemandSpellbook(classData.CharacterClass).MaxSpellLevel >= this.RequiredSpellLevel) { return(true); } } return(false); }
public override bool Check( FeatureSelectionState selectionState, UnitDescriptor unit, LevelUpState state) { foreach (var f in Features) { if (unit.Logic.HasFact(f)) { return(false); } if (unit.Progression.Features.HasFact(f)) { return(false); } } return(true); }