Esempio n. 1
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. 2
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. 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;
				}
			}
		}
Esempio n. 5
0
 protected override void CastSpell(GameLiving target)
 {
     if (!target.IsAlive) return;
     if (GameServer.ServerRules.IsAllowedToAttack(m_caster, target, true))
     {
         int dealDamage =damage;
         if (getCurrentPulse()<=6)
             dealDamage = (int)Math.Round(((double)getCurrentPulse()/6*damage));
         dbs.Damage = dealDamage;
         s = new Spell(dbs,1);
         ISpellHandler dd = ScriptMgr.CreateSpellHandler(m_caster, s, sl);
         dd.StartSpell(target);
     }
 }
        // 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. 8
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. 9
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. 10
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. 11
0
		public WallOfFlameBase(int damage)
		{
			dbs = new DBSpell();
			dbs.Name = GetStaticName();
			dbs.Icon = GetStaticEffect();
			dbs.ClientEffect = GetStaticEffect();
			dbs.Damage = damage;
			dbs.DamageType = (int)eDamageType.Heat;
			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;
			s = new Spell(dbs, 1);
			sl = new SpellLine("RAs", "RealmAbilitys", "RealmAbilitys", true);
		}
Esempio n. 12
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. 13
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);
 }
Esempio n. 14
0
		/// <summary>
		/// Checks Instant Spells.  Handles Taunts, shouts, stuns, etc.
		/// </summary>
		protected override bool CheckInstantSpells(Spell spell)
		{
			GameObject lastTarget = Body.TargetObject;
			Body.TargetObject = null;
			switch (spell.SpellType)
			{
				case "Taunt":
					Body.TargetObject = lastTarget;
					break;
			}

			if (Body.TargetObject != null)
			{
				if (LivingHasEffect((GameLiving)Body.TargetObject, spell))
					return false;
				Body.CastSpell(spell, m_mobSpellLine);
				Body.TargetObject = lastTarget;
				return true;
			}
			Body.TargetObject = lastTarget;
			return false;
		}
        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. 16
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. 17
0
 public SummonMinionHandler(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 18
0
 public AllStatsDebuff(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 19
0
 public ABSDamageShield(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 20
0
 public StrengthConstitutionDrain(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 21
0
 public Morph(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 22
0
 /// <summary>
 /// Constructs the spell handler
 /// </summary>
 public SummonNoveltyPet(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 23
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. 24
0
			public SpellQueueEntry(Spell spell, SpellLine spellLine, GameLiving target)
			{
				m_spell = spell;
				m_spellLine = spellLine;
				m_target = target;
			}
Esempio n. 25
0
 public MaddeningScalars(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 26
0
        /// <summary>
        /// Constructs a new NpcTemplate
        /// </summary>
        /// <param name="data">The source npc template data</param>
        public NpcTemplate(DBNpcTemplate data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            m_templateId     = data.TemplateId;
            m_translationId  = data.TranslationId;
            m_name           = data.Name;
            m_suffix         = data.Suffix;
            m_classType      = data.ClassType;
            m_guildName      = data.GuildName;
            m_examineArticle = data.ExamineArticle;
            m_messageArticle = data.MessageArticle;
            m_model          = data.Model;
            m_gender         = data.Gender;
            m_size           = data.Size;
            if (m_size == null)
            {
                m_size = "50";
            }
            m_level = data.Level;
            if (m_level == null)
            {
                m_level = "0";
            }
            m_equipmentTemplateID = data.EquipmentTemplateID;
            m_itemsListTemplateID = data.ItemsListTemplateID;
            m_maxSpeed            = data.MaxSpeed;
            m_parryChance         = data.ParryChance;
            m_evadeChance         = data.EvadeChance;
            m_blockChance         = data.BlockChance;
            m_leftHandSwingChance = data.LeftHandSwingChance;
            m_strength            = data.Strength;
            m_constitution        = data.Constitution;
            m_dexterity           = data.Dexterity;
            m_quickness           = data.Quickness;
            m_intelligence        = data.Intelligence;
            m_piety    = data.Piety;
            m_charisma = data.Charisma;
            m_empathy  = data.Empathy;

            //Time to add Spells/Styles and Abilties to the templates
            m_abilities  = new ArrayList();
            m_spelllines = new ArrayList();
            m_spells     = new ArrayList();
            //Adding the spells to an Arraylist here
            if (data.Spells != null && data.Spells.Length > 0)
            {
                string[] spells = data.Spells.Split(';');
                for (int k = 0; k < spells.Length; k++)
                {
                    int   id = int.Parse(spells[k]);
                    Spell sp = SkillBase.GetSpellByID(id);
                    if (sp != null)
                    {
                        m_spells.Add(sp);
                    }
                    else
                    {
                        log.Error("Tried to load a null spell into NPC template " + m_templateId + " spell ID: " + id);
                    }
                }
            }

            // Adding Style list to Template NPC
            m_styles = new ArrayList();
            if (data.Styles != null && data.Styles.Length > 0)
            {
                string[] styles = data.Styles.Split(';');
                for (int i = 0; i < styles.Length; i++)
                {
                    if (styles[i].Trim().Length == 0)
                    {
                        continue;
                    }
                    string[] styleAndClass = styles[i].Split('|');
                    if (styleAndClass.Length != 2)
                    {
                        continue;
                    }
                    string stylePart = styleAndClass[0].Trim();
                    string classPart = styleAndClass[1].Trim();
                    if (stylePart.Length == 0 || classPart.Length == 0)
                    {
                        continue;
                    }
                    int   styleID = int.Parse(stylePart);
                    int   classID = int.Parse(classPart);
                    Style style   = SkillBase.GetStyleByID(styleID, classID);
                    m_styles.Add(style);
                }
            }
            //Adding Abilities to Template NPC.
            //Certain Abilities have levels will need to fix that down the road. -Batlas

            if (data.Abilities != null && data.Abilities.Length > 0)
            {
                foreach (string splitab in data.Abilities.SplitCSV())
                {
                    string[] ab = splitab.Split('|');
                    if (splitab.Trim().Length == 0)
                    {
                        continue;
                    }
                    int id = 1;
                    if (ab.Length > 1)
                    {
                        id = int.Parse(ab[1]);
                    }
                    Ability abil = SkillBase.GetAbility(ab[0], id);
                    if (abil != null)
                    {
                        m_abilities.Add(abil);
                    }
                }
            }

            m_flags = data.Flags;

            m_meleeDamageType = (eDamageType)data.MeleeDamageType;
            if (data.MeleeDamageType == 0)
            {
                m_meleeDamageType = eDamageType.Slash;
            }

            m_inventory               = data.EquipmentTemplateID;
            m_aggroLevel              = data.AggroLevel;
            m_aggroRange              = data.AggroRange;
            m_race                    = (ushort)data.Race;
            m_bodyType                = (ushort)data.BodyType;
            m_maxdistance             = data.MaxDistance;
            m_tetherRange             = data.TetherRange;
            m_visibleActiveWeaponSlot = data.VisibleWeaponSlots;

            m_replaceMobValues = data.ReplaceMobValues;
        }
Esempio n. 27
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. 28
0
		public override bool CanCastInCombat(Spell spell)
		{
			// Necromancer pets can always start to cast while in combat
			return true;
		}
Esempio n. 29
0
 public ArcaneLeadership(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }
Esempio n. 30
0
		/// <summary>
		/// Checks the Positive Spells.  Handles buffs, heals, etc.
		/// </summary>
		protected override bool CheckDefensiveSpells(Spell spell) { return false; }
Esempio n. 31
0
 public LoreDebuff(GameLiving caster, Spell spell, SpellLine line)
     : base(caster, spell, line)
 {
 }