示例#1
0
        public Projectile(
            Game game,
            float x,
            float y,
            int collisionRadius,
            IAttackableUnit owner,
            ITarget target,
            ISpell originSpell,
            float moveSpeed,
            string projectileName,
            int flags  = 0,
            uint netId = 0
            ) : base(game, x, y, collisionRadius, 0, netId)
        {
            SpellData    = _game.Config.ContentManager.GetSpellData(projectileName);
            _originSpell = originSpell;
            _moveSpeed   = moveSpeed;
            Owner        = owner;
            Team         = owner.Team;
            ProjectileId = (int)HashFunctions.HashString(projectileName);
            if (!string.IsNullOrEmpty(projectileName))
            {
                VisionRadius = SpellData.MissilePerceptionBubbleRadius;
            }
            ObjectsHit = new List <IGameObject>();

            Target = target;
        }
示例#2
0
        public void AddProjectileTarget(string nameMissile, ITarget target, bool isServerOnly = false)
        {
            ISpellData projectileSpellData = this._game.Config.ContentManager.GetSpellData(nameMissile);

            var p = new Projectile(
                _game,
                Owner.X,
                Owner.Y,
                (int)projectileSpellData.LineWidth,
                Owner,
                target,
                this,
                projectileSpellData.MissileSpeed,
                nameMissile,
                projectileSpellData.Flags,
                _futureProjNetId
                );

            Projectiles.Add(p.NetId, p);

            _game.ObjectManager.AddObject(p);

            if (!isServerOnly)
            {
                _game.PacketNotifier.NotifyMissileReplication(p);
            }

            _futureProjNetId = _networkIdManager.GetNewNetId();
        }
        protected override void OnInitialize(IActor owner)
        {
            _spellData                 = Owner.GetData <SpellData>();
            _ownerTransformData        = Owner.GetData <TransformData>();
            _animationEventHandlerData = Owner.GetData <AnimationEventHandlerData>();

            if (owner is ICaster caster)
            {
                _caster = caster;
            }

            _animationEventHandlerData.EventHandler.AddEvent("Cast", Cast);
        }
示例#4
0
        public ISpellData GetSpellData(string spellName)
        {
            foreach (var dataPackage in _loadedPackages)
            {
                ISpellData toReturnSpellData = dataPackage.GetSpellData(spellName);

                if (toReturnSpellData != null)
                {
                    return(toReturnSpellData);
                }
            }

            throw new ContentNotFoundException($"No Spell Data found with name: {spellName}");
        }
 public ProcessSpellCastEventArgs(int sourceId, ISpellData spellData, int level, Vector3 start, Vector3 to, Vector3 end, int targetId, int missileId, float castTime, float totalTime, SpellSlot slot)
 {
     this.SourceId  = sourceId;
     this.SpellData = spellData;
     this.Level     = level;
     this.Start     = start;
     this.To        = to;
     this.End       = end;
     this.TargetId  = targetId;
     this.MissileId = missileId;
     this.CastTime  = castTime;
     this.TotalTime = totalTime;
     this.Slot      = slot;
 }
示例#6
0
        public Spell(Game game, IChampion owner, string spellName, byte slot)
        {
            Owner             = owner;
            SpellName         = spellName;
            Slot              = slot;
            _game             = game;
            SpellData         = game.Config.ContentManager.GetSpellData(spellName);
            _scriptEngine     = game.ScriptEngine;
            _networkIdManager = game.NetworkIdManager;

            //Set the game script for the spell
            _spellGameScript = _scriptEngine.CreateObject <IGameScript>("Spells", spellName) ?? new GameScriptEmpty();
            //Activate spell - Notes: Deactivate is never called as spell removal hasn't been added
            _spellGameScript.OnActivate(owner);
        }
示例#7
0
 public void ChangeAutoAttackSpellData(ISpellData newAutoAttackSpellData)
 {
     AaSpellData = newAutoAttackSpellData;
 }