public override void DoAction(IEventArgs args) { FreeData targetPlayer = ((FreeData)args.GetUnit(this.player)); if (bufs != null) { foreach (FreeBuf buf in bufs) { FreeBuf copy = (FreeBuf)SerializeUtil.Clone(buf); if (targetPlayer != null) { copy.SetCreator(targetPlayer.Player); } if (!copy.OnCreate(args)) { continue; } args.TempUse("buf", copy); try { args.FreeContext.Bufs.AddFreeBuf(copy, args); } catch (Exception e) { Sharpen.Runtime.PrintStackTrace(e); } args.Resume("buf"); } } }
public void AddFreeBuf(FreeBuf buf) { if (bufs == null) { bufs = new List <FreeBuf>(); } bufs.Add(buf); }
public virtual void Reset(IEventArgs args, string key) { FreeBuf buf = map[key]; if (buf != null) { buf.Reset(args); } }
public virtual void RemoveBuf(IEventArgs args, string key) { FreeBuf buf = map[key]; if (buf != null) { buf.Remove(args); map.Remove(key); } }
public virtual void AddFreeBuf(FreeBuf buf, IEventArgs args) { string key = FreeUtil.ReplaceVar(buf.GetKey(), args); if (map.ContainsKey(key)) { FreeLog.Error("buf '" + key + "' 覆盖了原有的BUF", null); } this.map[key] = buf; }
public virtual void Eat(PlayerEntity player, ISkillArgs skill) { MyDictionary <string, FreeBuf> .Enumerator it = map.GetEnumerator(); while (it.MoveNext()) { FreeBuf buf = it.Current.Value; FreeLog.SetTrigger(buf); buf.Eat(player, skill); } }