コード例 #1
0
ファイル: Character.cs プロジェクト: tvbirch/pen_and_paper
        public TimeChangeRemoval ChangeTime(ChangeTimeDto changeTimeDto)
        {
            TimeChangeRemoval actionsToRemove = Round.ChangeTime(new ChangeCharacterTimeDto
            {
                TimeUnit  = changeTimeDto.TimeLimitUnit,
                Bonus     = _bonusDto,
                TargetHit = changeTimeDto.HitTarget
            });

            return(actionsToRemove);
        }
コード例 #2
0
        private void ChangeTimeCleanDb(TimeChangeRemoval actionsToRemove)
        {
            if (actionsToRemove == null)
            {
                return;
            }
            if (actionsToRemove.DeaktivatedAbilities != null)
            {
                var rabIds  = actionsToRemove.DeaktivatedAbilities.Select(x => x.ID).ToList();
                var tlupIds =
                    actionsToRemove.DeaktivatedAbilities.Select(x => x.ActiveTime.Select(y => y.ID))
                    .SelectMany(x => x)
                    .ToList();

                foreach (var id in tlupIds)
                {
                    Context.Delete <TimeLimitUnitParsed>(id);
                }
                foreach (var id in rabIds)
                {
                    Context.Delete <RoundActivateAbilities>(id);
                }
            }
            if (actionsToRemove.UsedActions != null)
            {
                var rabIds = actionsToRemove.UsedActions.Select(x => x.ID).ToList();
                foreach (var id in rabIds)
                {
                    Context.Delete <RoundActionTaken>(id);
                }
            }
            if (actionsToRemove.DeaktivatedConditions != null)
            {
                var rabIds = actionsToRemove.DeaktivatedConditions.Select(x => x.ID).ToList();
                foreach (var id in rabIds)
                {
                    Context.Delete <RoundActivateConditions>(id);
                }
            }
            if (actionsToRemove.DamagesToRemove != null)
            {
                foreach (var dmg in actionsToRemove.DamagesToRemove)
                {
                    Context.Delete <DamageTaken>(dmg.ID);
                }
            }

            //TODO: heal skal ikke tage sig af at slette dmg historik. Det skal køres af changetime. PT virker heal fra crystal ikke til fuld health.
        }