コード例 #1
0
        /// <summary>
        ///     is injected in OnHitStatus.Register at the start of the application in order to handle the events at a higher layer of the application
        /// </summary>
        /// <param name="status"></param>
        public static void Register(OnHitStatus status)
        {
            if (status.Affected != null)
            {
                if ((status.CanRedoSavingThrow && status.SavingIsRemadeAtStartOfTurn) ||
                    (status.HasAMaximumDuration && !status.DurationIsCalculatedOnCasterTurn && status.DurationIsBasedOnStartOfTurn) ||
                    status.DotDamageList.Elements.Count != 0)
                {
                    status.Affected.NewTurnStarted += status.Affected_NewTurnStarted;
                }
                if ((status.CanRedoSavingThrow && status.SavingIsRemadeAtStartOfTurn == false) ||
                    (status.HasAMaximumDuration && !status.DurationIsCalculatedOnCasterTurn && !status.DurationIsBasedOnStartOfTurn) ||
                    status.DotDamageList.Elements.Count != 0)
                {
                    status.Affected.TurnEnded += status.Affected_TurnEnded;
                }
            }
            if (status.Caster != null)
            {
                if ((status.HasAMaximumDuration && status.DurationIsCalculatedOnCasterTurn && status.DurationIsBasedOnStartOfTurn) ||
                    status.DotDamageList.Elements.Count != 0)
                {
                    status.Caster.NewTurnStarted += status.Caster_NewTurnStarted;
                }
                if ((status.HasAMaximumDuration && status.DurationIsCalculatedOnCasterTurn && !status.DurationIsBasedOnStartOfTurn) ||
                    status.DotDamageList.Elements.Count != 0)
                {
                    status.Caster.TurnEnded += status.Caster_TurnEnded;
                }

                if (status.EndsOnCasterLossOfConcentration)
                {
                    status.Caster.PropertyChanged += status.Caster_PropertyChanged;
                }
            }
        }
 public static bool OpenEditWindow(this OnHitStatus onHitStatus)
 {
     return(OpenEditWindowGeneric <OnHitStatus, OnHitStatusEditWindow>(onHitStatus));
 }