public override IEnumerable <AvoidInfo> OmenHandle(BattleCharacter spellCaster) { if (spellCaster.SpellCastInfo.SpellData.EffectRange > 45) { Logger.Info("Spell range is > 45. Does this require specific logic?"); } //var loc = spellCaster.SpellCastInfo.CastLocation != Vector3.Zero ? spellCaster.SpellCastInfo.CastLocation : spellCaster.Location; Vector3 center; float range = 0f; if (OmenOverrideManager.TryGetOverride(spellCaster.SpellCastInfo.ActionId, out var omenOverride)) { range = Range(spellCaster, out center, omenOverride.MatrixOverride, omenOverride.RangeOverride); } else { range = Range(spellCaster, out center); } Logger.Info($"Avoid Cirlce: [{center}][Range: {range}]"); var cached = spellCaster.CastingSpellId; return(new[] { AvoidanceManager.AddAvoidLocation( () => spellCaster.IsValid && spellCaster.CastingSpellId == cached, //can run () => center, //LeashPoint 50f, //Leash Radius bc => range + 0.5f, //radiusProducer bc => center, //locationProducer () => new[] { spellCaster } //collectionProducer ) }); }
public IEnumerable <AvoidInfo> AddCone(BattleCharacter spellCaster, float arcDegrees) { try { var cachedSpell = spellCaster.CastingSpellId; var m4x4 = spellCaster.OmenMatrix; //sin(0), 0, cos(0) m4x4.Transform(new Vector3(0, 0, 1), out var transformed); var center = m4x4.Center(); var depth = transformed.Distance2D(center); var d = transformed - center; var rot = MathEx.Rotation(d); var rad = (float)Math.Round(MathEx.NormalizeRadian(rot - spellCaster.Heading), 2); var me = Core.Me.Location; Logger.Info("Debug: Rotation: {0} vs Mob heading: {1} = {2}", rot, spellCaster.Heading, rad); return(new[] { AvoidanceManager.AddAvoidUnitCone <BattleCharacter>( () => spellCaster.IsValid && spellCaster.CastingSpellId == cachedSpell, //can run bc => bc.ObjectId == spellCaster.ObjectId, //object selector () => me, //LeashPoint 120, //leash size rad, //rotation depth, //radius / Depth arcDegrees * 1.55f, //arcDegrees bc => bc.Location ), //add something under the mob so we don't get hit by standing at the mobs location. AvoidanceManager.AddAvoidLocation( () => spellCaster.IsValid && spellCaster.CastingSpellId == cachedSpell, //can run spellCaster.CombatReach / 2, () => spellCaster.Location ) }); } catch (Exception ex) { Logger.Error("failed to make cone: {0}", ex); return(null); } }
public override IEnumerable <AvoidInfo> OmenHandle(BattleCharacter spellCaster) { if (spellCaster.SpellCastInfo.SpellData.EffectRange > 45) { Logger.Info("Spell range is > 45. Does this require specific logic?"); } //var loc = spellCaster.SpellCastInfo.CastLocation != Vector3.Zero ? spellCaster.SpellCastInfo.CastLocation : spellCaster.Location; var range = Range(spellCaster, out var center); Logger.Info($"Avoid Cirlce: [{center}][Range: {range}]"); var cached = spellCaster.CastingSpellId; return(new[] { AvoidanceManager.AddAvoidLocation( () => spellCaster.IsValid && spellCaster.CastingSpellId == cached, null, 40f, bc => range + 0.5f, bc => center, () => new[] { spellCaster } ) }); }