Beispiel #1
0
        /// <summary>
        /// Called when owner release NPC
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="arguments"></param>
        protected virtual void OnNpcReleaseCommand(DOLEvent e, object sender, EventArgs arguments)
        {
            if (!((sender as GameNPC)?.Brain is IControlledBrain))
            {
                return;
            }

            GameNPC          pet    = sender as GameNPC;
            IControlledBrain brain  = pet.Brain as IControlledBrain;
            GameLiving       living = brain.Owner;

            living.SetControlledBrain(null);

            GameEventMgr.RemoveHandler(pet, GameLivingEvent.PetReleased, new DOLEventHandler(OnNpcReleaseCommand));

            GameSpellEffect effect = FindEffectOnTarget(pet, this);

            effect?.Cancel(false);
        }