GetChainCastLevel() public method

Returns the chain cast level the creature can use for the given skill.
Checks passive monster skill and upgrades of equipped weapons.
public GetChainCastLevel ( SkillId skillId ) : int
skillId SkillId
return int
Example #1
0
		/// <summary>
		/// Finishes preparing, adds stack.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		/// <param name="packet"></param>
		/// <returns></returns>
		public virtual bool Ready(Creature creature, Skill skill, Packet packet)
		{
			// Note: The client only prevents casting if stacks = max, if you go above the limit
			//   it lets you keep casting.

			var addStacks = skill.RankData.Stack + creature.GetChainCastLevel(skill.Info.Id);
			skill.Stacks = Math.Min(skill.RankData.StackMax, skill.Stacks + addStacks);

			Send.Effect(creature, Effect.StackUpdate, EffectSkillName, (byte)skill.Stacks, (byte)0);
			Send.Effect(creature, Effect.Casting, (short)skill.Info.Id, (byte)0, (byte)2, (short)0);

			Send.SkillReady(creature, skill.Info.Id);

			return true;
		}
Example #2
0
		/// <summary>
		/// Custom usage of resources on Prepare, to account for chain
		/// casting.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="skill"></param>
		public void CustomPrepareUsage(Creature creature, Skill skill)
		{
			var cost = skill.RankData.ManaPrepare;
			if (cost == 0)
				return;

			var addedStacks = Math.Min(skill.RankData.StackMax - skill.Stacks, skill.RankData.Stack + creature.GetChainCastLevel(skill.Info.Id));
			cost *= addedStacks;

			var castTime = skill.GetCastTime();
			if (castTime == 0)
			{
				creature.Mana += cost;
				Send.StatUpdate(creature, StatUpdateType.Private, Stat.Mana);
			}
			else
			{
				var perSecond = (float)(cost / Math.Ceiling(castTime / 1000f) * (skill.RankData.NewLoadTime / 1000f));
				var seconds = (int)(Math.Ceiling(castTime / 1000f) * 1000);

				creature.Regens.Add(Stat.Mana, perSecond, creature.ManaMax, seconds);
			}
		}