/// <summary> /// Constructs a new DelayedSpellTimer /// </summary> /// <param name="actionSource">The caster</param> /// <param name="handler">The spell handler</param> /// <param name="target">The target object</param> public DelayedCastTimer(GameLiving actionSource, SpellHandler handler, GameLiving target, int delay1, int delay2) : base(actionSource.CurrentRegion.TimeManager) { if (handler == null) throw new ArgumentNullException("handler"); if (actionSource == null) throw new ArgumentNullException("actionSource"); m_handler = handler; m_target = target; m_caster = actionSource; m_stage = 0; m_delay1 = delay1; m_delay2 = delay2; }
public FriendBrain(SpellHandler spellHandler) : base() { ThinkInterval = 3000; m_spellHandler = spellHandler; }
/// <summary> /// Action /// </summary> /// <param name="living"></param> public override void Execute(GameLiving living) { if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return; GamePlayer player = living as GamePlayer; if (player != null) { /*BlissfulIgnoranceEffect BlissfulIgnorance = (BlissfulIgnoranceEffect)player.EffectList.GetOfType(typeof(BlissfulIgnoranceEffect)); if (BlissfulIgnorance != null) BlissfulIgnorance.Cancel(false); new BlissfulIgnoranceEffect().Start(player);*/ Hashtable table_spells = new Hashtable(); foreach (Spell spell in SkillBase.GetSpellList("Savagery")) { if(spell.Group==0 || spell.Target.ToLower()!="self") continue; if (spell.Level <= player.GetSpellLine("Savagery").Level) { if (!table_spells.ContainsKey(spell.Group)) table_spells.Add(spell.Group, spell); else { Spell oldspell = (Spell)table_spells[spell.Group]; if (spell.Level > oldspell.Level) table_spells[spell.Group] = spell; } } } foreach (object obj in table_spells.Values) { if (obj == null || !(obj is Spell)) continue; Spell spell = obj as Spell; try { DBSpell db = new DBSpell(); db.ClientEffect = spell.ClientEffect; db.Icon = spell.Icon; db.Name = spell.Name; db.Description = spell.Description; db.Duration = spell.Duration / 1000; db.Power = 0; db.Value = spell.Value; db.Message1 = ""; db.Message2 = ""; db.Message3 = ""; db.Message4 = ""; db.Type = spell.SpellType; db.Target = "Self"; db.MoveCast = true; db.Uninterruptible = true; SpellHandler handler = new SpellHandler(player, new Spell(db, 0), SkillBase.GetSpellLine("Savagery")); if(handler!=null) handler.CastSpell(); } catch (Exception e) { if (log.IsErrorEnabled) log.Error("RR5 Savage : use spell, ", e); } } } DisableSkill(living); }