Files
SVSimServer/SVSim.BattleEngine/Engine/SkillPreprocessBase.cs
gamer147 0d9d8acae0 feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
2026-06-05 16:57:20 -04:00

92 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using Wizard;
using Wizard.Battle.View.Vfx;
public abstract class SkillPreprocessBase : ISkillConditionChecker
{
public string BanId { get; protected set; } = string.Empty;
public abstract bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false);
public virtual bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck, bool isRegidentStop)
{
if (this is SkillPreprocessConditionCheck)
{
return IsRight(playerInfoPair, option, PreexecutionCheck, isRegidentStop);
}
return IsRight(playerInfoPair, option, PreexecutionCheck);
}
public virtual bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false)
{
return IsRight(playerInfoPair, option);
}
public abstract VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption);
protected Func<BattlePlayerReadOnlyInfoPair, int, int, bool> GetConditionJudgeFunc(string condition)
{
string[] list = condition.Split('=');
switch (list[0])
{
case "resonance":
if (list.Length > 1 && list[1] == "true")
{
return (BattlePlayerReadOnlyInfoPair pairInfo, int callCount, int turnEndCount) => pairInfo.ReadOnlySelf.SkillInfoDeckCards.Count() % 2 == 0;
}
return (BattlePlayerReadOnlyInfoPair pairInfo, int callCount, int turnEndCount) => pairInfo.ReadOnlySelf.SkillInfoDeckCards.Count() % 2 == 1;
case "call_count":
return (BattlePlayerReadOnlyInfoPair pairInfo, int callCount, int turnEndCount) => callCount >= ((list.Length > 1) ? int.Parse(list[1]) : 0);
case "turn_end_count":
case "op_turn_end_count":
case "me_or_op_turn_end_count":
return (BattlePlayerReadOnlyInfoPair pairInfo, int callCount, int turnEndCount) => turnEndCount >= ((list.Length > 1) ? int.Parse(list[1]) : 0);
default:
return (BattlePlayerReadOnlyInfoPair pairInfo, int callCount, int turnEndCount) => true;
}
}
protected string[] DisassemblySpecialString(string str)
{
str = str.Replace("(", string.Empty).Replace(")", string.Empty);
return str.Split('&');
}
protected void SkillIconInitialize(ParallelVfxPlayer vfx, List<BattleCardBase> inPlayCards)
{
if (!BattleManagerBase.GetIns().IsRecovery)
{
for (int i = 0; i < inPlayCards.Count; i++)
{
BattleCardBase battleCardBase = inPlayCards[i];
vfx.Register(battleCardBase.BattleCardView.BattleCardIconAnimations.Initialize(battleCardBase, battleCardBase.Skills));
}
}
}
protected void SkillIconInitialize(SequentialVfxPlayer vfx, List<BattleCardBase> inPlayCards)
{
if (!BattleManagerBase.GetIns().IsRecovery)
{
for (int i = 0; i < inPlayCards.Count; i++)
{
BattleCardBase battleCardBase = inPlayCards[i];
vfx.Register(battleCardBase.BattleCardView.BattleCardIconAnimations.Initialize(battleCardBase, battleCardBase.Skills));
}
}
}
public virtual void Clone(SkillPreprocessBase source, SkillBase Skill)
{
}
protected VfxBase StopSkill(SkillBase skill, SkillProcessor skillProcessor)
{
VfxWithLoading result = skill.Stop(skillProcessor);
skill.SetIsResidentSkillStartFlag(flg: false);
return result;
}
}