feat(battle-engine): close the AI-simulation subsystem (verbatim)
Copied the 89 uncopied AI*SimulationUtility/extension files defining the AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using LitJson;
|
||||
using Wizard.AutoTest;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Operation;
|
||||
|
||||
public class AttackOperationCommand : SkillOperationCommandBase
|
||||
{
|
||||
private readonly AutoTestBattleMgr.CardInfo _targetCardInfo;
|
||||
|
||||
public AttackOperationCommand(JsonData actionJsonData)
|
||||
: base(actionJsonData)
|
||||
{
|
||||
_targetCardInfo = new AutoTestBattleMgr.CardInfo(actionJsonData["target"].ToString());
|
||||
}
|
||||
|
||||
public override void Operation(BattleManagerBase battleMgr)
|
||||
{
|
||||
BattlePlayerPair battlePlayerPair = battleMgr.GetBattlePlayerPair(_cardInfo.IsPlayer);
|
||||
BattleCardBase battleCardBase = battlePlayerPair.Self.InPlayCards.SingleOrDefault((BattleCardBase c) => c.Index == _cardInfo.Index);
|
||||
BattleCardBase battleCardBase2 = battlePlayerPair.Opponent.ClassAndInPlayCardList.SingleOrDefault((BattleCardBase c) => c.Index == _targetCardInfo.Index);
|
||||
if (battleCardBase == null)
|
||||
{
|
||||
throw new Exception("場に " + _cardInfo.Name + " が見つかりませんでした");
|
||||
}
|
||||
if (battleCardBase2 == null)
|
||||
{
|
||||
throw new Exception("場に " + _targetCardInfo.Name + " が見つかりませんでした");
|
||||
}
|
||||
SetupSkillSummon();
|
||||
VfxBase vfx = battleMgr.OperateMgr.Attack(battleCardBase, battleCardBase2, _cardInfo.IsPlayer);
|
||||
battleMgr.VfxMgr.RegisterSequentialVfx(vfx);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Operation attack " + _cardInfo.Name + " to " + _targetCardInfo.Name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using LitJson;
|
||||
|
||||
namespace Wizard.Battle.Operation;
|
||||
|
||||
public class ChangeAIOperationCommand : IOperationCommand
|
||||
{
|
||||
public string Logic { get; private set; }
|
||||
|
||||
public int QueueCount { get; private set; }
|
||||
|
||||
public ChangeAIOperationCommand(JsonData actionJsonData)
|
||||
{
|
||||
Logic = actionJsonData["logic"].ToString();
|
||||
QueueCount = actionJsonData["queue_count"].ToInt();
|
||||
}
|
||||
|
||||
public void Operation(BattleManagerBase battleMgr)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LitJson;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Operation;
|
||||
|
||||
public class EvolveOperationCommand : SkillOperationCommandBase
|
||||
{
|
||||
public EvolveOperationCommand(JsonData actionJsonData)
|
||||
: base(actionJsonData)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Operation(BattleManagerBase battleMgr)
|
||||
{
|
||||
BattleCardBase battleCardBase = battleMgr.GetBattlePlayer(_cardInfo.IsPlayer).InPlayCards.SingleOrDefault((BattleCardBase c) => c.Index == _cardInfo.Index);
|
||||
if (battleCardBase == null)
|
||||
{
|
||||
throw new Exception("場に " + _cardInfo.Name + " が見つかりませんでした");
|
||||
}
|
||||
SetupSkillSummon();
|
||||
VfxWith<List<BattleCardBase>> skillSelectedCardsWithVfx = GetSkillSelectedCardsWithVfx(battleCardBase, isEvolution: true);
|
||||
VfxBase vfx = battleMgr.OperateMgr.EvolutionCard(battleCardBase, _cardInfo.IsPlayer, skillSelectedCardsWithVfx.Value);
|
||||
battleMgr.VfxMgr.RegisterSequentialVfx(vfx);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Operation evolve " + _cardInfo.Name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LitJson;
|
||||
using Wizard.AutoTest;
|
||||
using Wizard.Battle.Recovery;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Operation;
|
||||
|
||||
public class FusionOperationCommand : SkillOperationCommandBase
|
||||
{
|
||||
public FusionOperationCommand(JsonData actionJsonData)
|
||||
: base(actionJsonData)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual BattleCardBase ReplaceCardData(BattleManagerBase battleMgr, BattleCardBase fusionCard)
|
||||
{
|
||||
return fusionCard;
|
||||
}
|
||||
|
||||
public override void Operation(BattleManagerBase battleMgr)
|
||||
{
|
||||
BattleCardBase battleCardBase = battleMgr.GetBattlePlayer(_cardInfo.IsPlayer).HandCardList.SingleOrDefault((BattleCardBase c) => c.Index == _cardInfo.Index);
|
||||
if (battleCardBase == null)
|
||||
{
|
||||
if (!(UIManager.GetInstance().NowOpenDialog != null))
|
||||
{
|
||||
LocalLog.AccumulateTraceLog("Card not found in hand :" + _cardInfo.Index + " " + _cardInfo.Name);
|
||||
RecoveryManagerBase.OpenRecoveryFailedDialog();
|
||||
}
|
||||
return;
|
||||
}
|
||||
battleCardBase = ReplaceCardData(battleMgr, battleCardBase);
|
||||
List<BattleCardBase> list = new List<BattleCardBase>();
|
||||
foreach (SkillTargetInfo skillTargetInfo in _skillTargetInfoList)
|
||||
{
|
||||
AutoTestBattleMgr.CardInfo targetCardInfo = skillTargetInfo.TargetCard;
|
||||
BattleCardBase item = battleMgr.GetBattlePlayer(targetCardInfo.IsPlayer).AllCards.Single((BattleCardBase c) => c.Index == targetCardInfo.Index);
|
||||
list.Add(item);
|
||||
}
|
||||
VfxBase vfx = battleMgr.OperateMgr.FusionCard(battleCardBase, _cardInfo.IsPlayer, list);
|
||||
battleMgr.VfxMgr.RegisterSequentialVfx(vfx);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Operation comp_fusion " + _cardInfo.Name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LitJson;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.Recovery;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Operation;
|
||||
|
||||
public class PlayOperationCommand : SkillOperationCommandBase
|
||||
{
|
||||
public PlayOperationCommand(JsonData actionJsonData)
|
||||
: base(actionJsonData)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Operation(BattleManagerBase battleMgr)
|
||||
{
|
||||
BattlePlayerBase battlePlayer = battleMgr.GetBattlePlayer(_cardInfo.IsPlayer);
|
||||
BattleCardBase playCard = battlePlayer.HandCardList.SingleOrDefault((BattleCardBase c) => c.Index == _cardInfo.Index);
|
||||
bool isChoiceBrave = false;
|
||||
if (playCard == null && _cardInfo.Index == 0)
|
||||
{
|
||||
playCard = battlePlayer.Class;
|
||||
isChoiceBrave = true;
|
||||
}
|
||||
if (playCard == null)
|
||||
{
|
||||
if (!(UIManager.GetInstance().NowOpenDialog != null))
|
||||
{
|
||||
UnityEngine.Debug.LogError("手札に " + _cardInfo.Name + " が見つかりませんでした");
|
||||
RecoveryManagerBase.OpenRecoveryFailedDialog();
|
||||
}
|
||||
return;
|
||||
}
|
||||
SetupSkillSummon();
|
||||
VfxWith<List<BattleCardBase>> skillSelectedCardsWithVfx = GetSkillSelectedCardsWithVfx(playCard, isEvolution: false, (bool isTargetSelectSkill) => battleMgr.OperateMgr.InitSetCard(playCard, _cardInfo.IsPlayer, isTargetSelectSkill, isRecovery: true));
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(skillSelectedCardsWithVfx.Vfx);
|
||||
sequentialVfxPlayer.Register(battleMgr.OperateMgr.PlayCard(playCard, _cardInfo.IsPlayer, skillSelectedCardsWithVfx.Value, isRecovery: true, null, isChoiceBrave));
|
||||
battleMgr.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Operation play " + _cardInfo.Name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using LitJson;
|
||||
using Wizard.AutoTest;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Operation;
|
||||
|
||||
public abstract class SkillOperationCommandBase : IOperationCommand
|
||||
{
|
||||
protected AutoTestBattleMgr.CardInfo _cardInfo;
|
||||
|
||||
protected readonly List<SkillTargetInfo> _skillTargetInfoList = new List<SkillTargetInfo>();
|
||||
|
||||
public SkillOperationCommandBase(JsonData actionJsonData)
|
||||
{
|
||||
_cardInfo = parseSkillInfo(actionJsonData);
|
||||
if (!actionJsonData.HasKey("reaction"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
JsonData jsonData = actionJsonData["reaction"];
|
||||
if (jsonData.IsObject)
|
||||
{
|
||||
parseSkillInfo(jsonData);
|
||||
return;
|
||||
}
|
||||
foreach (JsonData item in jsonData.ToJsonDataCollection("reaction"))
|
||||
{
|
||||
parseSkillInfo(item);
|
||||
}
|
||||
}
|
||||
|
||||
private AutoTestBattleMgr.CardInfo parseSkillInfo(JsonData jsonData)
|
||||
{
|
||||
string cardName = jsonData["index"].ToString();
|
||||
int cardId = jsonData.ToIntOrDefault("id", 0);
|
||||
int cost = jsonData.ToIntOrDefault("cost", -1);
|
||||
AutoTestBattleMgr.CardInfo cardInfo = new AutoTestBattleMgr.CardInfo(cardName, cardId, cost);
|
||||
IEnumerable<JsonData> enumerable = jsonData.ToJsonDataCollection("skill_target");
|
||||
if (enumerable != null)
|
||||
{
|
||||
foreach (JsonData item in enumerable)
|
||||
{
|
||||
_skillTargetInfoList.Add(new SkillTargetInfo(cardInfo, item.ToString()));
|
||||
}
|
||||
}
|
||||
return cardInfo;
|
||||
}
|
||||
|
||||
protected void SetupSkillSummon()
|
||||
{
|
||||
}
|
||||
|
||||
public abstract void Operation(BattleManagerBase battleMgr);
|
||||
|
||||
protected VfxWith<List<BattleCardBase>> GetSkillSelectedCardsWithVfx(BattleCardBase card, bool isEvolution, Func<bool, VfxBase> func = null)
|
||||
{
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
List<SkillBase> list = card.GetSelectTypeSkill(isEvolution).ToList();
|
||||
SkillCollectionBase source = (isEvolution ? card.EvolutionSkills : card.NormalSkills);
|
||||
VfxBase vfx = NullVfx.GetInstance();
|
||||
if (list.Count == 0 && !isEvolution && source.Any(delegate(SkillBase s)
|
||||
{
|
||||
if (!(s is Skill_pp_fixeduse skill_pp_fixeduse))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return skill_pp_fixeduse.IsMutationFixedUseCost && s.CheckCondition(new BattlePlayerReadOnlyInfoPair(s.SkillPrm.selfBattlePlayer, s.SkillPrm.opponentBattlePlayer), new SkillConditionCheckerOption(), isPrePlay: true);
|
||||
}) && source.Any((SkillBase s) => s is Skill_transform))
|
||||
{
|
||||
Skill_transform accelerateOrCrystallizeTransformSkill = card.GetAccelerateOrCrystallizeTransformSkill();
|
||||
if (accelerateOrCrystallizeTransformSkill != null)
|
||||
{
|
||||
list = ins.CreateTransformCardRegisterVfx(accelerateOrCrystallizeTransformSkill.SkillPrm.ownerCard, accelerateOrCrystallizeTransformSkill.TransformId, accelerateOrCrystallizeTransformSkill.SkillPrm.ownerCard.IsPlayer).GetSelectTypeSkill(isEvolution).ToList();
|
||||
}
|
||||
}
|
||||
bool flag = list.Count > 0 && _skillTargetInfoList.Any();
|
||||
if (func != null)
|
||||
{
|
||||
vfx = func.Call(flag);
|
||||
}
|
||||
IEnumerable<SkillBase> enumerable = list.Where((SkillBase s) => s.IsChoiceType);
|
||||
bool flag2 = enumerable != null && enumerable.Count() > 0;
|
||||
int num = 0;
|
||||
foreach (SkillBase item3 in enumerable)
|
||||
{
|
||||
num = ((!(item3.ApplySelectFilter is SkillChoiceSelectFilter)) ? (num + 1) : (num + ((SkillChoiceSelectFilter)item3.ApplySelectFilter).Count));
|
||||
}
|
||||
List<BattleCardBase> list2 = new List<BattleCardBase>();
|
||||
if (flag)
|
||||
{
|
||||
foreach (SkillTargetInfo skillTargetInfo in _skillTargetInfoList)
|
||||
{
|
||||
if (flag2 && num > 0)
|
||||
{
|
||||
BattleCardBase item = ins.CreateTransformCardRegisterVfx(card, skillTargetInfo.TargetCard.Index, _cardInfo.IsPlayer);
|
||||
list2.Add(item);
|
||||
num--;
|
||||
continue;
|
||||
}
|
||||
AutoTestBattleMgr.CardInfo targetCardInfo = skillTargetInfo.TargetCard;
|
||||
BattleCardBase item2 = ins.GetBattlePlayer(targetCardInfo.IsPlayer).AllCards.Single((BattleCardBase c) => c.Index == targetCardInfo.Index);
|
||||
list2.Add(item2);
|
||||
}
|
||||
}
|
||||
return new VfxWith<List<BattleCardBase>>(vfx, list2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Wizard.AutoTest;
|
||||
|
||||
namespace Wizard.Battle.Operation;
|
||||
|
||||
public class SkillTargetInfo
|
||||
{
|
||||
public AutoTestBattleMgr.CardInfo OwnerInfo { get; private set; }
|
||||
|
||||
public AutoTestBattleMgr.CardInfo TargetCard { get; private set; }
|
||||
|
||||
public SkillTargetInfo(AutoTestBattleMgr.CardInfo ownerInfo, string targetTest)
|
||||
{
|
||||
OwnerInfo = ownerInfo;
|
||||
TargetCard = new AutoTestBattleMgr.CardInfo(targetTest);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user