Example #1
0
			private static void AddSpell(Unit target, Spell spell, bool addRequired)
			{
				var chr = target as Character;
				if (addRequired && chr != null)
				{
					chr.PlayerSpells.SatisfyConstraintsFor(spell);
				}
				else
				{
					// Profession
					if (spell.Skill != null && chr != null)
					{
						chr.Skills.TryLearn(spell.SkillId);
					}
				}

				if (spell.Talent != null && chr != null)
				{
					// talent
					chr.Talents.Set(spell.Talent, spell.Line.SpellCount - 1);
				}
				else
				{
					// normal spell
					target.EnsureSpells().AddSpell(spell);
				}
			}