static bool Prefix(UnitCommand command) { if (IsInCombat()) { // passing acting ending delaying // not in combat o x x x // in combat - not current x x x x // in combat - current x o o x bool canTick = default; if (command is UnitAttackOfOpportunity) { canTick = true; } else if (command is UnitUseAbility unitUseImmediateAbility && unitUseImmediateAbility.Spell.Blueprint.ActionType == UnitCommand.CommandType.Swift && unitUseImmediateAbility.Spell.Blueprint.ComponentsArray.Any(c => c.name.StartsWith("$AbilityIsImmediateAction"))) { canTick = true; } else if (IsPassing()) { canTick = !command.Executor.IsInCombat; } else { canTick = command.Executor.IsCurrentUnit() && (IsActing() || IsEnding()); if (canTick && !command.IsStarted) { if (command.IsSpellCombatAttack() && !command.Executor.HasMoveAction()) { command.Executor.Descriptor.RemoveFact(BlueprintRoot.Instance.SystemMechanics.MagusSpellCombatBuff); command.Interrupt(); canTick = false; } if (command is UnitUseAbility unitUseAbility && !unitUseAbility.Spell.IsAvailableForCast) { command.Interrupt(); canTick = false; } } } if (!canTick) { return(false); } if (command.Executor.IsInCombat) { command.NextApproachTime = Game.Instance.TimeController.GameTime; } }