public override void OnEffectStart(GameSpellEffect effect) { //Add the handler for when the target is attacked and we should reduce the damage GameEventMgr.AddHandler(FSTarget, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttacked)); //Add handlers for the target attacking, casting, etc //Don't need to add the handlers twice if (FSTarget != Caster) { GameEventMgr.AddHandler(FSTarget, GameLivingEvent.AttackFinished, new DOLEventHandler(CancelSpell)); GameEventMgr.AddHandler(FSTarget, GameLivingEvent.CastStarting, new DOLEventHandler(CancelSpell)); } //Send the spell messages MessageToLiving(FSTarget, Spell.Message1, eChatType.CT_Spell); foreach (GamePlayer player in FSTarget.GetPlayersInRadius(WorldMgr.INFO_DISTANCE)) { if (player != FSTarget) { MessageToLiving(player, string.Format(Spell.Message3, FSTarget.Name), eChatType.CT_Spell); } } timer = new FSTimer(Caster, this); timer.Start(1); base.OnEffectStart(effect); }
public override void OnEffectStart(GameSpellEffect effect) { //Add the handler for when the target is attacked and we should reduce the damage GameEventMgr.AddHandler(FSTarget, GameLivingEvent.AttackedByEnemy, new DOLEventHandler(OnAttacked)); //Add handlers for the target attacking, casting, etc //Don't need to add the handlers twice if (FSTarget != Caster) { GameEventMgr.AddHandler(FSTarget, GameLivingEvent.AttackFinished, new DOLEventHandler(CancelSpell)); GameEventMgr.AddHandler(FSTarget, GameLivingEvent.CastStarting, new DOLEventHandler(CancelSpell)); } //Send the spell messages MessageToLiving(FSTarget, Spell.Message1, eChatType.CT_Spell); foreach (GamePlayer player in FSTarget.GetPlayersInRadius(WorldMgr.INFO_DISTANCE)) { if (player != FSTarget) MessageToLiving(player, string.Format(Spell.Message3, FSTarget.Name), eChatType.CT_Spell); } timer = new FSTimer(Caster, this); timer.Start(1); base.OnEffectStart(effect); }