public void BatchBattleAbility(int ownerId, int abilityId)
        {
            if (_context.TurnType != BattleTurnResultType.ActiveAbility && _context.TurnType != BattleTurnResultType.PassiveAbility)
            {
                throw new Exception($"Invalid write type AbilityResult. TurnType = {_context.TurnType}");
            }

            BatchAbilityInFrame();

            //Logger.Log($"{Logger.GetTabString()}Write apply result ability. type = {_context.TurnType} ownerId = {ownerId} mainTarget = {_mainTarget} abilityId = {abilityId}");
            _battleBatches.Add(new BattleTurnResult
            {
                Type          = _context.TurnType,
                AbilityResult = new AbilityResult
                {
                    Index      = _battleBatches.Count,
                    OwnerId    = ownerId,
                    MainTarget = _mainTarget,
                    AbilityId  = abilityId,
                    Frames     = _frames.ToArray()
                },
            });
            _mainTarget = null;
            Data        = new FrameAbility {
                FamiliarAnimStart = false, Time = 0, ShellDuration = null
            };
            _frames.Clear();
        }
예제 #2
0
 public override void Execute(IImpactDelay data)
 {
     if (_context.BattleMode)
     {
         if (_context.TurnType == BattleTurnResultType.ActiveAbility || _context.TurnType == BattleTurnResultType.PassiveAbility)
         {
             _logic.BatchAbilityInFrame();
             var frameData = new FrameAbility
             {
                 FamiliarAnimStart = false,
                 UnityId           = null,
                 Time = (float)_formula.Calculate(data.Value)
             };
             _logic.Data = frameData;
         }
         else
         {
             _logic.BatchOtherInFrame();
             var frameData = new FrameOther
             {
                 Time = (float)_formula.Calculate(data.Value)
             };
             _logic.Other = frameData;
         }
     }
     else
     {
         var delay = (float)_formula.Calculate(data.Value);
         _logic.BatchCutScene(delay);
     }
 }
        public void BatchAbilityInFrame()
        {
            var type = _context.TurnType;

            Data.ParentIndex = _battleBatches.Count;
            Data.Index       = _frames.Count;
            Data.Actions.Add(_manager.Batch(() => $"Type = {type} {Data}"));
            _frames.Add(Data);
            Data = new FrameAbility {
                FamiliarAnimStart = false, Time = Data.Time, ShellDuration = null
            };
        }
        public override void Execute(IUnitImpactAnimFrame data)
        {
            _logic.BatchAbilityInFrame();
            var frameData = new FrameAbility {
                FamiliarAnimStart = data.FamiliarAnimStart, UnityId = data.UnityObjectId
            };

            if (float.TryParse(data.ShellDuration, out var value))
            {
                frameData.ShellDuration = value;
            }
            frameData.Time = (float)_formula.Calculate(data.TimeFormula);
            _logic.Data    = frameData;
        }