public OnyxInt GetSpellCastMaxNew(CharacterStats caster, CharacterClass spellClass, int spellLevel) { // Have to init this way because class initialization doesn't work if (!ConfigHasBeenInit) { ConfigHasBeenInit = true; UseMod = UserConfig.GetValueAsBool("SpellCastsPerLevel", "enableMod"); BonusCastsPerLevel = UserConfig.GetValueAsInt("SpellCastsPerLevel", "BonusCastsPerLevel"); } if (!UseMod) { return(orig_GetSpellCastMax(caster, spellClass, spellLevel)); } OnyxInt onyxInt = OnyxInt.PositiveInfinity; if (caster != null && spellLevel >= 1) { onyxInt = this.SpellCastMaxLookup(spellClass, caster.GetClassPowerLevel(spellClass), spellLevel); if (onyxInt == -1) { onyxInt = OnyxInt.PositiveInfinity; } if (onyxInt > 0) { onyxInt += caster.GetBonusSpellCasts(spellClass, spellLevel) + BonusCastsPerLevel; } } return(onyxInt); }
public OnyxInt orig_GetSpellCastMax(CharacterStats caster, CharacterClass spellClass, int spellLevel) { OnyxInt onyxInt = OnyxInt.PositiveInfinity; if (caster != null && spellLevel >= 1) { onyxInt = this.SpellCastMaxLookup(spellClass, caster.GetClassPowerLevel(spellClass), spellLevel); if (onyxInt == -1) { onyxInt = OnyxInt.PositiveInfinity; } if (onyxInt > 0) { onyxInt += caster.GetBonusSpellCasts(spellClass, spellLevel); } } return(onyxInt); }
public OnyxInt GetSpellCastMaxNew(CharacterStats caster, CharacterClass spellClass, int spellLevel) { // Change this to change how many bonus spell casts you get per level int ModdedSpellCastsPerLevel = 2; OnyxInt onyxInt = OnyxInt.PositiveInfinity; if (caster != null && spellLevel >= 1) { onyxInt = this.SpellCastMaxLookup(spellClass, caster.GetClassPowerLevel(spellClass), spellLevel); if (onyxInt == -1) { onyxInt = OnyxInt.PositiveInfinity; } if (onyxInt > 0) { onyxInt += caster.GetBonusSpellCasts(spellClass, spellLevel) + ModdedSpellCastsPerLevel; } } return(onyxInt); }
public void AdjustMoraleNew(OnyxInt value, string reason, bool log) { if (!ConfigHasBeenInit) { InitMods(); } if (!this.HasCrewOnShip()) { return; } if (log) { ShipCrewManager.LogMorale(value); } this.Morale = Mathf.Clamp(this.Morale + (int)value, MinimumMorale, 100); UIShipResourceNotificationManager.PostNotification(new SpriteKey(SingletonBehavior <UIAtlasManager> .Instance.GameSystemIcons, "icon_ship_morale"), GuiStringTable.GetText(3709), value, reason); ShipCrewManager.OnShipMoraleChanged.Trigger(); if (this.GetCurrentMoraleState() == MoraleStateType.Mutinous) { TutorialManager.STriggerTutorialsOfType(TutorialEventType.LowMorale); } }
protected void OnyxUpdateNew() { //base.OnyxUpdate(); if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.E)) { Game.Console.AddMessage("Pressed LCtrl and E to reset Empower"); //SingletonBehavior<PartyManager>.Instance.GetSelectedPartyMemberGameObjects() var selchars = m_selectedCharacters; if (selchars != null) // there's a selected char { foreach (var selchar in selchars) { //this resets the # used empowered per combat to 0 selchar.ResetEmpower(); //set empower pts to MaxEmpowerPoints selchar.EmpowerPoints = selchar.MaxEmpowerPoints; } } } if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.S)) { Game.Console.AddMessage("Pressed LCtrl and S to reset Spellcasts"); var selchars = m_selectedCharacters; if (selchars != null) // there's a selected char { foreach (var selchar in selchars) { // FROM EmpowerResources, hopefully fixes spellcasts foreach (AccruedResourceTrait accruedResourceTrait in selchar.AbilityList.FindAbilitiesByType <AccruedResourceTrait>()) { //accruedResourceTrait.RestoreResource(accruedResourceTrait.GetSelfEmpowerRestoreCount()); accruedResourceTrait.RestoreResource(accruedResourceTrait.GetResourceMax() - accruedResourceTrait.GetResource()); } for (CharacterClass characterClass = CharacterClass.None; characterClass < CharacterClass.Count; characterClass++) { for (int i = 1; i <= GlobalGameSettingsGameData.Instance.MaxSpellLevel; i++) { OnyxInt spellCastMax = SingletonBehavior <SpellMax> .Instance.GetSpellCastMax(selchar, characterClass, i); selchar.RestoreSpellCasts(characterClass, i, spellCastMax); } selchar.AddClassAbilityPoolPoints(characterClass, selchar.GetMaxPowerPoolPoints(characterClass, null)); } } } } this.m_RefreshTimer -= TimeController.UnscaledDeltaTime; if (this.m_NeedsRefresh || this.m_RefreshTimer <= 0f) { this.m_NeedsRefresh = false; this.m_RefreshTimer = float.PositiveInfinity; this.Refresh(); } if (GameInput.GetControlDownWithRepeat(MappedControl.UP_ABILITY, true)) { this.NavigateVertical(1); } else if (GameInput.GetControlDownWithRepeat(MappedControl.DOWN_ABILITY, true)) { this.NavigateVertical(-1); } if (GameInput.GetControlDownWithRepeat(MappedControl.NEXT_ABILITY, true)) { if (this.m_SelectionRow < 0) { this.SelectFirstButton(); } else { this.NavigateHorizontal(1); } } else if (GameInput.GetControlDownWithRepeat(MappedControl.PREVIOUS_ABILITY, true)) { if (this.m_SelectionRow < 0) { this.SelectLastButton(); } else { this.NavigateHorizontal(-1); } } UIAbilityBarButton selectedButton = this.GetSelectedButton(); if (selectedButton && !selectedButton.gameObject.activeInHierarchy) { this.CancelSelection(); } if (this.m_SelectionTooltipDelay > 0f) { this.m_SelectionTooltipDelay -= TimeController.UnscaledDeltaTime; if (this.m_SelectionTooltipDelay <= 0f && selectedButton) { selectedButton.ShowTooltip(); } } UIAbilityBarButton selectedButton2 = this.GetSelectedButton(); if (selectedButton2 && !Player.IsCastingOrRetargeting() && GameInput.GetControlUp(MappedControl.CAST_SELECTED_ABILITY, true)) { selectedButton2.Trigger(); } if (this.SelectedObject != null) { CharacterHotkeyBindings orAddComponent = ResourceManager.GetOrAddComponent <CharacterHotkeyBindings>(this.SelectedObject.gameObject); if (GameInput.IsKeyUpAvailable(KeyCode.Mouse0) && orAddComponent != null) { orAddComponent.Activate(SingletonBehavior <GameInput> .Instance.LastKeyUp); } if ((this.m_hotkeyRow == null || !this.m_hotkeyRow.gameObject.activeSelf) && (this.m_rows.Count < 2 || this.m_rows[1] == this.m_hotkeyRow || this.m_rows[1].IsEmpty) && orAddComponent != null && !ICollectionUtils.IsNullOrEmpty <KeyValuePair <KeyControl, Guid> >(orAddComponent.AbilityHotkeys)) { this.m_hotkeyRow = this.ShowSubrow(null, 1); this.m_hotkeyRow.SetIdentification(GuiStringTable.GetText(1662)); this.m_hotkeyRow.AddHotkeySet(); } AIController component = ComponentUtils.GetComponent <AIController>(this.m_selectedCharacter); GenericAbility genericAbility = (!component) ? null : component.GetCurrentIntroStateAbility(); if (genericAbility != null && genericAbility.Attack != null && !genericAbility.Attack.ForcedTarget) { if (this.m_castControlRow == null || !this.m_castControlRow.gameObject.activeSelf) { this.m_castControlRow = this.ShowSubrow(null, 2); this.m_castControlRow.SetIdentification(GuiStringTable.GetText(2994)); this.m_castControlRow.AddCurrentCastSet(); } } else { this.HideSubrow(2); } } }
static bool Prefix(ShipCrewManager __instance, ref OnyxInt value, string reason, bool log) { try { if (!Main.enabled) { return(true); } int currentMorale = __instance.Morale; int change = (int)value; int modified = currentMorale + (int)value; /* * int minimumMorale = Main.settings.MinimumMorale; * int maximumMorale = Main.settings.MaximumMorale; * * OnyxInt minChange = minimumMorale - currentMorale; * OnyxInt maxChange = currentMorale - maximumMorale; * * Main.Log($"Value: {change}"); * Main.Log($"Current: {currentMorale}, Modified: {modified}"); * Main.Log($"Minimum Morale: {minimumMorale}, Maximum Morale: {maximumMorale}"); */ if (log) { MethodInfo methodInfo = __instance.GetType().GetMethod("LogMorale", BindingFlags.NonPublic | BindingFlags.Static); methodInfo.Invoke(__instance, new object[] { value }); } __instance.Morale = Mathf.Clamp(modified, Main.settings.MinimumMorale, Main.settings.MaximumMorale); UIShipResourceNotificationManager.PostNotification(new SpriteKey(SingletonBehavior <UIAtlasManager> .Instance.GameSystemIcons, "icon_ship_morale"), GuiStringTable.GetText(3709), value, reason); ShipCrewManager.OnShipMoraleChanged.Trigger(); if (__instance.GetCurrentMoraleState() == MoraleStateType.Mutinous) { TutorialManager.STriggerTutorialsOfType(TutorialEventType.LowMorale); } /* * if (GetCurrentMoraleState() == MoraleStateType.Mutinous) * * if ( ) * { * value = minChange; * Main.Log($"Min change: {minChange}"); * } * else if (currentMorale > maximumMorale || modified > maximumMorale) * { * value = maxChange; * Main.Log($"Max change: {maxChange}"); * } * else * { * Main.Log("No change"); * } */ return(false); } catch (Exception ex) { Main.LogError(ex); } return(true); }