protected void AddSkillShot(string name, Vector2 toPosition, Vector2 endPosition, float range, bool serverOnly = false) { var record = SpellRecord.GetSpell(name); var position = new Vector3(Owner.Position.X, Owner.Position.Y, 100); var casterPosition = new Vector3(Owner.Position.X, Owner.Position.Y, 100); var angle = Geo.GetAngle(Owner.Position, endPosition); var direction = Geo.GetDirection(angle); var velocity = new Vector3(1, 1, 1) * 100; var startPoint = new Vector3(Owner.Position.X, Owner.Position.Y, 100); var endPoint = new Vector3(endPosition.X, endPosition.Y, 100); var skillShot = new SkillShot(Owner.Game.NetIdProvider.PopNextNetId(), Owner, position.ToVector2(), record.MissileSpeed, record.LineWidth, OnProjectileReach, direction, range, OnSkillShotRangeReached); Owner.Game.AddUnitToTeam(skillShot, Owner.Team.Id); Owner.Game.Map.AddUnit(skillShot); if (!serverOnly) { var castInfo = Spell.GetCastInformations(position, endPoint, name, skillShot.NetId); Owner.Game.Send(new SpawnProjectileMessage(skillShot.NetId, position, casterPosition, direction.ToVector3(), velocity, startPoint, endPoint, casterPosition, 0, record.MissileSpeed, 1f, 1f, 1f, false, castInfo)); } }
protected void AddTargetedProjectile(string name, AttackableUnit target, bool serverOnly = false) { var record = SpellRecord.GetSpell(name); var position = new Vector3(Owner.Position.X, Owner.Position.Y, 100); var casterPosition = new Vector3(Owner.Position.X, Owner.Position.Y, 100); var angle = Geo.GetAngle(Owner.Position, target.Position); var direction = Geo.GetDirection(angle); var velocity = new Vector3(1, 1, 1) * 100; var startPoint = new Vector3(Owner.Position.X, Owner.Position.Y, 100); var endPoint = new Vector3(target.Position.X, target.Position.Y, 100); var targetedProjectile = new TargetedProjectile(Owner.Game.NetIdProvider.PopNextNetId(), Owner, target, startPoint.ToVector2(), SpellRecord.MissileSpeed, OnProjectileReach); Owner.Game.AddUnitToTeam(targetedProjectile, Owner.Team.Id); Owner.Game.Map.AddUnit(targetedProjectile); if (!serverOnly) { var castInfo = Spell.GetCastInformations(position, endPoint, name, targetedProjectile.NetId, new AttackableUnit[] { target }); Owner.Game.Send(new SpawnProjectileMessage(targetedProjectile.NetId, position, casterPosition, direction.ToVector3(), velocity, startPoint, endPoint, casterPosition, 0, record.MissileSpeed, 1f, 1f, 1f, false, castInfo)); } }
public Spell GetSpell(AIUnit owner, byte slot, SummonerSpellId summonerSpell) { SpellRecord record = SpellRecord.GetSpell(summonerSpell.ToString()); if (record != null) { return(new Spell(owner, record, slot, SpellScriptManager.Instance.GetSpellScript(record, owner), true)); } else { return(null); } }
public Spell GetSpell(AIUnit owner, byte slot, string spellName, bool isSummonerSpell = false) { SpellRecord record = null; record = SpellRecord.GetSpell(spellName); if (record != null) { return(new Spell(owner, record, slot, SpellScriptManager.Instance.GetSpellScript(record, owner), isSummonerSpell)); } else { return(null); } }
public override void Execute(MonsterFighter fighter) { var summonSpell = fighter.Template.Spells.ConvertAll <SpellRecord>(x => SpellRecord.GetSpell(x)).Find(x => x.Category == SpellCategoryEnum.Summon); if (summonSpell != null && fighter.SummonCount <= 1) { var cells = ShapesProvider.GetSquare(fighter.CellId, false); var cell = cells.Find(x => !fighter.Fight.IsObstacle(x)); if (cell != 0) { fighter.CastSpellOnCell(summonSpell.Id, cell); } else { fighter.Fight.Reply("Unable to summon"); } } }
public override void Execute(World.Models.Fights.Fighters.MonsterFighter fighter) { var spells = fighter.Template.Spells.ConvertAll <SpellRecord>(x => SpellRecord.GetSpell(x)); var target = fighter.Team.LowerFighter(); if (fighter.GetOposedTeam().LowerFighter().FighterStats.LifePercentage <= 20 && spells.FindAll(x => x.Category == SpellCategoryEnum.Damages).Count > 0) { return; } foreach (var spell in spells.FindAll(x => x.Category == SpellCategoryEnum.Heal)) { CastAction.TryCast(fighter, spell.Id, target); } foreach (var spell in spells.FindAll(x => x.Category == SpellCategoryEnum.Buff)) { CastAction.TryCast(fighter, spell.Id, target); } }
public override void Execute(MonsterFighter fighter) { Fighter lower = fighter.GetOposedTeam().LowerFighter(); if (lower == null) { return; } var spells = fighter.Template.Spells.ConvertAll <SpellRecord>(x => SpellRecord.GetSpell(x)); foreach (var spell in spells.FindAll(x => x.Category == SpellCategoryEnum.Damages)) { TryCast(fighter, spell.Id, lower); } foreach (var spell in spells.FindAll(x => x.Category == SpellCategoryEnum.Agress)) { TryCast(fighter, spell.Id, lower); } foreach (var spell in spells.FindAll(x => x.Category == SpellCategoryEnum.Undefined)) { TryCast(fighter, spell.Id, lower); } }
public List <SpellRecord> GetSpellsByCategory(SpellCategoryEnum category) { return(Template.Spells.ConvertAll <SpellRecord>(x => SpellRecord.GetSpell(x)).FindAll(x => x.Category == category)); }