using System.Linq;
using Wizard.Battle.View.Vfx;

public class Skill_bp_modifier : SkillBase
{
	public static readonly int BP_NONE = -1;

	public const string BP_MINUS_EFFECT = "cmn_ui_hbp_1";

	public const string BP_PLUS_EFFECT = "cmn_ui_hbp_2";

	public Skill_bp_modifier(SkillParameter skillPrm, string option)
		: base(skillPrm, option)
	{
	}

	public override VfxWithLoading Start(CallParameter parameter)
	{
		int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_bp, 0);
		int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_bp, BP_NONE);
		_ = IsBattleLog;
		ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
		for (int i = 0; i < parameter.targetCards.Count(); i++)
		{
			BattlePlayerBase targetClass = parameter.targetCards.ElementAt(i).SelfBattlePlayer;
			if (num != 0)
			{
				parallelVfxPlayer.Register(new LoadAndPlayEffectVfx("cmn_ui_hbp_2", null, () => targetClass.BattleView.GetBPLabelPosition(), 0f, BattleManagerBase.GetIns().Battle3DContainer.layer));
				parallelVfxPlayer.Register(AddBp(targetClass, num));
				if (targetClass is BattlePlayer)
				{
					parallelVfxPlayer.Register(InstantVfx.Create(delegate
					{
						GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_HBP_UP);
					}));
				}
			}
			else if (num2 > BP_NONE)
			{
				parallelVfxPlayer.Register(new LoadAndPlayEffectVfx("cmn_ui_hbp_1", null, () => targetClass.BattleView.GetBPLabelPosition(), 0f, BattleManagerBase.GetIns().Battle3DContainer.layer));
				parallelVfxPlayer.Register(AddBp(targetClass, -num2));
			}
		}
		VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create();
		vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards));
		vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer);
		return vfxWithLoadingSequential;
	}

	protected virtual VfxBase AddBp(BattlePlayerBase target, int value)
	{
		return target.AddBp(value);
	}
}
