예제 #1
0
        /// <summary>
        /// Adds a command to the command sequence, linking the previous command's damage information.
        /// </summary>
        public void AddCommandToChainWithDamage(AbilityCommandInfo slaveCommand)
        {
            if (CommandSequence == 0)
            {
                if (NextCommand == null || slaveCommand.CommandSequence == CommandSequence)
                {
                    NextCommand = slaveCommand;
                    slaveCommand.LastCommand = this;
                    if (DamageInfo != null)
                    {
                        slaveCommand.DamageInfo = DamageInfo.Clone();
                    }
                    else
                    {
                        slaveCommand.DamageInfo = LastCommand.DamageInfo.Clone();
                    }
                }
                else
                {
                    NextCommand.AddCommandToChainWithDamage(slaveCommand);
                }
            }
            else
            {
                if (slaveCommand.CommandSequence < CommandSequence)
                {
                    LastCommand.NextCommand  = slaveCommand;
                    slaveCommand.LastCommand = LastCommand;
                    LastCommand = slaveCommand;
                    slaveCommand.NextCommand = this;

                    if (slaveCommand.LastCommand.DamageInfo != null)
                    {
                        slaveCommand.DamageInfo = slaveCommand.LastCommand.DamageInfo.Clone();
                    }
                }

                else if (NextCommand == null)
                {
                    NextCommand = slaveCommand;
                    slaveCommand.LastCommand = this;

                    if (DamageInfo != null)
                    {
                        slaveCommand.DamageInfo = DamageInfo.Clone();
                    }
                    else
                    {
                        slaveCommand.DamageInfo = LastCommand.DamageInfo.Clone();
                    }
                }
                else
                {
                    NextCommand.AddCommandToChainWithDamage(slaveCommand);
                }
            }
        }
예제 #2
0
        public BuffCommandInfo CloneChain()
        {
            BuffCommandInfo cCommandInfo = (BuffCommandInfo)MemberwiseClone();

            cCommandInfo.CommandName = (string)CommandName.Clone();

            if (DamageInfo != null)
            {
                cCommandInfo.DamageInfo = DamageInfo.Clone();
            }
            if (NextCommand != null)
            {
                cCommandInfo.NextCommand = NextCommand.CloneChain();
            }
            if (cCommandInfo.NextCommand != null)
            {
                cCommandInfo.NextCommand.LastCommand = cCommandInfo;
            }

            return(cCommandInfo);
        }