using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Wizard;

public abstract class BattleLogTextBuilderAttachSkill
{
	private static readonly string COST_MAX = "cost.max";

	private const string OP_INPLAY_UNIT_COUNT = "op.inplay.unit.count";

	private const string ME_INPLAY = "me.inplay";

	private const string ME_HAND = "me.hand";

	private const string ME_INPLAY_UNIT = "me.inplay.unit";

	private const string ME_INPLAY_CLASS_EP = "me.inplay.class.ep";

	private const string ME_HAND_COUNT = "me.hand.count";

	private const string PLAYED_CARD = "played_card";

	private const string ME_INPLAY_SELF = "me.inplay_self.count";

	private const string ME_INPLAY_CLASS_PP = "me.inplay.class.pp";

	private const string ME_TURN_COUNT = "{me.inplay.class.turn}";

	private const string ME_DECK_NOT_DUPLICATION = "me.deck.unique_base_card_id_card";

	public abstract string BuildTextAttachSkill(SkillBase attachedSkill, bool isBuffText, bool isNow);

	public static string _GetSpecificCardCostInformation(SkillBase skill, bool isTarget)
	{
		if (isTarget)
		{
			if (skill.ApplyCardFilterList.Any((ISkillCardFilter f) => f is SkillParameterCostFilter))
			{
				SkillParameterCostFilter skillParameterCostFilter = skill.ApplyCardFilterList.First((ISkillCardFilter f) => f is SkillParameterCostFilter) as SkillParameterCostFilter;
				if (skillParameterCostFilter.GetParameterText().Contains(COST_MAX))
				{
					return Data.SystemText.Get("BattleLog_0165");
				}
				if (skillParameterCostFilter.GetParameterOptionText() == ">=")
				{
					return Data.SystemText.Get("BattleLog_0182", skillParameterCostFilter.GetParameterText());
				}
				if (skillParameterCostFilter.GetParameterOptionText() == "<=")
				{
					return Data.SystemText.Get("BattleLog_0230", skillParameterCostFilter.GetParameterText());
				}
			}
			if (skill.ApplyCardFilterList.Any((ISkillCardFilter f) => f is SkillParameterBaseCostFilter))
			{
				SkillParameterBaseCostFilter skillParameterBaseCostFilter = skill.ApplyCardFilterList.FirstOrDefault((ISkillCardFilter f) => f is SkillParameterBaseCostFilter) as SkillParameterBaseCostFilter;
				if (skillParameterBaseCostFilter.GetParameterOptionText() == "<=")
				{
					return Data.SystemText.Get("BattleLog_0164", skillParameterBaseCostFilter.GetParameterText());
				}
			}
		}
		else if (skill.ConditionFilterCollection.VariableCompareFilter.Count > 0)
		{
			string text = skill.ConditionFilterCollection.VariableCompareFilter.First().Lhs.Trim('{', '}');
			VariableSkillFilterCollection variableSkillFilterCollection = new VariableSkillFilterCollection();
			SkillFilterCreator.SetupVariable(variableSkillFilterCollection, text, skill.SkillPrm.ownerCard, skill);
			if (variableSkillFilterCollection.CardFilterList.Any((ISkillCardFilter f) => f is SkillParameterBaseCostFilter))
			{
				SkillParameterBaseCostFilter skillParameterBaseCostFilter2 = variableSkillFilterCollection.CardFilterList.First((ISkillCardFilter f) => f is SkillParameterBaseCostFilter) as SkillParameterBaseCostFilter;
				if (skillParameterBaseCostFilter2.GetParameterOptionText() == "<=")
				{
					return Data.SystemText.Get("BattleLog_0164", skillParameterBaseCostFilter2.GetParameterText());
				}
				if (skillParameterBaseCostFilter2.GetParameterOptionText() == "=")
				{
					return Data.SystemText.Get("BattleLog_0194", skillParameterBaseCostFilter2.GetParameterText());
				}
			}
		}
		return "";
	}

	public static string _GetCardTypeByFilterList(List<ISkillCardFilter> filters)
	{
		if (filters.Any((ISkillCardFilter f) => f is SkillUnitFilter))
		{
			return Data.SystemText.Get("BattleLog_0172");
		}
		if (filters.Any((ISkillCardFilter f) => f is SkillSpellFilter))
		{
			return Data.SystemText.Get("BattleLog_0173");
		}
		if (filters.Any((ISkillCardFilter f) => f is SkillChantFieldFilter))
		{
			return Data.SystemText.Get("BattleLog_0176");
		}
		if (filters.Any((ISkillCardFilter f) => f is SkillFieldFilter))
		{
			return Data.SystemText.Get("BattleLog_0175");
		}
		if (filters.Any((ISkillCardFilter f) => f is SkillSpellAndFieldFilter))
		{
			return Data.SystemText.Get("BattleLog_0183");
		}
		return string.Empty;
	}

	public static string _GetSpecificCardType(SkillBase skill, bool isTarget)
	{
		if (isTarget)
		{
			string text = _GetCardTypeByFilterList(skill.ApplyCardFilterList);
			if (text != string.Empty)
			{
				return text;
			}
		}
		else
		{
			if (skill.ConditionCardFilterList.Count > 0)
			{
				string text = _GetCardTypeByFilterList(skill.ConditionCardFilterList);
				if (text != string.Empty)
				{
					return text;
				}
			}
			if (skill.ConditionFilterCollection.VariableCompareFilter.Count > 0)
			{
				string text2 = skill.ConditionFilterCollection.VariableCompareFilter.First().Lhs.Trim('{', '}');
				VariableSkillFilterCollection variableSkillFilterCollection = new VariableSkillFilterCollection();
				SkillFilterCreator.SetupVariable(variableSkillFilterCollection, text2, skill.SkillPrm.ownerCard, skill);
				if (variableSkillFilterCollection.CardFilterList.Count > 0)
				{
					string text = _GetCardTypeByFilterList(variableSkillFilterCollection.CardFilterList);
					if (text != string.Empty)
					{
						return text;
					}
				}
			}
		}
		return Data.SystemText.Get("BattleLog_0174");
	}

	public static string _GetSpecificCardTribeClan(SkillBase skill, bool isTarget)
	{
		if (isTarget)
		{
			if (skill.ApplyCardFilterList.Any((ISkillCardFilter f) => f is SkillClanFilter))
			{
				SkillClanFilter skillClanFilter = skill.ApplyCardFilterList.First((ISkillCardFilter f) => f is SkillClanFilter) as SkillClanFilter;
				string clanNameByKey = GameMgr.GetIns().GetDataMgr().GetClanNameByKey((int)skillClanFilter._clan);
				string text = ((skillClanFilter.OptionText == SkillFilterCreator.NOTEQUAL) ? Data.SystemText.Get("BattleLog_0238") : "");
				return Data.SystemText.Get("BattleLog_0234", clanNameByKey, text);
			}
			if (skill.ApplyCardFilterList.Any((ISkillCardFilter f) => f is SkillTribeFilter))
			{
				return DataMgr.GetTribeNameByKey((int)(skill.ApplyCardFilterList.First((ISkillCardFilter f) => f is SkillTribeFilter) as SkillTribeFilter)._type);
			}
		}
		else
		{
			if (skill.ConditionCardFilterList.Any((ISkillCardFilter f) => f is SkillClanFilter))
			{
				SkillClanFilter skillClanFilter2 = skill.ConditionCardFilterList.First((ISkillCardFilter f) => f is SkillClanFilter) as SkillClanFilter;
				return GameMgr.GetIns().GetDataMgr().GetClanNameByKey((int)skillClanFilter2._clan);
			}
			if (skill.ConditionCardFilterList.Any((ISkillCardFilter f) => f is SkillTribeFilter))
			{
				return DataMgr.GetTribeNameByKey((int)(skill.ConditionCardFilterList.First((ISkillCardFilter f) => f is SkillTribeFilter) as SkillTribeFilter)._type);
			}
			if (skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => f.Lhs.Contains(SkillFilterCreator.ContentKeyword.tribe.ToString())))
			{
				string text2 = skill.ConditionFilterCollection.VariableCompareFilter.FirstOrDefault((SkillVariableComareFilter f) => f.Lhs.Contains(SkillFilterCreator.ContentKeyword.tribe.ToString())).Lhs.Trim('{', '}');
				VariableSkillFilterCollection variableSkillFilterCollection = new VariableSkillFilterCollection();
				SkillFilterCreator.SetupVariable(variableSkillFilterCollection, text2, skill.SkillPrm.ownerCard, skill);
				ISkillCardFilter skillCardFilter = variableSkillFilterCollection.CardFilterList.FirstOrDefault((ISkillCardFilter f) => f is SkillTribeFilter);
				if (skillCardFilter != null)
				{
					return DataMgr.GetTribeNameByKey((int)(skillCardFilter as SkillTribeFilter)._type);
				}
			}
		}
		return "";
	}

	public static string _GetSpecificCardException(SkillBase skill)
	{
		if (skill.ApplyCardFilterList.Any((ISkillCardFilter f) => f is SkillParameterIdFilter))
		{
			SkillParameterIdFilter skillParameterIdFilter = skill.ApplyCardFilterList.First((ISkillCardFilter f) => f is SkillParameterIdFilter) as SkillParameterIdFilter;
			if (skillParameterIdFilter.GetOptionText() == "!=")
			{
				CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(int.Parse(skillParameterIdFilter.GetFilterId().First()));
				return Data.SystemText.Get("BattleLog_0166", cardParameterFromId.CardName);
			}
		}
		return "";
	}

	public static string _GetSpecificCardTargetCount(SkillBase skill, bool isTarget)
	{
		if (!isTarget)
		{
			return "";
		}
		if (skill.ApplySelectFilter is SkillRandomSelectFilter)
		{
			SkillRandomSelectFilter skillRandomSelectFilter = skill.ApplySelectFilter as SkillRandomSelectFilter;
			if (!skillRandomSelectFilter.IsContainVariableValue())
			{
				int num = int.Parse(skillRandomSelectFilter.Context);
				if (num >= 1)
				{
					return Data.SystemText.Get("BattleLog_0163", num.ToString());
				}
			}
			return "";
		}
		if (skill.ApplySelectFilter is SkillUserSelectFilter)
		{
			SkillUserSelectFilter skillUserSelectFilter = skill.ApplySelectFilter as SkillUserSelectFilter;
			return Data.SystemText.Get("BattleLog_0163", skillUserSelectFilter.CalcCount(skill.OptionValue).ToString());
		}
		if (skill.ApplyingTargetFilter is SkillTargetLastTargetFilter)
		{
			int num2 = skill.SkillPrm.selfBattlePlayer.SkillInfoLastTargets.Count();
			return Data.SystemText.Get("BattleLog_0163", num2.ToString());
		}
		if (skill.ApplyingTargetFilter is SkillTargetSkillDrewCardFilter)
		{
			int num3 = skill.GetDrewCardInHand().Count();
			return Data.SystemText.Get("BattleLog_0163", num3.ToString());
		}
		if (skill.ConditionTargetFilter is SkillTargetPlayedCardFilter)
		{
			return "";
		}
		return Data.SystemText.Get("BattleLog_0171");
	}

	public static string _GetSpecificCard(SkillBase skill, bool isBuffText, bool isTarget)
	{
		string text = _GetSpecificCardCostInformation(skill, isTarget);
		string text2 = _GetSpecificCardTribeClan(skill, isTarget);
		string text3 = _GetSpecificCardType(skill, isTarget);
		if (skill.ApplyCardFilterList.Any((ISkillCardFilter f) => f is SkillParameterIdFilter))
		{
			SkillParameterIdFilter skillParameterIdFilter = skill.ApplyCardFilterList.First((ISkillCardFilter f) => f is SkillParameterIdFilter) as SkillParameterIdFilter;
			if (skillParameterIdFilter.GetOptionText() == SkillFilterCreator.EQUAL)
			{
				CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(int.Parse(skillParameterIdFilter.GetFilterId().First()));
				text2 = "";
				text3 = cardParameterFromId.CardName;
			}
		}
		string text4 = _GetSpecificCardException(skill);
		string text5 = _GetSpecificCardTargetCount(skill, isTarget);
		if (isBuffText)
		{
			string text6 = string.Empty;
			if ((isTarget && skill.ApplyCardFilterList.Any((ISkillCardFilter f) => f is SkillTribeFilter)) || (!isTarget && (skill.ConditionCardFilterList.Any((ISkillCardFilter f) => f is SkillTribeFilter) || skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => f.Lhs.Contains(SkillFilterCreator.ContentKeyword.tribe.ToString())))))
			{
				text6 = Data.SystemText.Get("BattleLog_0252");
			}
			return Data.SystemText.Get("BattleLog_0156", text, text2, text3, text4, text5, text6);
		}
		string text7 = Data.SystemText.Get("BattleLog_0225");
		if (text == string.Empty && text2 == string.Empty && text3 == Data.SystemText.Get("BattleLog_0174") && text4 == string.Empty)
		{
			text7 = string.Empty;
		}
		return Data.SystemText.Get("BattleLog_0161", text5, text7);
	}

	public static string _GetSkillTarget(SkillBase skill, bool isBuffText)
	{
		if (skill.ApplyFilterCollection.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.BattlePlayerFilter is OpponentBattlePlayerFilter && f.CardFilterList.Any((ISkillCardFilter c) => c is SkillUnitFilter)) && skill.ApplyFilterCollection.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.BattlePlayerFilter is SelfBattlePlayerFilter && f.CardFilterList.Any((ISkillCardFilter c) => c is SkillClassFilter)))
		{
			return Data.SystemText.Get("BattleLog_0147");
		}
		if (skill.ApplyingTargetFilter is SkillTargetBeAttackedFilter)
		{
			return Data.SystemText.Get("BattleLog_0063");
		}
		if (skill.ApplyingTargetFilter is SkillTargetAttackerFilter)
		{
			return Data.SystemText.Get("BattleLog_0101");
		}
		if (skill.ApplyingTargetFilter is SkillTargetFightTargetFilter)
		{
			return Data.SystemText.Get("BattleLog_0103");
		}
		if (skill.ApplyingTargetFilter is SkillTargetSelfFilter)
		{
			return Data.SystemText.Get("BattleLog_0064");
		}
		if (skill.ApplyingTargetFilter is SkillTargetSkillDrewCardFilter)
		{
			if (isBuffText)
			{
				return Data.SystemText.Get("BattleLog_0118");
			}
			return Data.SystemText.Get("BattleLog_0065");
		}
		if (skill.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter || skill.ApplyingTargetFilter is SkillTargetHandFilter)
		{
			return Data.SystemText.Get("BattleLog_0082", _GetSpecificCard(skill, isBuffText, isTarget: true));
		}
		if (skill.ApplyingTargetFilter is SkillTargetDeckFilter)
		{
			return Data.SystemText.Get("BattleLog_0083", _GetSpecificCard(skill, isBuffText, isTarget: true));
		}
		if (skill.ApplyingTargetFilter is SkillTargetSummonedCardFilter)
		{
			return Data.SystemText.Get("BattleLog_0093");
		}
		if (skill.ApplyingTargetFilter is SkillTargetPlayedCardFilter)
		{
			return Data.SystemText.Get("BattleLog_0118");
		}
		if (skill.ApplyingTargetFilter is SkillTargetInPlayFilter)
		{
			int num = 0;
			for (int count = skill.ApplyCardFilterList.Count; num < count; num++)
			{
				if (skill.ApplyCardFilterList[num] is SkillClassFilter)
				{
					if (skill.ApplyBattlePlayerFilter is SelfBattlePlayerFilter)
					{
						return Data.SystemText.Get("BattleLog_0115");
					}
					if (skill.ApplyBattlePlayerFilter is OpponentBattlePlayerFilter)
					{
						return Data.SystemText.Get("BattleLog_0004");
					}
				}
				else if (skill.ApplyCardFilterList[num] is SkillUnitAndClassFilter)
				{
					if (skill.ApplySelectFilter != null)
					{
						if (!(skill.ApplySelectFilter is SkillSelectAllFilter) && !(skill.ApplySelectFilter is SkillSelectNullFilter))
						{
							return Data.SystemText.Get("BattleLog_0120");
						}
						if (skill.ApplyBattlePlayerFilter is OpponentBattlePlayerFilter)
						{
							return Data.SystemText.Get("BattleLog_0112");
						}
						if (skill.ApplyBattlePlayerFilter is SelfBattlePlayerFilter)
						{
							return Data.SystemText.Get("BattleLog_0190");
						}
					}
					else
					{
						Debug.LogError("ApplySelectFilter is not allowed null!");
					}
				}
				else
				{
					if (!(skill.ApplyCardFilterList[num] is SkillUnitFilter))
					{
						continue;
					}
					if (skill.ApplySelectFilter != null)
					{
						string text = _ConvertSkillConditionCharacter((skill.ApplyBattlePlayerFilter is OpponentBattlePlayerFilter) ? SkillFilterCreator.ContentKeyword.op.ToStringCustom() : SkillFilterCreator.ContentKeyword.me.ToStringCustom());
						if (!(skill.ApplySelectFilter is SkillSelectAllFilter) && !(skill.ApplySelectFilter is SkillSelectNullFilter))
						{
							string text2 = _GetSkillTargetCount(skill);
							int result = -1;
							int.TryParse(text2, out result);
							return Data.SystemText.Get("BattleLog_0133", text2, text);
						}
						return Data.SystemText.Get("BattleLog_0124", text);
					}
					Debug.LogError("ApplySelectFilter is not allowed null!");
				}
			}
			return "";
		}
		if (skill.ApplyingTargetFilter is SkillTargetInPlayOtherSelfFilter)
		{
			if (skill.ApplySelectFilter is SkillRandomSelectFilter)
			{
				return Data.SystemText.Get("BattleLog_0146");
			}
			return Data.SystemText.Get("BattleLog_0121");
		}
		if (skill.ApplyingTargetFilter is SkillTargetLastTargetFilter)
		{
			return Data.SystemText.Get("BattleLog_0118");
		}
		if (skill.ApplyingTargetFilter is SkillTargetInplaySelfAndClassFilter)
		{
			return Data.SystemText.Get("BattleLog_0214");
		}
		if (!(skill.ApplyingTargetFilter is SkillTargetTokenDrawCardFilter))
		{
			_ = skill.ApplyingTargetFilter is SkillTargetReturnCardFilter;
		}
		return "";
	}

	public static string _GetSkillPeriod(SkillBase skill, bool isNow)
	{
		if (skill.PreprocessList.FirstOrDefault((SkillPreprocessBase pre) => pre is SkillPreprocessInPlayPeriodOfTime) is SkillPreprocessInPlayPeriodOfTime)
		{
			if (isNow)
			{
				return Data.SystemText.Get("BattleLog_0091");
			}
			return Data.SystemText.Get("BattleLog_0159");
		}
		if (skill.ConditionCheckerList.Any((ISkillConditionChecker a) => a is SkillPreprocessTurnStartStop && (a as SkillPreprocessTurnStartStop).Target == "op"))
		{
			return Data.SystemText.Get("BattleLog_0189");
		}
		if (skill.ConditionCheckerList.Any((ISkillConditionChecker a) => a is SkillConditionTurn && (a as SkillConditionTurn).judgeFlg))
		{
			return Data.SystemText.Get("BattleLog_0126");
		}
		if (skill.ConditionCheckerList.Any((ISkillConditionChecker a) => a is SkillPreprocessTurnEndStop))
		{
			return Data.SystemText.Get("BattleLog_0215");
		}
		return "";
	}

	protected static string _GetSkillTiming(SkillBase skill, bool isBuffText)
	{
		if (skill.IsWhenPlaySkill)
		{
			return "";
		}
		if (skill.IsWhenDestroySkill)
		{
			return Data.SystemText.Get("BattleLog_0066");
		}
		if (skill.IsBeforAttackSkill || skill.IsBeforeAttackSelfAndOtherSkill)
		{
			if (skill.ConditionCheckerList.Any((ISkillConditionChecker f) => f is SkillConditionAttackerIsOther))
			{
				return Data.SystemText.Get("BattleLog_0192");
			}
			return Data.SystemText.Get("BattleLog_0067");
		}
		if (skill.OnAfterAttackStart != 0)
		{
			return Data.SystemText.Get("BattleLog_0254");
		}
		if (skill.IsWhenFightSkill)
		{
			return Data.SystemText.Get("BattleLog_0102");
		}
		if (skill.OnSelfTurnStartStart != 0)
		{
			return Data.SystemText.Get("BattleLog_0068");
		}
		if (skill.OnSelfTurnEndStart != 0)
		{
			return Data.SystemText.Get("BattleLog_0069");
		}
		if (skill.OnWhenSummonOtherStart != 0)
		{
			if (skill.ApplyBattlePlayerFilter is SelfBattlePlayerFilter)
			{
				return Data.SystemText.Get("BattleLog_0092", _GetSpecificCard(skill, isBuffText, isTarget: false));
			}
			return "";
		}
		if (skill.OnWhenPlayOtherStart != 0)
		{
			if (skill.ConditionTargetFilter is SkillTargetPlayedCardFilter && skill.ConditionCardFilterList.Any((ISkillCardFilter c) => c is SkillSpellFilter))
			{
				return Data.SystemText.Get("BattleLog_0108");
			}
			return Data.SystemText.Get("BattleLog_0117", _GetSpecificCard(skill, isBuffText, isTarget: false));
		}
		if (skill.OnWhenDamageStart != 0)
		{
			return Data.SystemText.Get("BattleLog_0127");
		}
		if (skill.OnWhenDestroyOtherStart != 0)
		{
			return Data.SystemText.Get("BattleLog_0257", _GetSpecificCard(skill, isBuffText, isTarget: false));
		}
		if (skill.OnWhenDamageStart != 0 && skill.ConditionCheckerList.Any((ISkillConditionChecker c) => c is SkillConditionTurn))
		{
			return "";
		}
		if (skill.OnWhenDrawOtherStart != 0)
		{
			return "";
		}
		if (skill.OnWhenPpHealStart != 0)
		{
			return "";
		}
		if (skill.OnOpponentTurnEndStart != 0)
		{
			return "";
		}
		if (skill.OnWhenReturnOtherStart != 0)
		{
			return Data.SystemText.Get("BattleLog_0264");
		}
		return "";
	}

	protected static string _GetSkillTargetCount(SkillBase skill)
	{
		if (skill.ApplySelectFilter != null)
		{
			return skill.ApplySelectFilter.CalcCount(skill.OptionValue).ToString();
		}
		return "";
	}

	protected static string _GetSkillPreProcessText(SkillBase skill)
	{
		SkillPreprocessBase skillPreprocessBase = skill.PreprocessList.FirstOrDefault((SkillPreprocessBase s) => s is SkillPreprocessUsePp);
		if (skillPreprocessBase != null)
		{
			int consumeValue = (skillPreprocessBase as SkillPreprocessUsePp).ConsumeValue;
			return Data.SystemText.Get("BattleLog_0236", consumeValue.ToString());
		}
		return string.Empty;
	}

	protected static string _GetSkillOptionSetCost(SkillBase skill)
	{
		int num = skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set, int.MinValue);
		int num2 = skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add, int.MinValue);
		if (num != int.MinValue)
		{
			return num.ToString();
		}
		if (num2 != int.MinValue)
		{
			return num2.ToString();
		}
		return "";
	}

	protected static string _GetSkillDetailCondition(SkillBase skill)
	{
		if (skill.ConditionCheckerList.Any((ISkillConditionChecker f) => f is SkillConditionResonance) && (skill.ConditionCheckerList.First((ISkillConditionChecker f) => f is SkillConditionResonance) as SkillConditionResonance).judgeFlg)
		{
			return Data.SystemText.Get("BattleLog_0169");
		}
		List<SkillVariableComareFilter> variableCompareFilter = skill.ConditionFilterCollection.VariableCompareFilter;
		if (variableCompareFilter.Count > 0)
		{
			SkillVariableComareFilter skillVariableComareFilter = variableCompareFilter.First();
			string compare = skillVariableComareFilter.Compare;
			string text = skillVariableComareFilter.Lhs.Trim('{', '}');
			VariableSkillFilterCollection variableSkillFilterCollection = new VariableSkillFilterCollection();
			SkillFilterCreator.SetupVariable(variableSkillFilterCollection, text, skill.SkillPrm.ownerCard, skill);
			if (text.Contains("me.deck.unique_base_card_id_card"))
			{
				if (compare == "=")
				{
					return Data.SystemText.Get("BattleLog_0260");
				}
				return Data.SystemText.Get("BattleLog_0259");
			}
			if (text.Contains("op.inplay.unit.count"))
			{
				string rhs = skillVariableComareFilter.Rhs;
				if (compare == ">" && rhs == "0")
				{
					return Data.SystemText.Get("BattleLog_0158");
				}
				if (compare == "=" && rhs == "0")
				{
					return Data.SystemText.Get("BattleLog_0181");
				}
			}
			else if (variableSkillFilterCollection.CardCountFilter != null && variableSkillFilterCollection.BattlePlayerFilter is SelfBattlePlayerFilter)
			{
				string rhs2 = skillVariableComareFilter.Rhs;
				if (variableSkillFilterCollection.CardFilterList.Any((ISkillCardFilter f) => f is SkillParameterIdFilter))
				{
					SkillParameterIdFilter skillParameterIdFilter = variableSkillFilterCollection.CardFilterList.FirstOrDefault((ISkillCardFilter f) => f is SkillParameterIdFilter) as SkillParameterIdFilter;
					string cardName = CardMaster.GetInstanceForBattle().GetCardParameterFromId(int.Parse(skillParameterIdFilter.GetFilterId().First())).CardName;
					if (variableCompareFilter.Any((SkillVariableComareFilter f) => f.Lhs.Contains("me.inplay") && f.Rhs == "0") && variableCompareFilter.Any((SkillVariableComareFilter f) => f.Lhs.Contains("me.hand") && f.Rhs == "0"))
					{
						return Data.SystemText.Get("BattleLog_0193", cardName, Data.SystemText.Get("BattleLog_0177"));
					}
					if (compare == "=" && rhs2 == "0")
					{
						string text2 = Data.SystemText.Get("BattleLog_0205");
						if (variableSkillFilterCollection.TargetFilter is SkillTargetHandFilter)
						{
							text2 = Data.SystemText.Get("BattleLog_0206");
						}
						return Data.SystemText.Get("BattleLog_0193", cardName, text2);
					}
				}
				if (compare == ">" && rhs2 == "0")
				{
					if (variableSkillFilterCollection.CardFilterList.Any((ISkillCardFilter f) => f is SkillFieldFilter))
					{
						return Data.SystemText.Get("BattleLog_0149");
					}
					if (variableSkillFilterCollection.CardFilterList.Any((ISkillCardFilter f) => f is SkillUnitFilter))
					{
						return Data.SystemText.Get("BattleLog_0148");
					}
				}
			}
			else if (variableSkillFilterCollection.ParameterSelectFilter is SkillParameterTurnDamageValueFilter)
			{
				int num = int.Parse(skillVariableComareFilter.Rhs.ToString());
				if (compare == ">=")
				{
					return Data.SystemText.Get("BattleLog_0197", num.ToString());
				}
				if (compare == "<")
				{
					return Data.SystemText.Get("BattleLog_0198", (num - 1).ToString());
				}
			}
			if (text.Contains("me.hand.count"))
			{
				string rhs3 = skillVariableComareFilter.Rhs;
				switch (compare)
				{
				case "<=":
					return Data.SystemText.Get("BattleLog_0187", rhs3);
				case "<":
				{
					int num3 = int.Parse(rhs3) - 1;
					return Data.SystemText.Get("BattleLog_0187", num3.ToString());
				}
				case ">=":
					return Data.SystemText.Get("BattleLog_0188", rhs3);
				case ">":
				{
					int num2 = int.Parse(rhs3) + 1;
					return Data.SystemText.Get("BattleLog_0188", num2.ToString());
				}
				}
			}
			if (text.Contains("me.inplay.class.ep"))
			{
				return Data.SystemText.Get("BattleLog_0177");
			}
			if (variableSkillFilterCollection.BattlePlayerFilter != null && variableSkillFilterCollection.TargetFilter is SkillTargetInPlayFilter && variableSkillFilterCollection.CardFilterList.Count > 0 && variableSkillFilterCollection.CardCountFilter != null)
			{
				string[] array = text.Split('.');
				string text3 = _ConvertSkillConditionCharacter(array[0]);
				string text4 = _ConvertSkillConditionTarget(array[1]);
				string text5 = _ConvertSkillConditionCardType(array[2]);
				string rhs4 = skillVariableComareFilter.Rhs;
				switch (compare)
				{
				case "=":
					return Data.SystemText.Get("BattleLog_0200", text3, text4, text5, rhs4);
				case ">=":
					return Data.SystemText.Get("BattleLog_0209", text3, text4, text5, rhs4);
				case "<=":
					return Data.SystemText.Get("BattleLog_0210", text3, text4, text5, rhs4);
				}
			}
			if (text.Contains("me.inplay.class.pp"))
			{
				string rhs5 = skillVariableComareFilter.Rhs;
				if (compare != null && compare == ">=")
				{
					return Data.SystemText.Get("BattleLog_0235", rhs5);
				}
			}
			if (text.Contains(SkillFilterCreator.ContentKeyword.turn_play_cards.ToString()))
			{
				return Data.SystemText.Get("BattleLog_0191", skillVariableComareFilter.Rhs, _GetSpecificCard(skill, isBuffText: true, isTarget: false));
			}
		}
		if (skill.ConditionCheckerList.Any((ISkillConditionChecker f) => f is SkillConditionTurn) && (skill.ConditionCheckerList.First((ISkillConditionChecker f) => f is SkillConditionTurn) as SkillConditionTurn).judgeFlg)
		{
			return Data.SystemText.Get("BattleLog_0126");
		}
		if (skill.ConditionCheckerList.Any((ISkillConditionChecker s) => s is SkillConditionPlayCount))
		{
			SkillConditionPlayCount skillConditionPlayCount = (SkillConditionPlayCount)skill.ConditionCheckerList.First((ISkillConditionChecker s) => s is SkillConditionPlayCount);
			return Data.SystemText.Get("BattleLog_0191", skillConditionPlayCount.GetCount().ToString(), _GetSpecificCard(skill, isBuffText: true, isTarget: false));
		}
		if (skill.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessTimesPerTurn && (p as SkillPreprocessTimesPerTurn).GetLimitCount() == 1))
		{
			return Data.SystemText.Get("BattleLog_0196");
		}
		return "";
	}

	protected static string _CombineSkillCondition(SkillBase skill, string condition)
	{
		if (skill.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessDestroyTribe && (p as SkillPreprocessDestroyTribe).IsWhiteRitual))
		{
			return Data.SystemText.Get("BattleLog_0178", condition);
		}
		SkillVariableComareFilter skillVariableComareFilter = skill.ConditionFilterCollection.VariableCompareFilter.FirstOrDefault((SkillVariableComareFilter f) => f.Lhs == "{me.inplay.class.turn}");
		if (skillVariableComareFilter != null)
		{
			int num = int.Parse(skillVariableComareFilter.Rhs);
			return Data.SystemText.Get("BattleLog_0150", num.ToString(), condition);
		}
		return condition;
	}

	protected static string _GetSkillCondition(SkillBase skill, bool isBuffText)
	{
		if (skill.ConditionCheckerList.Any((ISkillConditionChecker a) => a is SkillConditionTurn && (a as SkillConditionTurn).judgeFlg))
		{
			return "";
		}
		if (skill.ConditionCardFilterList.Any((ISkillCardFilter s) => s is SkillAllCardFilter || s is SkillUnitFilter || s is SkillClassFilter || s is SkillFieldFilter || s is SkillChantFieldFilter || s is SkillNotChantFieldFilter || s is SkillSpellFilter || s is SkillUnitAndClassFilter || s is SkillUnitAndAllFieldFilter || s is SkillSpellAndFieldFilter) && !skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => !f.Lhs.Contains("played_card") && !f.Lhs.Contains("me.inplay_self.count")) && !skill.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessTimesPerTurn && (p as SkillPreprocessTimesPerTurn).GetLimitCount() == 1) && !skill.ConditionCheckerList.Any((ISkillConditionChecker f) => f is SkillConditionResonance || f is SkillConditionHalfLife || f is SkillConditionTurn || f is SkillPreprocessDestroyTribe || f is SkillConditionPlayCount))
		{
			return "";
		}
		if (isBuffText)
		{
			return _CombineSkillCondition(skill, _GetSkillDetailCondition(skill));
		}
		return Data.SystemText.Get("BattleLog_0113");
	}

	public static string _ConvertSkillConditionCharacter(string character)
	{
		if (!SkillFilterCreator.PLAYER_FILTER_NAMES.Contains(character))
		{
			return "";
		}
		return SkillFilterCreator.Str2ContentKeyword(character) switch
		{
			SkillFilterCreator.ContentKeyword.me => Data.SystemText.Get("BattleLog_0218"), 
			SkillFilterCreator.ContentKeyword.op => Data.SystemText.Get("BattleLog_0219"), 
			SkillFilterCreator.ContentKeyword.both => Data.SystemText.Get("BattleLog_0208"), 
			_ => "", 
		};
	}

	protected static string _ConvertSkillConditionTarget(string target)
	{
		if (!SkillFilterCreator.PLAYER_TARGET_FILTER_NAMES.Contains(target))
		{
			return "";
		}
		return SkillFilterCreator.Str2ContentKeyword(target) switch
		{
			SkillFilterCreator.ContentKeyword.inplay => Data.SystemText.Get("BattleLog_0205"), 
			SkillFilterCreator.ContentKeyword.hand => Data.SystemText.Get("BattleLog_0206"), 
			SkillFilterCreator.ContentKeyword.deck => Data.SystemText.Get("BattleLog_0207"), 
			_ => "", 
		};
	}

	protected static string _ConvertSkillConditionCardType(string cardType)
	{
		if (!SkillFilterCreator.CARD_TYPE_FILTER_NAMES.Contains(cardType))
		{
			return "";
		}
		return SkillFilterCreator.Str2ContentKeyword(cardType) switch
		{
			SkillFilterCreator.ContentKeyword.unit => Data.SystemText.Get("BattleLog_0172"), 
			SkillFilterCreator.ContentKeyword.spell => Data.SystemText.Get("BattleLog_0173"), 
			SkillFilterCreator.ContentKeyword.field => Data.SystemText.Get("BattleLog_0175"), 
			SkillFilterCreator.ContentKeyword.chant_field => Data.SystemText.Get("BattleLog_0176"), 
			_ => "", 
		};
	}

	protected static string _GetSkillOptionDamage(SkillBase skill)
	{
		return Mathf.Max(0, skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.damage, 0)).ToString();
	}

	protected static string _GetSkillOptionAddDamage(SkillBase skill)
	{
		int b = skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_damage, 0);
		return Mathf.Max(0, b).ToString();
	}

	protected static string _GetSkillOptionDamageCut(SkillBase skill)
	{
		int b = skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.cut_amount, 0);
		return Mathf.Max(0, b).ToString();
	}

	protected static int _GetSkillOptionDamageClipping(SkillBase skill)
	{
		return skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.cut_clipping, int.MaxValue);
	}

	protected static string _GetSkillOptionHealing(SkillBase skill)
	{
		int b = skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.healing, 0);
		return Mathf.Max(0, b).ToString();
	}

	protected static string _GetSkillOptionAddPp(SkillBase skill)
	{
		int b = skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_pp, 0);
		return Mathf.Max(0, b).ToString();
	}

	protected static string _GetSkillOptionAddOffense(SkillBase skill)
	{
		return skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_offense, 0).ToString();
	}

	protected static string _GetSkillOptionAddLife(SkillBase skill)
	{
		return skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_life, 0).ToString();
	}

	protected static string _GetSkillOptionMultiplyOffense(SkillBase skill)
	{
		return skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.multiply_offense, 1).ToString();
	}

	protected static string _GetSkillOptionMultiplyLife(SkillBase skill)
	{
		return skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.multiply_life, 1).ToString();
	}

	protected static int _GetSkillOptionLifeLowerLimit(SkillBase skill)
	{
		return skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.life_lower_limit, 0);
	}

	protected static string _GetSkillCallCount(SkillBase skill)
	{
		int callCount = skill.CallCount;
		if (callCount >= 2)
		{
			return Data.SystemText.Get("BattleLog_0114", callCount.ToString());
		}
		return "";
	}

	protected static string _GetSkillOptionAddEp(SkillBase skill)
	{
		int b = skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_ep, 0);
		return Mathf.Max(0, b).ToString();
	}
}
