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.
105 lines
2.9 KiB
C#
105 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Wizard;
|
|
using Wizard.Battle.View.Vfx;
|
|
|
|
public class SkillPreprocessTimesPerTurn : SkillPreprocessTimesPerBase
|
|
{
|
|
private const string SAME_BASE_CARD_ID_TEXT = "same_base_card_id";
|
|
|
|
private BattleCardBase _owner;
|
|
|
|
public bool IsSameBaseCardId { get; private set; }
|
|
|
|
public SkillPreprocessTimesPerTurn(BattleCardBase card, string option)
|
|
: base(int.Parse(option.Split(':')[0]))
|
|
{
|
|
_owner = card;
|
|
string[] array = option.Split(':');
|
|
IsSameBaseCardId = array.Any((string o) => o == "same_base_card_id");
|
|
if (!IsSameBaseCardId && array.Count() > 1)
|
|
{
|
|
base.BanId = array[1];
|
|
}
|
|
}
|
|
|
|
public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false)
|
|
{
|
|
if (!base.IsRight(playerInfoPair, option, PreexecutionCheck))
|
|
{
|
|
return false;
|
|
}
|
|
if (base.BanId != string.Empty)
|
|
{
|
|
return GetSkillNumInvokeCount(_owner, base.BanId) < _limitCount;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption)
|
|
{
|
|
base.Start(playerPair, skill, skillProcessor, optionValue, checkerOption);
|
|
if (_invokeCount == 1)
|
|
{
|
|
BattlePlayerBase onTurnPlayer = (playerPair.Self.IsSelfTurn ? playerPair.Self : playerPair.Opponent);
|
|
Func<SkillProcessor, VfxBase> callStopOneTime = null;
|
|
callStopOneTime = delegate
|
|
{
|
|
_invokeCount = 0;
|
|
onTurnPlayer.OnTurnEnd -= callStopOneTime;
|
|
return NullVfx.GetInstance();
|
|
};
|
|
onTurnPlayer.OnTurnEnd += callStopOneTime;
|
|
}
|
|
return NullVfx.GetInstance();
|
|
}
|
|
|
|
public override void Clone(SkillPreprocessBase source, SkillBase skill)
|
|
{
|
|
base.Clone(source, skill);
|
|
if (source is SkillPreprocessTimesPerTurn skillPreprocessTimesPerTurn)
|
|
{
|
|
_owner = skillPreprocessTimesPerTurn._owner;
|
|
base.BanId = skillPreprocessTimesPerTurn.BanId;
|
|
}
|
|
}
|
|
|
|
public int GetLimitCount()
|
|
{
|
|
return _limitCount;
|
|
}
|
|
|
|
public int GetInvokeCount()
|
|
{
|
|
return _invokeCount;
|
|
}
|
|
|
|
public void ResetInvokeCount()
|
|
{
|
|
_invokeCount = 0;
|
|
}
|
|
|
|
private int GetSkillNumInvokeCount(BattleCardBase card, string banId)
|
|
{
|
|
return GetSkillNumInvokeCount(card.NormalSkills, banId) + GetSkillNumInvokeCount(card.EvolutionSkills, banId);
|
|
}
|
|
|
|
private int GetSkillNumInvokeCount(SkillCollectionBase skills, string banId)
|
|
{
|
|
int num = 0;
|
|
for (int i = 0; i < skills.Count(); i++)
|
|
{
|
|
List<SkillPreprocessBase> preprocessList = skills.ElementAt(i).PreprocessList;
|
|
for (int j = 0; j < preprocessList.Count(); j++)
|
|
{
|
|
if (preprocessList[j] is SkillPreprocessTimesPerTurn && preprocessList[j].BanId == banId)
|
|
{
|
|
num += (preprocessList[j] as SkillPreprocessTimesPerTurn).GetInvokeCount();
|
|
}
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
}
|