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.
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
public class SkillRandomEachSameBaseCardIdFilter : ISkillSelectFilter
|
|
{
|
|
protected int _restCount;
|
|
|
|
protected int _count;
|
|
|
|
protected BattlePlayerBase _player;
|
|
|
|
public int CalcCount(SkillOptionValue option)
|
|
{
|
|
return _count;
|
|
}
|
|
|
|
public SkillRandomEachSameBaseCardIdFilter(int randomCount, BattlePlayerBase player)
|
|
{
|
|
_restCount = randomCount;
|
|
_player = player;
|
|
}
|
|
|
|
public IEnumerable<BattleCardBase> Filtering(IEnumerable<BattleCardBase> cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption)
|
|
{
|
|
if (cards.Count() == 0)
|
|
{
|
|
return Enumerable.Empty<BattleCardBase>();
|
|
}
|
|
List<BattleCardBase> list = new List<BattleCardBase>();
|
|
IEnumerable<int> ids = cards.Select((BattleCardBase c) => c.BaseParameter.BaseCardId).Distinct();
|
|
int i;
|
|
for (i = 0; i < ids.Count(); i++)
|
|
{
|
|
List<BattleCardBase> list2 = cards.Where((BattleCardBase c) => c.BaseParameter.BaseCardId == ids.ElementAt(i)).ToList();
|
|
int num = list2.Count() - _restCount;
|
|
for (int num2 = 0; num2 < num; num2++)
|
|
{
|
|
BattleCardBase item = list2[BattleManagerBase.GetIns().StableRandom(list2.Count)];
|
|
list.Add(item);
|
|
list2.Remove(item);
|
|
_count++;
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
}
|