public void AddCommandToChain(AbilityCommandInfo slaveCommand) { if (CommandSequence == 0) { if (NextCommand == null) { NextCommand = slaveCommand; slaveCommand.LastCommand = this; } else { NextCommand.AddCommandToChain(slaveCommand); } } else { if (slaveCommand.CommandSequence < CommandSequence) { LastCommand.NextCommand = slaveCommand; slaveCommand.LastCommand = LastCommand; LastCommand = slaveCommand; slaveCommand.NextCommand = this; } else if (NextCommand == null) { NextCommand = slaveCommand; slaveCommand.LastCommand = this; } else { NextCommand.AddCommandToChain(slaveCommand); } } }
/// <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); } } }
public void AppendAbilityCommand(AbilityCommandInfo cmd, byte slot) { try { CommandInfo[slot].AddCommandToChain(cmd); } catch (Exception e) { System.Console.WriteLine(e); throw; } }
public AbilityCommandInfo Clone(Unit caster) { AbilityCommandInfo cCommandInfo = (AbilityCommandInfo)MemberwiseClone(); cCommandInfo.CommandName = (string)CommandName.Clone(); cCommandInfo.LastCommand = null; cCommandInfo.NextCommand = null; if (DamageInfo != null) { cCommandInfo.DamageInfo = DamageInfo.Clone(caster); } return(cCommandInfo); }
public void DeleteCommand(byte slot, byte seq) { if (seq == 0) { CommandInfo.RemoveAt(slot); } else { AbilityCommandInfo toDelete = CommandInfo[slot].GetSubcommand(seq); if (toDelete != null) { toDelete.LastCommand.NextCommand = toDelete.NextCommand; if (toDelete.NextCommand != null) { toDelete.NextCommand.LastCommand = toDelete.LastCommand; toDelete.NextCommand = null; } toDelete.LastCommand = null; } } }
public void AppendAbilityCommandWithDamage(AbilityCommandInfo cmd, byte slot) { CommandInfo[slot].AddCommandToChainWithDamage(cmd); }
public void AddAbilityCommand(AbilityCommandInfo cmd) { CommandInfo.Add(cmd); }