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.
127 lines
4.1 KiB
C#
127 lines
4.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Wizard.Battle.UI;
|
|
using Wizard.Battle.View.Vfx;
|
|
|
|
public class Skill_random_array : SkillBase
|
|
{
|
|
public override bool IsAllowDestroyTarget => true;
|
|
|
|
public override bool IsShowSideLogSkillType => false;
|
|
|
|
public Dictionary<BattleCardBase, List<int>> SelectedIndex { get; protected set; } = new Dictionary<BattleCardBase, List<int>>();
|
|
|
|
public string RandomDistinctSkill { get; protected set; }
|
|
|
|
public Skill_random_array(SkillParameter skillPrm, string option)
|
|
: base(skillPrm, option)
|
|
{
|
|
string[] array = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_random_distinct, "NONE").Split(':');
|
|
RandomDistinctSkill = ((array.Length > 1) ? array[1] : "NONE");
|
|
}
|
|
|
|
public override VfxWithLoading Start(CallParameter parameter)
|
|
{
|
|
int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.random_range, -1);
|
|
int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.max, -1);
|
|
int num3 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.sum, -1);
|
|
bool flag = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.show_battle_log) == "true";
|
|
bool flag2 = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_random_distinct, "NONE").Split(':')[0] == "true";
|
|
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
|
foreach (BattleCardBase targetCard in parameter.targetCards)
|
|
{
|
|
if (!SelectedIndex.ContainsKey(targetCard))
|
|
{
|
|
SelectedIndex[targetCard] = new List<int>();
|
|
}
|
|
int[] array = new int[num];
|
|
for (int i = 0; i < num3; i++)
|
|
{
|
|
if (num2 != -1)
|
|
{
|
|
List<int> list = new List<int>();
|
|
for (int j = 0; j < num; j++)
|
|
{
|
|
List<int> allSkillSelectedIndex = GetAllSkillSelectedIndex(base.SkillPrm.ownerCard, targetCard);
|
|
if (array[j] < num2 && (!flag2 || !allSkillSelectedIndex.Contains(j)))
|
|
{
|
|
list.Add(j);
|
|
}
|
|
}
|
|
if (list.Count() == 0)
|
|
{
|
|
break;
|
|
}
|
|
int randomCount = GetRandomCount(list.Count);
|
|
SelectedIndex[targetCard].Add(list[randomCount]);
|
|
array[list[randomCount]]++;
|
|
}
|
|
else
|
|
{
|
|
int randomCount2 = GetRandomCount(num);
|
|
array[randomCount2]++;
|
|
}
|
|
}
|
|
sequentialVfxPlayer.Register(targetCard.SkillApplyInformation.GiveSkillRandomArray(array));
|
|
BattleCardBase target = targetCard;
|
|
SetOnLoseEvent(target, null, null);
|
|
if (IsBattleLog && flag)
|
|
{
|
|
BattleLogManager.GetInstance().AddLogSkillRandomArray(parameter.targetCards.ToList(), array, this);
|
|
}
|
|
}
|
|
return VfxWithLoading.Create(sequentialVfxPlayer);
|
|
}
|
|
|
|
public override VfxWithLoading Stop(SkillProcessor skillProcessor)
|
|
{
|
|
SelectedIndex.Clear();
|
|
return base.Stop(skillProcessor);
|
|
}
|
|
|
|
private int GetRandomCount(int range)
|
|
{
|
|
return base.SkillPrm.selfBattlePlayer.BattleMgr.StableRandom(range);
|
|
}
|
|
|
|
public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container)
|
|
{
|
|
targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card)
|
|
{
|
|
SelectedIndex.Remove(card);
|
|
return NullVfx.GetInstance();
|
|
};
|
|
}
|
|
|
|
public List<int> GetAllSkillSelectedIndex(BattleCardBase card, BattleCardBase targetCard)
|
|
{
|
|
List<int> list = new List<int>();
|
|
if (RandomDistinctSkill == "NONE")
|
|
{
|
|
if (SelectedIndex.ContainsKey(targetCard))
|
|
{
|
|
list.AddRange(SelectedIndex[targetCard]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
list.AddRange(GetSkillSelectedIndex(card.NormalSkills, targetCard));
|
|
list.AddRange(GetSkillSelectedIndex(card.EvolutionSkills, targetCard));
|
|
}
|
|
return list;
|
|
}
|
|
|
|
private List<int> GetSkillSelectedIndex(SkillCollectionBase skills, BattleCardBase targetCard)
|
|
{
|
|
List<int> list = new List<int>();
|
|
for (int i = 0; i < skills.Count(); i++)
|
|
{
|
|
if (skills.ElementAt(i) is Skill_random_array skill_random_array && skill_random_array.RandomDistinctSkill == RandomDistinctSkill && skill_random_array.SelectedIndex.ContainsKey(targetCard))
|
|
{
|
|
list.AddRange(skill_random_array.SelectedIndex[targetCard]);
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
}
|