Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
110 lines
3.3 KiB
C#
110 lines
3.3 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Wizard;
|
|
|
|
public class AIOtherEvoDestroy : AIOtherEvoTagArgument
|
|
{
|
|
private AIPolishConvertedExpression _selectCount;
|
|
|
|
private int _expectedSelectCountArgOffset;
|
|
|
|
private static int SELECT_COUNT_OFFSET => 1;
|
|
|
|
protected override int SELECT_TYPE_ARG_OFFSET => _expectedSelectCountArgOffset + 1;
|
|
|
|
public AIOtherEvoDestroy(string text)
|
|
: base(text)
|
|
{
|
|
}
|
|
|
|
protected override void InitExpressions(string text)
|
|
{
|
|
InitExprList(text);
|
|
InitializeSelectCount();
|
|
InitializeFilters();
|
|
base.SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_ARG_OFFSET], base.LegalSelectTypes);
|
|
}
|
|
|
|
public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation)
|
|
{
|
|
if (candidate.IsIndependent || candidate.IsIndestructible)
|
|
{
|
|
return false;
|
|
}
|
|
return IsCertainlyIncludeTarget(owner, candidate, situation);
|
|
}
|
|
|
|
protected override List<AIVirtualCard> GetCandidateRange(AIVirtualField field)
|
|
{
|
|
return field.CardListSet.BothInplayCards;
|
|
}
|
|
|
|
protected override void RunTagMethod(List<AIVirtualCard> targets, AIVirtualField field, AIVirtualCard tagOwner, List<int> playPtn, AISituationInfo situation)
|
|
{
|
|
base.RunTagMethod(targets, field, tagOwner, playPtn, situation);
|
|
switch (base.SelectType)
|
|
{
|
|
case AIScriptTokenArgType.ALL_SELECT:
|
|
AISkillSimulationUtility.DestroyAll(targets, field, situation);
|
|
break;
|
|
case AIScriptTokenArgType.RANDOM_SELECT:
|
|
case AIScriptTokenArgType.RANDOM_MULTI_SELECT:
|
|
{
|
|
int selectCount = GetSelectCount(tagOwner, field, playPtn, situation);
|
|
AISkillSimulationUtility.DestroyRandom(targets, tagOwner, field, playPtn, situation, selectCount);
|
|
break;
|
|
}
|
|
case AIScriptTokenArgType.TARGET_SELECT:
|
|
break;
|
|
}
|
|
}
|
|
|
|
public override AIRemovalType GetRemovalType()
|
|
{
|
|
return AIRemovalType.Destroy;
|
|
}
|
|
|
|
protected override void CreateLegalSelectTypes()
|
|
{
|
|
base.LegalSelectTypes = new AIScriptTokenArgType[3]
|
|
{
|
|
AIScriptTokenArgType.ALL_SELECT,
|
|
AIScriptTokenArgType.RANDOM_SELECT,
|
|
AIScriptTokenArgType.RANDOM_MULTI_SELECT
|
|
};
|
|
}
|
|
|
|
protected override bool CheckIsCandidateSelectedBySelectType(List<AIVirtualCard> targets, AIVirtualCard tagOwner, AIVirtualField field, List<int> playPtn, AISituationInfo situation, AIVirtualCard candidate)
|
|
{
|
|
if (base.SelectType == AIScriptTokenArgType.RANDOM_MULTI_SELECT)
|
|
{
|
|
return targets.Count <= GetSelectCount(tagOwner, field, playPtn, situation);
|
|
}
|
|
return base.CheckIsCandidateSelectedBySelectType(targets, tagOwner, field, playPtn, situation, candidate);
|
|
}
|
|
|
|
protected virtual void InitializeSelectCount()
|
|
{
|
|
_selectCount = null;
|
|
_expectedSelectCountArgOffset = SELECT_COUNT_OFFSET;
|
|
AIPolishConvertedExpression aIPolishConvertedExpression = _exprList[_exprList.Count - _expectedSelectCountArgOffset];
|
|
if (aIPolishConvertedExpression.IsMathematicExpress())
|
|
{
|
|
_selectCount = aIPolishConvertedExpression;
|
|
}
|
|
if (_selectCount == null)
|
|
{
|
|
_expectedSelectCountArgOffset = SELECT_COUNT_OFFSET - 1;
|
|
}
|
|
}
|
|
|
|
private int GetSelectCount(AIVirtualCard owner, AIVirtualField field, List<int> playPtn, AISituationInfo situation)
|
|
{
|
|
if (_selectCount == null)
|
|
{
|
|
return 1;
|
|
}
|
|
return (int)_selectCount.EvalArg(owner, playPtn, field, situation);
|
|
}
|
|
}
|