Esempio n. 1
0
 public AncientTransmuterSpellHandler(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
     if (caster is GamePlayer)
     {
         GamePlayer casterPlayer = caster as GamePlayer;
         merchant = new GameMerchant();
         //Fill the object variables
         merchant.X = casterPlayer.X + Util.Random(20, 40) - Util.Random(20, 40);
         merchant.Y = casterPlayer.Y + Util.Random(20, 40) - Util.Random(20, 40);
         merchant.Z = casterPlayer.Z;
         merchant.CurrentRegion = casterPlayer.CurrentRegion;
         merchant.Heading = (ushort)((casterPlayer.Heading + 2048) % 4096);
         merchant.Level = 1;
         merchant.Realm = casterPlayer.Realm;
         merchant.Name = "Ancient Transmuter";
         merchant.Model = 993;
         merchant.CurrentSpeed = 0;
         merchant.MaxSpeedBase = 0;
         merchant.GuildName = "";
         merchant.Size = 50;
         merchant.Flags |= GameNPC.eFlags.PEACE;
         merchant.TradeItems = new MerchantTradeItems("ML_transmuteritems");
     }
 }
Esempio n. 2
0
		/// <summary>
		/// FIXME this has nothing to do here !
		/// </summary>
		/// <param name="line"></param>
		/// <param name="spell"></param>
		/// <returns></returns>
		public override bool CanChangeCastingSpeed(SpellLine line, Spell spell)
		{
			if (spell.SpellType == "Chamber")
				return false;

			if ((line.KeyName == "Cursing"
				 || line.KeyName == "Cursing Spec"
				 || line.KeyName == "Hexing"
				 || line.KeyName == "Witchcraft")
				&& (spell.SpellType != "ArmorFactorBuff"
					&& spell.SpellType != "Bladeturn"
					&& spell.SpellType != "ArmorAbsorptionBuff"
					&& spell.SpellType != "MatterResistDebuff"
					&& spell.SpellType != "Uninterruptable"
					&& spell.SpellType != "Powerless"
					&& spell.SpellType != "Range"
					&& spell.Name != "Lesser Twisting Curse"
					&& spell.Name != "Twisting Curse"
					&& spell.Name != "Lesser Winding Curse"
					&& spell.Name != "Winding Curse"
					&& spell.Name != "Lesser Wrenching Curse"
					&& spell.Name != "Wrenching Curse"
					&& spell.Name != "Lesser Warping Curse"
					&& spell.Name != "Warping Curse"))
			{
				return false;
			}

			return true;
		}
Esempio n. 3
0
        public static void BuffPlayer(GamePlayer player, Spell spell, SpellLine spellLine)
        {
            Queue m_buffs = new Queue();
            Container con = new Container(spell, spellLine, player);
            m_buffs.Enqueue(con);

            CastBuffs(player, m_buffs);
        }
Esempio n. 4
0
		public SummonWoodSpellHandler(GameLiving caster, Spell spell, SpellLine line)
			: base(caster, spell, line)
		{
			ItemTemplate template = GameServer.Database.FindObjectByKey<ItemTemplate>("mysticwood_wooden_boards");
			if (template != null)
			{
				item = GameInventoryItem.Create<ItemTemplate>(template);
				if (item.IsStackable)
				{
					item.Count = 100;
				}
			}
		}
        // constructor
        public BolsteringRoarSpellHandler(GameLiving caster, Spell spell, SpellLine line)
            : base(caster, spell, line)
        {
 			// RR4: now it's a list
			m_spellTypesToRemove = new List<string>();       	
            m_spellTypesToRemove.Add("Mesmerize");
            m_spellTypesToRemove.Add("SpeedDecrease");
            m_spellTypesToRemove.Add("StyleSpeedDecrease");
            m_spellTypesToRemove.Add("DamageSpeedDecrease");
            m_spellTypesToRemove.Add("HereticSpeedDecrease");
            m_spellTypesToRemove.Add("HereticDamageSpeedDecreaseLOP");
            m_spellTypesToRemove.Add("VampiirSpeedDecrease");
            m_spellTypesToRemove.Add("ValkyrieSpeedDecrease");
            m_spellTypesToRemove.Add("WarlockSpeedDecrease");
        }
		public SummonWoodSpellHandler(GameLiving caster, Spell spell, SpellLine line)
			: base(caster, spell, line)
		{
			ItemTemplate template = GameServer.Database.FindObjectByKey<ItemTemplate>("mysticwood_wooden_boards");
			if (template != null)
			{
                items.Add(GameInventoryItem.Create(template));
                foreach (InventoryItem item in items)
                {
                    if (item.IsStackable)
                    {
                        item.Count = 1;
                        item.Weight = item.Count * item.Weight;
                    }
                }
			}
		}
Esempio n. 7
0
		/// <summary>
		/// Cast a spell on player and its pets/subpets if available.
		/// </summary>
		/// <param name="sourceNPC">NPC that is casting the spell</param>
		/// <param name="player">Player is the owner and first target of the spell</param>
		/// <param name="spell">Casted spell</param>
		/// <param name="line">SpellLine the casted spell is derived from</param>
		/// <param name="checkLOS">Determines if line of sight is checked</param>
		public static void CastSpellOnOwnerAndPets(this GameNPC sourceNPC, GamePlayer player, Spell spell, SpellLine line, bool checkLOS)
		{
			sourceNPC.TargetObject = player;
			sourceNPC.CastSpell(spell, line, checkLOS);
			if (player.ControlledBrain != null)
			{
				sourceNPC.TargetObject = player.ControlledBrain.Body;
				sourceNPC.CastSpell(spell, line, checkLOS);
				if (player.ControlledBrain.Body.ControlledNpcList != null)
					foreach (AI.Brain.IControlledBrain subpet in player.ControlledBrain.Body.ControlledNpcList)
						if (subpet != null)
						{
							sourceNPC.TargetObject = subpet.Body;
							sourceNPC.CastSpell(spell, line, checkLOS);
						}
			}
		}
Esempio n. 8
0
		public void BuffPlayer(GamePlayer player, Spell spell, SpellLine spellLine)
		{
			if (m_buffs == null) m_buffs = new Queue();
			
			m_buffs.Enqueue(new Container(spell, spellLine, player));

			//don't forget his pet !
			if(BUFFS_PLAYER_PET && player.ControlledBrain != null) 
			{
				if(player.ControlledBrain.Body != null) 
				{
					m_buffs.Enqueue(new Container(spell, spellLine, player.ControlledBrain.Body));
				}
			}

			CastBuffs();

		}
Esempio n. 9
0
		// constructor
		public PrescienceNodeSpellHandler(GameLiving caster, Spell spell, SpellLine line)
			: base(caster, spell, line)
		{
			ApplyOnNPC = false;
			ApplyOnCombat = true;

			//Construct a new font.
			font = new GameFont();
			font.Model = 2584;
			font.Name = spell.Name;
			font.Realm = caster.Realm;
			font.X = caster.X;
			font.Y = caster.Y;
			font.Z = caster.Z;
			font.CurrentRegionID = caster.CurrentRegionID;
			font.Heading = caster.Heading;
			font.Owner = (GamePlayer)caster;

			// Construct the font spell
			dbs = new DBSpell();
			dbs.Name = spell.Name;
			dbs.Icon = 7312;
			dbs.ClientEffect = 7312;
			dbs.Damage = spell.Damage;
			dbs.DamageType = (int)spell.DamageType;
			dbs.Target = "Enemy";
			dbs.Radius = 0;
			dbs.Type = "Prescience";
			dbs.Value = spell.Value;
			dbs.Duration = spell.ResurrectHealth;
			dbs.Frequency = spell.ResurrectMana;
			dbs.Pulse = 0;
			dbs.PulsePower = 0;
			dbs.LifeDrainReturn = spell.LifeDrainReturn;
			dbs.Power = 0;
			dbs.CastTime = 0;
			dbs.Range = WorldMgr.VISIBILITY_DISTANCE;
			sRadius = 2000;
			s = new Spell(dbs, 50);
			sl = SkillBase.GetSpellLine(GlobalSpellsLines.Reserved_Spells);
			heal = ScriptMgr.CreateSpellHandler(m_caster, s, sl);
		}
Esempio n. 10
0
 public NegativeMaelstromBase(int damage)
 {
     this.damage = damage;
     dbs = new DBSpell();
     dbs.Name = GetStaticName();
     dbs.Icon = GetStaticEffect();
     dbs.ClientEffect = GetStaticEffect();
     dbs.Damage = damage;
     dbs.DamageType = (int)eDamageType.Cold;
     dbs.Target = "Enemy";
     dbs.Radius = 0;
     dbs.Type = "DirectDamageNoVariance";
     dbs.Value =0;
     dbs.Duration = 0;
     dbs.Pulse = 0;
     dbs.PulsePower = 0;
     dbs.Power = 0;
     dbs.CastTime = 0;
     dbs.Range = WorldMgr.VISIBILITY_DISTANCE;
     sl = new SpellLine("RAs","RealmAbilitys","RealmAbilitys",true);
 }
Esempio n. 11
0
 public StaticTempestBase(int stunDuration)
 {
     dbs = new DBSpell();
     dbs.Name = GetStaticName();
     dbs.Icon = GetStaticEffect();
     dbs.ClientEffect = GetStaticEffect();
     dbs.Damage = 0;
     dbs.DamageType = (int)eDamageType.Energy;
     dbs.Target = "Enemy";
     dbs.Radius = 0;
     dbs.Type = "UnresistableStun";
     dbs.Value = 0;
     dbs.Duration = stunDuration;
     dbs.Pulse = 0;
     dbs.PulsePower = 0;
     dbs.Power = 0;
     dbs.CastTime = 0;
     dbs.Range = WorldMgr.VISIBILITY_DISTANCE;
     s = new Spell(dbs,1);
     sl = new SpellLine("RAs","RealmAbilitys","RealmAbilitys",true);
 }
Esempio n. 12
0
 public ThornweedFieldBase(int damage)
 {
     dbs = new DBSpell();
     dbs.Name = GetStaticName();
     dbs.Icon = GetStaticEffect();
     dbs.ClientEffect = GetStaticEffect();
     dbs.Damage = damage;
     dbs.DamageType = (int)eDamageType.Natural;
     dbs.Target = "Enemy";
     dbs.Radius = 0;
     dbs.Type = "DamageSpeedDecreaseNoVariance";
     dbs.Value = 50;
     dbs.Duration = 5;
     dbs.Pulse = 0;
     dbs.PulsePower = 0;
     dbs.Power = 0;
     dbs.CastTime = 0;
     dbs.Range = WorldMgr.VISIBILITY_DISTANCE;
     s = new Spell(dbs,1);
     sl = new SpellLine("RAs","RealmAbilitys","RealmAbilitys",true);
 }
        public virtual void CreateSpell(double damage)
        {
            m_dbspell = new DBSpell();
            m_dbspell.Name = "Anger of the Gods";
            m_dbspell.Icon = 7023;
            m_dbspell.ClientEffect = 7023;
            m_dbspell.Damage = damage;
            m_dbspell.DamageType = 0;
            m_dbspell.Target = "Group";
            m_dbspell.Radius = 0;
            m_dbspell.Type = "DamageAdd";
            m_dbspell.Value = 0;
            m_dbspell.Duration = 30;
            m_dbspell.Pulse = 0;
            m_dbspell.PulsePower = 0;
            m_dbspell.Power = 0;
            m_dbspell.CastTime = 0;
			m_dbspell.EffectGroup = 99999; // stacks with other damage adds
            m_dbspell.Range = 1000;
            m_spell = new Spell(m_dbspell, 0); // make spell level 0 so it bypasses the spec level adjustment code
            m_spellline = new SpellLine("RAs", "RealmAbilities", "RealmAbilities", true);
        }	
Esempio n. 14
0
        // constructor
        public DazzlingArraySpellHandler(GameLiving caster, Spell spell, SpellLine line)
            : base(caster, spell, line)
        {
            //Construct a new storm.
            storm = new GameStorm();
            storm.Realm = caster.Realm;
            storm.X = caster.X;
            storm.Y = caster.Y;
            storm.Z = caster.Z;
            storm.CurrentRegionID = caster.CurrentRegionID;
            storm.Heading = caster.Heading;
            storm.Owner = (GamePlayer)caster;
            storm.Movable = true;

            // Construct the storm spell
            dbs = new DBSpell();
            dbs.Name = spell.Name;
            dbs.Icon = 7210;
            dbs.ClientEffect = 7210;
            dbs.Damage = spell.Damage;
            dbs.DamageType = (int)spell.DamageType;
            dbs.Target = "Realm";
            dbs.Radius = 0;
            dbs.Type = "StormMissHit";
            dbs.Value = spell.Value;
            dbs.Duration = spell.ResurrectHealth; // should be 4
            dbs.Frequency = spell.ResurrectMana;
            dbs.Pulse = 0;
            dbs.PulsePower = 0;
            dbs.LifeDrainReturn = spell.LifeDrainReturn;
            dbs.Power = 0;
            dbs.CastTime = 0;
            dbs.Range = WorldMgr.VISIBILITY_DISTANCE;
            sRadius = 350;
            s = new Spell(dbs, 1);
            sl = SkillBase.GetSpellLine(GlobalSpellsLines.Reserved_Spells);
            tempest = ScriptMgr.CreateSpellHandler(m_caster, s, sl);
        }
Esempio n. 15
0
 public Morph(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 16
0
 public LoreDebuff(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 17
0
 public ArcaneLeadership(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 18
0
 /// <summary>
 /// Constructs the spell handler
 /// </summary>
 public SummonNoveltyPet(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 19
0
		/// <summary>
		/// Add a spell to the queue. If there are already 2 spells in the
		/// queue, remove the spell that the pet would cast next.
		/// </summary>
		/// <param name="spell">The spell to add.</param>
		/// <param name="spellLine">The spell line the spell is in.</param>
		/// <param name="target">The target to cast the spell on.</param>
		private void AddToSpellQueue(Spell spell, SpellLine spellLine, GameLiving target)
		{
			lock (m_spellQueue)
			{
				if (m_spellQueue.Count >= 2)
                    MessageToOwner(LanguageMgr.GetTranslation((Owner as GamePlayer).Client.Account.Language, 
                        "AI.Brain.Necromancer.SpellNoLongerInQueue", 
                        (m_spellQueue.Dequeue()).Spell.Name, Body.Name), 
                        eChatType.CT_Spell);

                DebugMessageToOwner(String.Format("Adding spell '{0}' to the end of the queue", spell.Name));
				m_spellQueue.Enqueue(new SpellQueueEntry(spell, spellLine, target));
			}
		}
Esempio n. 20
0
 public AllStatsDebuff(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 21
0
		public RealmLore(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) {}
		// constructor
		public StunSpellHandler(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) {}
		// constructor
		public MesmerizeSpellHandler(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) {}
Esempio n. 24
0
        /// <summary>
        /// Insta cast baseline buffs (STR+DEX) on the pet.
        /// </summary>
        private void Empower()
        {
            if (AttackState)
            {
                return;
            }

            SpellLine buffLine = SkillBase.GetSpellLine(PetInstaSpellLine);

            if (buffLine == null)
            {
                return;
            }

            List <Spell> buffList = SkillBase.GetSpellList(PetInstaSpellLine);

            if (buffList.Count == 0)
            {
                return;
            }

            // Find the best baseline buffs for this level.

            int   maxLevel = Level;
            Spell strBuff = null, dexBuff = null;

            foreach (Spell spell in buffList)
            {
                if (spell.Level <= maxLevel)
                {
                    switch (spell.SpellType)
                    {
                    case "StrengthBuff":
                    {
                        if (strBuff == null)
                        {
                            strBuff = spell;
                        }
                        else
                        {
                            strBuff = (strBuff.Level < spell.Level) ? spell : strBuff;
                        }
                    }
                    break;

                    case "DexterityBuff":
                    {
                        if (dexBuff == null)
                        {
                            dexBuff = spell;
                        }
                        else
                        {
                            dexBuff = (dexBuff.Level < spell.Level) ? spell : dexBuff;
                        }
                    }
                    break;
                    }
                }
            }

            // Insta buff.

            if (strBuff != null)
            {
                CastSpell(strBuff, buffLine);
            }
            if (dexBuff != null)
            {
                CastSpell(dexBuff, buffLine);
            }
        }
Esempio n. 25
0
		public override void CastSpell(Spell spell, SpellLine line)
		{
			if (IsStunned || IsMezzed)
			{
				Notify(GameLivingEvent.CastFailed, this, new CastFailedEventArgs(null, CastFailedEventArgs.Reasons.CrowdControlled));
				return;
			}

			if ((m_runningSpellHandler != null && spell.CastTime > 0))
			{
				Notify(GameLivingEvent.CastFailed, this, new CastFailedEventArgs(null, CastFailedEventArgs.Reasons.AlreadyCasting));
				return;
			}

			ISpellHandler spellhandler = ScriptMgr.CreateSpellHandler(this, spell, line);
			if (spellhandler != null)
			{
				int power = spellhandler.PowerCost(Owner);

				if (Owner.Mana < power)
				{
					Notify(GameLivingEvent.CastFailed, this, new CastFailedEventArgs(null, CastFailedEventArgs.Reasons.NotEnoughPower));
					return;
				}

				m_runningSpellHandler = spellhandler;
				spellhandler.CastingCompleteEvent += new CastingCompleteCallback(OnAfterSpellCastSequence);
				spellhandler.CastSpell();
			}
			else
			{
				if (log.IsWarnEnabled)
					log.Warn(Name + " wants to cast but spell " + spell.Name + " not implemented yet");
				return;
			}
		}
Esempio n. 26
0
        /// <summary>
        /// Create a spell handler for caster with given spell
        /// </summary>
        /// <param name="caster">caster that uses the spell</param>
        /// <param name="spell">the spell itself</param>
        /// <param name="line">the line that spell belongs to or null</param>
        /// <returns>spellhandler or null if not found</returns>
        public static ISpellHandler CreateSpellHandler(GameLiving caster, Spell spell, SpellLine line)
        {
            if (spell == null || spell.SpellType.Length == 0)
            {
                return(null);
            }

            ConstructorInfo handlerConstructor = null;

            if (m_spellhandlerConstructorCache.ContainsKey(spell.SpellType))
            {
                handlerConstructor = m_spellhandlerConstructorCache[spell.SpellType];
            }

            // try to find it in assemblies when not in cache
            if (handlerConstructor == null)
            {
                Type[] constructorParams = new Type[] { typeof(GameLiving), typeof(Spell), typeof(SpellLine) };

                foreach (Assembly script in GameServerScripts)
                {
                    foreach (Type type in script.GetTypes())
                    {
                        if (type.IsClass != true)
                        {
                            continue;
                        }
                        if (type.GetInterface("DOL.GS.Spells.ISpellHandler") == null)
                        {
                            continue;
                        }

                        // look for attribute
                        try
                        {
                            object[] objs = type.GetCustomAttributes(typeof(SpellHandlerAttribute), false);
                            if (objs.Length == 0)
                            {
                                continue;
                            }

                            foreach (SpellHandlerAttribute attrib in objs)
                            {
                                if (attrib.SpellType == spell.SpellType)
                                {
                                    handlerConstructor = type.GetConstructor(constructorParams);
                                    if (log.IsDebugEnabled)
                                    {
                                        log.Debug("Found spell handler " + type);
                                    }
                                    break;
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            if (log.IsErrorEnabled)
                            {
                                log.Error("CreateSpellHandler", e);
                            }
                        }

                        if (handlerConstructor != null)
                        {
                            break;
                        }
                    }
                }

                if (handlerConstructor != null)
                {
                    m_spellhandlerConstructorCache.Add(spell.SpellType, handlerConstructor);
                }
            }

            if (handlerConstructor != null)
            {
                try
                {
                    return((ISpellHandler)handlerConstructor.Invoke(new object[] { caster, spell, line }));
                }
                catch (Exception e)
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("Failed to create spellhandler " + handlerConstructor, e);
                    }
                }
            }
            else
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Couldn't find spell handler for spell type " + spell.SpellType);
                }
            }
            return(null);
        }
Esempio n. 27
0
 public StrengthConstitutionDrain(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 28
0
 public ABSDamageShield(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 29
0
 public MaddeningScalars(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 30
0
 public SummonMinionHandler(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 31
0
			public SpellQueueEntry(Spell spell, SpellLine spellLine, GameLiving target)
			{
				m_spell = spell;
				m_spellLine = spellLine;
				m_target = target;
			}
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="caster"></param>
		/// <param name="spell"></param>
		/// <param name="line"></param>
		public AbstractCCSpellHandler(GameLiving caster, Spell spell, SpellLine line) : base(caster, spell, line) {}
Esempio n. 33
0
 public virtual bool CanChangeCastingSpeed(SpellLine line, Spell spell)
 {
     return(true);
 }