feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
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.
This commit is contained in:
155
SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamage.cs
Normal file
155
SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamage.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class AIWhenPlayDamage : AIWhenPlayTagArgument
|
||||
{
|
||||
private AIPolishConvertedExpression _damageArg;
|
||||
|
||||
private AIPolishConvertedExpression _countArg;
|
||||
|
||||
private readonly int EXECUTE_COUNT_ARG_OFFSET = 1;
|
||||
|
||||
private readonly int DAMAGE_ARG_OFFSET = 2;
|
||||
|
||||
protected override int SELECT_TYPE_OFFSET => 3;
|
||||
|
||||
public AIWhenPlayDamage(string text)
|
||||
: base(text)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void InitExpressions(string text)
|
||||
{
|
||||
base.InitExpressions(text);
|
||||
_damageArg = _exprList[_exprList.Count - DAMAGE_ARG_OFFSET];
|
||||
_countArg = _exprList[_exprList.Count - EXECUTE_COUNT_ARG_OFFSET];
|
||||
}
|
||||
|
||||
protected override void CreateLegalSelectTypes()
|
||||
{
|
||||
base.LegalSelectTypes = new AIScriptTokenArgType[6]
|
||||
{
|
||||
AIScriptTokenArgType.ALL_SELECT,
|
||||
AIScriptTokenArgType.RANDOM_SELECT,
|
||||
AIScriptTokenArgType.TARGET_SELECT,
|
||||
AIScriptTokenArgType.SECOND_TARGET_SELECT,
|
||||
AIScriptTokenArgType.DIVIDED_SELECT,
|
||||
AIScriptTokenArgType.RANDOM_MULTI_SELECT
|
||||
};
|
||||
}
|
||||
|
||||
public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List<int> playPtn, AISituationInfo situation = null)
|
||||
{
|
||||
List<AIVirtualCard> targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation);
|
||||
if (targetsFromField == null || targetsFromField.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int num = (int)_damageArg.EvalArg(tagOwner, playPtn, field, situation);
|
||||
int num2 = (int)_countArg.EvalArg(tagOwner, playPtn, field, situation);
|
||||
switch (base.SelectType)
|
||||
{
|
||||
case AIScriptTokenArgType.ALL_SELECT:
|
||||
{
|
||||
UpdateSituationRemovalType(situation);
|
||||
for (int j = 0; j < num2; j++)
|
||||
{
|
||||
AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, num, situation);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AIScriptTokenArgType.RANDOM_SELECT:
|
||||
{
|
||||
for (int k = 0; k < num2; k++)
|
||||
{
|
||||
AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, num, situation);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AIScriptTokenArgType.TARGET_SELECT:
|
||||
case AIScriptTokenArgType.SECOND_TARGET_SELECT:
|
||||
AIDamageSimulationUtility.ExecuteTargetSelectDamage(tagOwner, targetsFromField, field, playPtn, situation, base.SelectType, num, num2);
|
||||
break;
|
||||
case AIScriptTokenArgType.DIVIDED_SELECT:
|
||||
{
|
||||
for (int i = 0; i < num2; i++)
|
||||
{
|
||||
AIDamageSimulationUtility.DamageOldOrderedTargets(targetsFromField, num, tagOwner, field, playPtn, situation);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AIScriptTokenArgType.RANDOM_MULTI_SELECT:
|
||||
AIDamageSimulationUtility.DamageRandomMultiSelect(targetsFromField, tagOwner, field, num, num2, situation);
|
||||
break;
|
||||
default:
|
||||
AIConsoleUtility.LogError("AIPlayDamage.Execute() Error!! SelectType=" + base.SelectType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List<int> playPtn, AISituationInfo situation, LifeRecord targetLifeRecord)
|
||||
{
|
||||
if (base.SelectType != AIScriptTokenArgType.ALL_SELECT || (!target.IsLeader && !target.IsUnit) || !AIFilteringUtility.CheckMatchTargetFiltering(target, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int damageAmount = (int)_damageArg.EvalArg(owner, playPtn, field, situation);
|
||||
int num = (int)_countArg.EvalArg(owner, playPtn, field, situation);
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
int num2 = target.SimulateDamageAmount(damageAmount, isSkillDamage: true, owner.IsSpell);
|
||||
targetLifeRecord.CurrentLife -= num2;
|
||||
if (targetLifeRecord.CurrentLife <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void MultipleTargetLifePrediction(List<AIVirtualCard> targetList, AIVirtualCard owner, AIVirtualField field, List<int> playPtn, AISituationInfo situation, List<LifeRecord> lifeList)
|
||||
{
|
||||
if (base.SelectType != AIScriptTokenArgType.ALL_SELECT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int damageAmount = (int)_damageArg.EvalArg(owner, playPtn, field, situation);
|
||||
int num = (int)_countArg.EvalArg(owner, playPtn, field, situation);
|
||||
for (int i = 0; i < targetList.Count; i++)
|
||||
{
|
||||
AIVirtualCard aIVirtualCard = targetList[i];
|
||||
LifeRecord lifeRecord = lifeList[i];
|
||||
if ((!aIVirtualCard.IsLeader && !aIVirtualCard.IsUnit) || !AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < num; j++)
|
||||
{
|
||||
int num2 = aIVirtualCard.SimulateDamageAmount(damageAmount, isSkillDamage: true, owner.IsSpell);
|
||||
lifeRecord.CurrentLife -= num2;
|
||||
if (lifeRecord.CurrentLife <= 0)
|
||||
{
|
||||
if (aIVirtualCard.IsDestroyByBanish)
|
||||
{
|
||||
situation.RegisterOwnBanishedCard(aIVirtualCard);
|
||||
}
|
||||
else
|
||||
{
|
||||
situation.RegisterOwnDestroyedCard(aIVirtualCard);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override List<AIVirtualCard> GetFilteredTargets(List<AIVirtualCard> candidates, AIVirtualCard tagOwner, List<int> playPtn, AISituationInfo situation, bool isBlockDead = true)
|
||||
{
|
||||
return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead);
|
||||
}
|
||||
|
||||
public override AIRemovalType GetRemovalType()
|
||||
{
|
||||
return AIRemovalType.Damage;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user