Squashes 146 commits from battle-engine-extraction. Net: 2,045 files changed, +11,896 / -158,687 lines. Ships engine passes 4-7 (dead-code cull, view-layer stub, receive-path shrink) plus the Phase-5 AsyncLocal ambient deletion that turns concurrent battles into a type-system property rather than a scope contract. ## What landed **Passes 4-7 (chunks 1-34):** Extended the Phase-4 const-false collapse into a cascading cull across the skill graph, view layer, and receive-path periphery. Six mode flags (IsWatchBattle/IsReplayBattle/IsAdmin/IsAdminWatch/IsPuzzleQuest/ IsAINetwork) became `const false`, every guarded block deleted. Field*.cs subclass ctors + BackGroundBase + ObjectChecker culled to no-ops. Mulligan family reworked to take a mgr param through IMulliganMgr.InitMulligan. Emotion/Recovery/Resource clusters null-stubbed. Prediction/OperationSimulator/ skill filters converted from static ambient reads to per-mgr reads via SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr / ins.BattleMgr / this.BattleMgr. **Phase-5 ambient rip (chunks 35-47):** Deleted BattleAmbient / BattleAmbient- Context / TestBattleScope in full. Every per-battle mutable slot now lives on the mgr instance itself: mgr.InstanceIsForecast / InstanceIsRandomDraw / InstanceRecoveryInfo / InstanceViewerId / InstanceNetworkAgent / GameMgr BattleManagerBase.GetIns() returns null unconditionally; the residual static flags + 3 façades (Certification.ViewerId, Data.BattleRecoveryInfo, ToolboxGame.RealTimeNetworkAgent) are null-tolerant defaults kept for the handful of engine-internal readers that still reference their types. Zero BattleAmbient references anywhere in engine + node + tests. Added pre-seeded GameMgr ctor overload threaded through the mgr chain (BattleManagerBase → SingleBattleMgr / NetworkBattleManagerBase → NetworkStandard- BattleMgr → HeadlessBattleMgr / HeadlessNetworkBattleMgr). Fixtures build a GameMgr, seed it via HeadlessEngineEnv.SeedCharaIds/SeedNetUser, and pass it to the mgr's ctor — no ambient reach. Node side (SVSim.BattleNode/SessionBattleEngine): _ctx replaced with a plain GameMgr field; 34 `using var _ambient = BattleAmbient.Enter(_ctx)` scope wraps ripped from every accessor and mutator; EngineGlobalInit.WirePerSessionGameMgr takes GameMgr as a param and runs from SessionBattleEngine.SetupInternal BEFORE mgr construction. Test side: TestBattleScope deleted; 18 fixture [SetUp]s migrated to `HeadlessEngineEnv.EnsureProcessGlobals()`; MultiInstanceEngineTests rewritten around per-mgr construction (GetIns() → null is the pinned invariant). ## Regression fixes - **chunk-48** (MulliganCtrl): chunk-35's `= null` stubs on card lookups broke the live receive-driven Deal path (BattlePlayerBase.DrawCard NRE'd downstream of NetworkPlayerMulliganCtrl.StartMulliganVfx). Restored the three lookups via `_battlePlayer.BattleMgr.GetBattleCardIdx`. Engine tests were satisfied by the WireMulliganPhase seam; unit tests exposed the live-path gap. ## Ship state - SVSim.BattleEngine.Tests: 56/56 pass, 2 skip - SVSim.UnitTests: 1554/1554 pass (was 1523/31-fail before chunk 48) - Solution build: 0 source warnings (40 pre-existing NU1902 MessagePack CVEs in SVSim.EmulatedEntrypoint, unrelated) - Sequential PVP smoke: verified live (two back-to-back battles, no regression on cleanup/spinup) - Concurrent PVP smoke: verified live Adds tools/engine-port/ClosureAnalyzer/ — the Roslyn transitive-type-closure analyzer needed to make future cascade cleanup safe (per feedback memory "Engine cleanup needs closure tool" from the 2026-06-28 pass-3 failure). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
498 lines
16 KiB
C#
498 lines
16 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Wizard.Battle.Card;
|
|
using Wizard.Battle.View.Vfx;
|
|
|
|
namespace Wizard;
|
|
|
|
public class AIEmoteCtrl : IAIEmoteCtrl
|
|
{
|
|
|
|
private EnemyAI AI;
|
|
|
|
private bool _isEmoOnDestroyPlayed;
|
|
|
|
public AIEmoteCtrl(EnemyAI ai)
|
|
{
|
|
AI = ai;
|
|
}
|
|
|
|
public void SetUpEmoteEvent(BattlePlayerBase self, BattlePlayerBase opponent, OperateMgr operateManager)
|
|
{
|
|
opponent.OnTurnStartBeforeDraw += (SkillProcessor arg) => GetEmoteWithTurnStartSimulate(isAllyTurnStart: false);
|
|
self.OnTurnStartBeforeDraw += delegate
|
|
{
|
|
AI.EmoteMng.ResetOpponentTurnEmoteFlag();
|
|
return GetEmoteWithTurnStartSimulate(isAllyTurnStart: true);
|
|
};
|
|
Func<SkillProcessor, VfxBase> func = null;
|
|
func = delegate
|
|
{
|
|
VfxBase emote = AI.GetEmote(AIEmoteCmdType.ON_OPPONENT_TURN_END);
|
|
return NullVfx.GetInstance();
|
|
};
|
|
opponent.OnTurnEnd += func;
|
|
self.OnAddCemeteryEvent += delegate(BattleCardBase card, BattlePlayerBase.CEMETERY_TYPE cemeteryType, bool isOpen, SkillBase skill)
|
|
{
|
|
if (cemeteryType == BattlePlayerBase.CEMETERY_TYPE.NORMAL && !(card is NullBattleCard) && !(card is IVirtualBattleCard) && card.SelfBattlePlayer.ClassAndInPlayCardList.Contains(card))
|
|
{
|
|
AIUnknownAction situation = new AIUnknownAction(AI.CurrentVirtualField.SearchVirtualCard(card));
|
|
SequentialVfxPlayer sequential = SequentialVfxPlayer.Create();
|
|
VfxBase emote = AI.GetEmote(AIEmoteCmdType.ON_CARD_DESTROY, situation);
|
|
sequential.Register(emote);
|
|
if (emote != NullVfx.GetInstance())
|
|
{
|
|
_isEmoOnDestroyPlayed = true;
|
|
card.OnDestroy += (BattleCardBase destroyCard, SkillProcessor skillProcessor) => sequential;
|
|
}
|
|
}
|
|
};
|
|
self.Class.OnDamageAfter += (SkillProcessor skillProcessorOneTime) => (self.Class.Life <= 0) ? NullVfx.GetInstance() : AI.GetEmote(AIEmoteCmdType.ON_LEADER_DAMAGED);
|
|
opponent.Class.OnDamageAfter += (SkillProcessor skillProcessorOneTime) => (opponent.Class.Life <= 0) ? NullVfx.GetInstance() : AI.GetEmote(AIEmoteCmdType.ON_PLAYER_LEADER_DAMAGED);
|
|
operateManager.OnBeforeSetCard += delegate
|
|
{
|
|
AI.EmoteMng.EvalFieldOnBeforeSetCard();
|
|
};
|
|
operateManager.OnSetCardExecuted += delegate(BattleCardBase card)
|
|
{
|
|
AIUnknownAction situation = new AIUnknownAction(new AIVirtualCard(card, AI.CurrentVirtualField));
|
|
return AI.GetEmote(AIEmoteCmdType.ON_CARD_PLAY_OPPONENT, situation);
|
|
};
|
|
operateManager.OnBeforeAttack += delegate
|
|
{
|
|
AI.EmoteMng.EvalFieldOnBeforeAttack();
|
|
return NullVfx.GetInstance();
|
|
};
|
|
operateManager.OnAttackExecuted += (BattleCardBase attacker, BattleCardBase target, bool needAttack) => AI.GetEmote(AIEmoteCmdType.ON_OPPONENT_ATTACK);
|
|
}
|
|
|
|
private VfxBase GetEmoteWithTurnStartSimulate(bool isAllyTurnStart)
|
|
{
|
|
AIVirtualField aIVirtualField = new AIVirtualField((AI.BeforeLatestActionField != null) ? AI.BeforeLatestActionField : AI.CurrentVirtualField);
|
|
if (aIVirtualField.AllyTurnCount > 0 || aIVirtualField.EnemyTurnCount > 0)
|
|
{
|
|
AIVirtualTurnEndSimulator.TurnEnd(new AIVirtualTurnEndInfo(isAllyTurnStart ? aIVirtualField.EnemyClass : aIVirtualField.AllyClass), aIVirtualField);
|
|
}
|
|
AIVirtualTurnStartInfo situation = new AIVirtualTurnStartInfo(isAllyTurnStart ? aIVirtualField.AllyClass : aIVirtualField.EnemyClass);
|
|
aIVirtualField.TurnStartFieldProcess(situation);
|
|
return AI.GetEmote(isAllyTurnStart ? AIEmoteCmdType.ON_ALLY_TURN_START : AIEmoteCmdType.ON_OPPONENT_TURN_START, situation);
|
|
}
|
|
|
|
public AIEmoteCmd OnOpponentEmotion(ClassCharaPrm.EmotionType emoteType)
|
|
{
|
|
if (AI.EmoteMng.IsCheckmated())
|
|
{
|
|
return null;
|
|
}
|
|
if (AI.IsThisTurnEmotePlayed)
|
|
{
|
|
return null;
|
|
}
|
|
if (!AI.EmoteQuery.UseInnerEmote)
|
|
{
|
|
return null;
|
|
}
|
|
ClassCharaPrm.EmotionType replyEmote = ClassCharaPrm.EmotionType.NULL;
|
|
if (AI.EmoteMng.IsReplyAllowed(emoteType, ref replyEmote))
|
|
{
|
|
return new AIEmoteCmd(replyEmote);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnAllyTurnStart(AISituationInfo situation)
|
|
{
|
|
AI.EmoteMng.SetUpOnAllyTurnStart();
|
|
AI.EmoteMng.EvalFieldOnTurnStart();
|
|
_isEmoOnDestroyPlayed = false;
|
|
int emoteOnTurnStart = AI.StyleQuery.GetEmoteOnTurnStart(isAllyTurn: true, situation.Actor.SelfField);
|
|
if (emoteOnTurnStart >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteOnTurnStart);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnOpponentTurnStart(AISituationInfo situation)
|
|
{
|
|
AI.EmoteMng.EvalFieldOnOpponentTurnStart();
|
|
_isEmoOnDestroyPlayed = false;
|
|
AIVirtualField selfField = situation.Actor.SelfField;
|
|
int emoteOnTurnStart = AI.StyleQuery.GetEmoteOnTurnStart(isAllyTurn: false, selfField);
|
|
if (emoteOnTurnStart >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteOnTurnStart);
|
|
}
|
|
emoteOnTurnStart = AI.StyleQuery.GetPlayerEmoteOnTurnStart(selfField);
|
|
if (emoteOnTurnStart >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteOnTurnStart, isAlly: false);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnAllyTurnEnd()
|
|
{
|
|
if (AI.IsTurnEndLethal)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(22);
|
|
}
|
|
for (int i = 0; i < AI.CurrentVirtualField.CardListSet.BothClassAndInplayCards.Count; i++)
|
|
{
|
|
int emoteOnTurnEndCategory = AI.CurrentVirtualField.CardListSet.BothClassAndInplayCards[i].GetEmoteOnTurnEndCategory(isAllyTurnEnd: true);
|
|
if (emoteOnTurnEndCategory >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteOnTurnEndCategory);
|
|
}
|
|
}
|
|
int emoteOnTurnEnd = AI.StyleQuery.GetEmoteOnTurnEnd(isAllyTurn: true);
|
|
if (emoteOnTurnEnd >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteOnTurnEnd);
|
|
}
|
|
emoteOnTurnEnd = AI.StyleQuery.GetPlayerEmoteOnTurnEnd(isPlayerTurn: false);
|
|
if (emoteOnTurnEnd >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteOnTurnEnd, isAlly: false);
|
|
}
|
|
if (AI.EmoteMng.IsCheckmated())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(13);
|
|
}
|
|
if (AI.EmoteMng.IsHuntDown())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(14);
|
|
}
|
|
if (AI.IsRoyal() && AI.EmoteMng.IsEnoughUnit())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(102);
|
|
}
|
|
if (AI.IsNecromancer() && AI.EmoteMng.IsEnoughGrave())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(501);
|
|
}
|
|
if (AI.EmoteMng.IsAwaking(1))
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(401);
|
|
}
|
|
if (AI.EmoteMng.IsUnexpectedBattle())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(11);
|
|
}
|
|
if (AI.ALLY.InPlayCards.Count() < 5 && AI.EmoteMng.IsRemainTooPP())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(15);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnOpponentTurnEnd()
|
|
{
|
|
if (AI.EmoteMng.IsOpponentTurnEmoteOccured)
|
|
{
|
|
return null;
|
|
}
|
|
for (int i = 0; i < AI.CurrentVirtualField.CardListSet.BothClassAndInplayCards.Count; i++)
|
|
{
|
|
int emoteOnTurnEndCategory = AI.CurrentVirtualField.CardListSet.BothClassAndInplayCards[i].GetEmoteOnTurnEndCategory(isAllyTurnEnd: false);
|
|
if (emoteOnTurnEndCategory >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteOnTurnEndCategory);
|
|
}
|
|
}
|
|
int emoteOnTurnEnd = AI.StyleQuery.GetEmoteOnTurnEnd(isAllyTurn: false);
|
|
if (emoteOnTurnEnd >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteOnTurnEnd);
|
|
}
|
|
emoteOnTurnEnd = AI.StyleQuery.GetPlayerEmoteOnTurnEnd(isPlayerTurn: true);
|
|
if (emoteOnTurnEnd >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteOnTurnEnd, isAlly: false);
|
|
}
|
|
if (AI.EmoteMng.IsCheckmated())
|
|
{
|
|
return null;
|
|
}
|
|
if (AI.EmoteMng.IsOpponentEarnGreatMerit())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(33);
|
|
}
|
|
if (AI.OPPONENT.InPlayCards.Count() < 5 && AI.EmoteMng.IsOpponentRemainTooPP())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(31);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnIterationStart()
|
|
{
|
|
if (AI.EmoteMng.IsCheckmated())
|
|
{
|
|
return null;
|
|
}
|
|
float num = AI.EmoteMng.EvalDisplacement_PlayedValue();
|
|
AI.EmoteMng.ResetLastOpr();
|
|
if (num < -4f)
|
|
{
|
|
return null;
|
|
}
|
|
if (num > 4f)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(1);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnCardPlay(AISituationInfo situation)
|
|
{
|
|
if (situation == null || situation.Actor == null)
|
|
{
|
|
return null;
|
|
}
|
|
int num = AI.CurrentVirtualField.AllyHandCards.FindIndex((AIVirtualCard c) => c.IsSameCard(situation.Actor));
|
|
if (num < 0)
|
|
{
|
|
return null;
|
|
}
|
|
AIVirtualField aIVirtualField = new AIVirtualField(AI.CurrentVirtualField)
|
|
{
|
|
BestPlayPtn = new List<int> { num }
|
|
};
|
|
AIVirtualCard aIVirtualCard = aIVirtualField.SearchVirtualCard(situation.Actor);
|
|
AISelectedTargetInfoSet aISelectedTargetInfoSet = new AISelectedTargetInfoSet();
|
|
if (situation.SelectedTargets != null)
|
|
{
|
|
for (int num2 = 0; num2 < AISelectedTargetInfoSet.LENGTH; num2++)
|
|
{
|
|
AISelectedTargetInfo aISelectedTargetInfo = situation.SelectedTargets.Get(num2);
|
|
if (aISelectedTargetInfo == null || !aISelectedTargetInfo.HasTarget)
|
|
{
|
|
continue;
|
|
}
|
|
AISelectedTargetInfo aISelectedTargetInfo2 = new AISelectedTargetInfo(aISelectedTargetInfo.Type);
|
|
int count = aISelectedTargetInfo.Targets.Count;
|
|
for (int num3 = 0; num3 < count; num3++)
|
|
{
|
|
if (aISelectedTargetInfo.Type == TargetSelectType.Choice)
|
|
{
|
|
aISelectedTargetInfo2.AddTarget(aISelectedTargetInfo.Targets[num3]);
|
|
continue;
|
|
}
|
|
AIVirtualCard target = aIVirtualField.SearchVirtualCard(aISelectedTargetInfo.Targets[num3]);
|
|
aISelectedTargetInfo2.AddTarget(target);
|
|
}
|
|
aISelectedTargetInfoSet.Set(aISelectedTargetInfo2, num2);
|
|
}
|
|
if (situation.SelectedTargets.HasChoiceTarget)
|
|
{
|
|
aISelectedTargetInfoSet.SetChoiceTarget(situation.SelectedTargets.ChoiceTarget);
|
|
}
|
|
}
|
|
AIVirtualTargetSelectAction aIVirtualTargetSelectAction = new AIVirtualTargetSelectAction(aIVirtualCard, aIVirtualCard, situation.ActionType, aISelectedTargetInfoSet);
|
|
PlaySimulationInfo playSimulationInfo = AIPlayCardSimulationUtility.CreatePlaySimulationInfo(aIVirtualCard, aIVirtualTargetSelectAction, aIVirtualField);
|
|
if (playSimulationInfo == null)
|
|
{
|
|
AIConsoleUtility.LogError("AIEmoteCtrl:OnCardPlay() playSimulationInfo is null. CardName:" + ((aIVirtualCard != null) ? aIVirtualCard.CardName : ""));
|
|
return null;
|
|
}
|
|
if (playSimulationInfo.Type == PlaySimulationType.Accelerate || playSimulationInfo.Type == PlaySimulationType.Crystalize)
|
|
{
|
|
AISinglePlayptnRecord playptnRecord = AI.PlayPtnRecorder.FindMatchedPlayPtnRecord(aIVirtualField.BestPlayPtn, aIVirtualField);
|
|
aIVirtualTargetSelectAction.SetActor(aIVirtualCard.FindRealActor(playptnRecord));
|
|
}
|
|
AIVirtualPlaySimulator.PlayCard(aIVirtualTargetSelectAction, aIVirtualField, playSimulationInfo);
|
|
if (aIVirtualField.EnemyClass.Life <= 0 || aIVirtualField.EnemyClass.IsDead)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(22);
|
|
}
|
|
if (AI.EmoteMng.IsCheckmated())
|
|
{
|
|
return null;
|
|
}
|
|
AIRealBattleCardSearcher.SearchBattleCardFromSituation(AI.PlayerPair, situation, out var actor, out var targetList);
|
|
if (actor == null || (situation.ActionTarget != null && (targetList == null || targetList.Count < 1 || targetList[0] == null)) || (situation.SecondActionTarget != null && (targetList == null || targetList.Count < 2 || targetList[1] == null)))
|
|
{
|
|
return null;
|
|
}
|
|
if (AI.ALLY.IsSelfTurn && AI.IsAllyCard(actor))
|
|
{
|
|
AIVirtualCard actor2 = situation.Actor;
|
|
int emoteCategory = actor2.GetEmoteCategory(AIPlayTagType.EmoteOnPlay);
|
|
if (emoteCategory >= 0)
|
|
{
|
|
AIEmoteCmd result = AI.EmoteQuery.SearchEmoteAtRandom(emoteCategory);
|
|
AI.EmoteQuery.OnCardPlayEmotion();
|
|
return result;
|
|
}
|
|
new BattlePlayerPair(actor.SelfBattlePlayer, actor.OpponentBattlePlayer);
|
|
int num4 = actor2.BattleSkills.Count();
|
|
for (int num5 = 0; num5 < num4; num5++)
|
|
{
|
|
SkillBase skill = actor2.BattleSkills.ElementAt(num5);
|
|
if (AI.ParamQuery.IsBanishSkill(skill))
|
|
{
|
|
return OnBanishSkill(actor, aIVirtualField);
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnAllyAttack(AISituationInfo situation)
|
|
{
|
|
if (!(situation is AIVirtualAttackInfo { Actor: not null, AttackTarget: not null }))
|
|
{
|
|
AIConsoleUtility.LogError("OnAllyAttack() error!!! situation is not valid attackSituation");
|
|
return null;
|
|
}
|
|
AI.EmoteMng.EvalFieldOnAttack();
|
|
AIVirtualField aIVirtualField = new AIVirtualField(AI.CurrentVirtualField);
|
|
AIVirtualAttackInfo aIVirtualAttackInfo2 = AISimulationUtility.CreateActionInfoOnFieldFromSituation(aIVirtualField, situation) as AIVirtualAttackInfo;
|
|
if (!situation.IsSameSituation(aIVirtualAttackInfo2))
|
|
{
|
|
AIConsoleUtility.LogError("OnAllyAttack() error!!! Failed situation clone");
|
|
return null;
|
|
}
|
|
AIVirtualAttackSimulator.Attack(aIVirtualAttackInfo2, aIVirtualField);
|
|
if (aIVirtualField.EnemyClass.IsDead)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(22);
|
|
}
|
|
if (AI.EmoteMng.IsCheckmated())
|
|
{
|
|
return null;
|
|
}
|
|
int emoteCategory = aIVirtualAttackInfo2.Actor.GetEmoteCategory(AIPlayTagType.EmoteOnAtk);
|
|
if (emoteCategory >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteCategory);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnAllyEvolution(AISituationInfo situation)
|
|
{
|
|
if (situation == null || situation.Actor == null || situation.ActionType != AIOperationType.EVOLVE)
|
|
{
|
|
return null;
|
|
}
|
|
AIVirtualField aIVirtualField = new AIVirtualField(AI.CurrentVirtualField);
|
|
AIVirtualActionInfo aIVirtualActionInfo = AISimulationUtility.CreateActionInfoOnFieldFromSituation(aIVirtualField, situation);
|
|
if (!situation.IsSameSituation(aIVirtualActionInfo))
|
|
{
|
|
return null;
|
|
}
|
|
AIVirtualEvolutionSimulator.ManualEvolve(aIVirtualActionInfo, aIVirtualField);
|
|
if (aIVirtualField.EnemyClass.IsDead)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(22);
|
|
}
|
|
if (AI.EmoteMng.IsCheckmated())
|
|
{
|
|
return null;
|
|
}
|
|
int emoteCategory = aIVirtualActionInfo.Actor.GetEmoteCategory(AIPlayTagType.EmoteOnEvo);
|
|
if (emoteCategory >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteCategory);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnBanishSkill(BattleCardBase actCard, AIVirtualField fieldAfterPlayed)
|
|
{
|
|
if (AI.EmoteMng.IsBanishOverExpected(actCard, fieldAfterPlayed))
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(21);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnOpponentPlayCardExecuted(AISituationInfo situation)
|
|
{
|
|
if (AI.EmoteMng.IsCheckmated() || situation == null || situation.Actor == null)
|
|
{
|
|
return null;
|
|
}
|
|
AIVirtualCard actor = situation.Actor;
|
|
if (AI.EmoteMng.IsOpponentBanishSplendid(actor))
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(35);
|
|
}
|
|
if (AI.EmoteMng.IsOpponentBanishBad(actor))
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(36);
|
|
}
|
|
if (!actor.IsAlly && AI.EmoteMng.IsGiantPlayed())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(34);
|
|
}
|
|
if (AI.EmoteMng.IsOpponentHealClassLifeLargeOnCardPlay())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(37);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnOpponentAttackExecuted()
|
|
{
|
|
if (AI.EmoteMng.IsCheckmated())
|
|
{
|
|
return null;
|
|
}
|
|
if (AI.EmoteMng.IsOpponentHealClassLifeLargeOnAttack())
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(37);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnCardDestroy(AISituationInfo situation)
|
|
{
|
|
if (situation == null || situation.Actor == null || situation.ActionType != AIOperationType.UNKNOWN)
|
|
{
|
|
return null;
|
|
}
|
|
AIVirtualCard actor = situation.Actor;
|
|
if (actor.IsAlly)
|
|
{
|
|
int emoteCategory = actor.GetEmoteCategory(AIPlayTagType.ForceEmoteOnDestroy);
|
|
if (emoteCategory >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteCategory);
|
|
}
|
|
}
|
|
if (AI.EmoteMng.IsCheckmated() || _isEmoOnDestroyPlayed)
|
|
{
|
|
return null;
|
|
}
|
|
if (actor.IsAlly)
|
|
{
|
|
int emoteCategory2 = actor.GetEmoteCategory(AIPlayTagType.EmoteOnDestroy);
|
|
if (emoteCategory2 >= 0)
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteCategory2);
|
|
}
|
|
if (AI.OPPONENT.IsSelfTurn && AI.EmoteMng.IsEliminatedAllyLegion(situation.Actor))
|
|
{
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(101);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public AIEmoteCmd OnLeaderDamaged(AIVirtualField field)
|
|
{
|
|
int emoteOnLeaderDamaged = AI.StyleQuery.GetEmoteOnLeaderDamaged(field);
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(emoteOnLeaderDamaged);
|
|
}
|
|
|
|
public AIEmoteCmd OnPlayerLeaderDamaged(AIVirtualField field)
|
|
{
|
|
int playerEmoteOnLeaderDamaged = AI.StyleQuery.GetPlayerEmoteOnLeaderDamaged(field);
|
|
return AI.EmoteQuery.SearchEmoteAtRandom(playerEmoteOnLeaderDamaged, isAlly: false);
|
|
}
|
|
}
|