static bool Prefix(ActivatableAbility ability, ref UnitCommand.CommandType __result) { if (Mod.Enabled && FixActionTypeOfBardicPerformance) { if (ability.Blueprint.Group == ActivatableAbilityGroup.BardicPerformance) { if (ability.Owner.State.Features.QuickenPerformance2) { __result = ability.Owner.State.Features.SingingSteel ? UnitCommand.CommandType.Free : UnitCommand.CommandType.Swift; } else if (ability.Owner.State.Features.QuickenPerformance1) { __result = ability.Owner.State.Features.SingingSteel ? UnitCommand.CommandType.Swift : UnitCommand.CommandType.Move; } else { __result = ability.Owner.State.Features.SingingSteel ? UnitCommand.CommandType.Move : UnitCommand.CommandType.Standard; } } else { __result = ability.Blueprint.ActivateWithUnitCommandType; } return(false); } return(true); }
public void addEntry(Fact new_buff, ActivatableAbilityGroup new_group, UnitCommand.CommandType new_action) { if (!entries.Any(e => e.buff == new_buff)) { entries.Add(new Entry(new_buff, new_group, new_action)); } }
static bool Prefix(UnitCombatState __instance, UnitCommand.CommandType commandType, ref bool __result) { if (IsInCombat() && __instance.Unit.IsInCombat) { switch (commandType) { case UnitCommand.CommandType.Free: __result = false; break; case UnitCommand.CommandType.Move: __result = !__instance.Unit.HasMoveAction(); break; case UnitCommand.CommandType.Standard: UnitCommand moveCommand = __instance.Unit.Commands.GetCommand(UnitCommand.CommandType.Move); __result = (moveCommand != null && moveCommand.IsRunning) || !__instance.Unit.HasStandardAction(); break; case UnitCommand.CommandType.Swift: __result = __instance.Cooldown.SwiftAction > 0f; break; default: throw new ArgumentOutOfRangeException(); } return(false); } return(true); }
public static bool Prefix(AbilityData __instance, ref UnitCommand.CommandType __result) { BlueprintAbility abl = __instance.Blueprint; UnitDescriptor unit = __instance.Caster; if (ConsumeSpells.ablList.Contains(abl) || abl == ConsumeItem.abl) { if (unit.HasFact(SwiftConsume.exploit)) { __result = UnitCommand.CommandType.Swift; return(false); } } return(true); }
public static bool Prefix(UnitCommand.CommandType type, bool isFullRound, float timeSinceCommandStart, UnitEntityData __instance) { if (!__instance.IsInCombat) { return(true); } if (!settings.toggleUnlimitedActionsPerTurn) { return(true); } else if (CombatController.IsInTurnBasedCombat()) { return(false); } return(true); }
static bool Prefix(ActivatableAbility ability, ref UnitCommand.CommandType __result) { if (ability.Blueprint.Group != ActivatableAbilityGroup.BardicPerformance) { __result = ability.Owner.Ensure <UnitPartActivatableAbilityActionTypeModifier>().getCommandType(ability.Blueprint); } else if ((bool)ability.Owner.State.Features.QuickenPerformance2 || ability.Blueprint.ActivateWithUnitCommandType == UnitCommand.CommandType.Swift) { __result = !(bool)ability.Owner.State.Features.SingingSteel ? UnitCommand.CommandType.Swift : UnitCommand.CommandType.Free; } else if ((bool)ability.Owner.State.Features.QuickenPerformance1 || ability.Blueprint.ActivateWithUnitCommandType == UnitCommand.CommandType.Move) { __result = !(bool)ability.Owner.State.Features.SingingSteel ? UnitCommand.CommandType.Move : UnitCommand.CommandType.Swift; } else { __result = !(bool)ability.Owner.State.Features.SingingSteel ? UnitCommand.CommandType.Standard : UnitCommand.CommandType.Move; } return(false); }
public AbilityData(string guid, string name, string displayNameLocalizationKey, string displayNameText, string descriptionLocalizationKey, string descriptionText, string iconAssetGuid, string iconFileName, AbilityType type, AbilityRange range, UnitCommand.CommandType actionType, bool isFullRoundAction, string durationLocalizationKey = null, string durationLocalizationText = null, string savingThrowLocalizationKey = null, string savingThrowLocalizationText = null) { Guid = guid; Name = name; DisplayNameLocalizationKey = displayNameLocalizationKey; DisplayNameText = displayNameText; DescriptionLocalizationKey = descriptionLocalizationKey; DescriptionText = descriptionText; IconAssetGuid = iconAssetGuid; IconFileName = iconFileName; Type = type; Range = range; ActionType = actionType; IsFullRoundAction = isFullRoundAction; DurationLocalizationKey = durationLocalizationKey; DurationLocalizationText = durationLocalizationText; SavingThrowLocalizationKey = savingThrowLocalizationKey; SavingThrowLocalizationText = savingThrowLocalizationText; }
public static void Postfix(UnitCommand.CommandType type, bool isFullRound, float timeSinceCommandStart, UnitEntityData __instance) { if (!__instance.IsInCombat) { return; } UnitCombatState.Cooldowns cooldown = __instance.CombatState.Cooldown; if (CombatController.IsInTurnBasedCombat()) { if (settings.toggleUnlimitedActionsPerTurn) { return; } switch (type) { case UnitCommand.CommandType.Free: break; case UnitCommand.CommandType.Standard: cooldown.StandardAction += 6f; if (!isFullRound) { break; } cooldown.MoveAction += 3f; break; case UnitCommand.CommandType.Swift: cooldown.SwiftAction += 6f; break; case UnitCommand.CommandType.Move: cooldown.MoveAction += 3f; break; default: throw new ArgumentOutOfRangeException(); } } else { if (settings.toggleInstantCooldown) { return; } switch (type) { case UnitCommand.CommandType.Free: case UnitCommand.CommandType.Move: cooldown.MoveAction = 3f - timeSinceCommandStart; break; case UnitCommand.CommandType.Standard: cooldown.StandardAction = 6f - timeSinceCommandStart; break; case UnitCommand.CommandType.Swift: cooldown.SwiftAction = 6f - timeSinceCommandStart; break; default: throw new ArgumentOutOfRangeException(); } } }
public Entry(Fact new_buff, ActivatableAbilityGroup new_group, UnitCommand.CommandType new_action) { buff = new_buff; group = new_group; action = new_action; }
static public bool Prefix(UnitUseAbility __instance, UnitCommand.CommandType commandType, ref AbilityData spell, TargetWrapper target) { //base ctor /*this.Type = commandType; * this.Target = target; * this.Cutscene = (ElementsContext.GetData<CutsceneParametersContext.ContextData>() != null);*/ //modify spell if (spell == null) { return(true); } if (spell.Spellbook == null) { return(true); } if (spell.Spellbook.Blueprint.CharacterClass != ArcanistClass.arcanist) { return(true); } UnitDescriptor unit = spell.Caster; bool hadMetamagic = spell.MetamagicData != null; bool hadMetamixing = unit.Buffs.HasFact(Metamixing.buff); //An arcanist can't combine prepared metamagic and spontaneous metamagic, if she doesn't have //the Metamixing exploit. if (hadMetamagic && !hadMetamixing) { return(true); } //UnityModManager.Logger.Log($"spell {spell.Name} has metamagic {(spell.MetamagicData!=null?spell.MetamagicData.MetamagicMask:0)}"); MetamagicBuilder builder = new MetamagicBuilder(spell.Spellbook, spell); Dictionary <Metamagic, Feature> meta_feat = new Dictionary <Metamagic, Feature>(); foreach (var ft in builder.SpellMetamagicFeatures) { AddMetamagicFeat comp = ft.Get <AddMetamagicFeat>(); if (comp == null) { continue; } Metamagic metaId = comp.Metamagic; meta_feat[metaId] = ft; } bool flag = false; foreach (var kv in SponMetamagic.buffDict) { Metamagic metaId = (Metamagic)(kv.Key.first); int HeightenLevel = kv.Key.second; if (!meta_feat.ContainsKey(metaId)) { continue; } BlueprintBuff buff = kv.Value; if (!unit.HasFact(buff)) { continue; } //If the arcanist has the Metamixing exploit, she can add ONE //metamagic feat to a prepared spell, without using extra time to cast. //(regardless if the spell had metamagic feats when prepared) if (metaId == Metamagic.Heighten) { int originalLevel = spell.Spellbook.GetSpellLevel(spell.Blueprint); if (HeightenLevel <= originalLevel) { continue; } builder.AddHeightenMetamagic(meta_feat[metaId], HeightenLevel - originalLevel); unit.RemoveFact(buff); flag = true; if (hadMetamixing) { unit.Resources.Spend(ArcaneReservoir.resource, 1); break; } } else { builder.AddMetamagic(meta_feat[metaId]); unit.RemoveFact(buff); flag = true; if (hadMetamixing) { unit.Resources.Spend(ArcaneReservoir.resource, 1); break; } } } if (flag && !hadMetamixing) { unit.AddBuff(SponMetamagic.flagBuff, unit.Unit); } //fix ConvertedFrom. this is used in checking if a subspell is existed in memorized spells. //if spell is a subspell, spell.IsAvailableInSpellbook will use its m_ConvertedFrom(which is its master spell) //to get the return value. var newSpell = builder.ResultAbilityData; newSpell.ConvertedFrom = spell.ConvertedFrom; spell = newSpell; //UnityModManager.Logger.Log($"new spell {spell.Name} has metamagic {(spell.MetamagicData != null ? spell.MetamagicData.MetamagicMask : 0)}"); return(true); }
public static void SetActivateWithUnitCommand(this BlueprintActivatableAbility blueprintAbility, UnitCommand.CommandType value) { blueprintAbility.SetFieldValue("m_ActivateWithUnitCommand", value); }
public static void InterruptAndRemoveCommand(this UnitCommands unitCommands, UnitCommand.CommandType type) { GetMethod <UnitCommands, Action <UnitCommands, UnitCommand.CommandType> > ("InterruptAndRemoveCommand")(unitCommands, type); }
public static void Postfix(AbilityData __instance, ref UnitCommand.CommandType __result) { // Main.logger.Log($"Ability {__instance.Name} has action type of {__result}"); //Main.logger.Log($"Ability {__instance.Name} has metamagic {(__instance.MetamagicData == null ? 0 : (int)__instance.MetamagicData.MetamagicMask)}"); }