Exemple #1
0
        // The Composition Root of our software
        public override void Load()
        {
            var ireliaQ = new IreliaQ();
            var ireliaW = new IreliaW();
            var ireliaE = new IreliaE();
            var ireliaR = new IreliaR();

            var cacheFactory = new ProviderCacheFactory();

            var qUnitProvider = cacheFactory.Create(new QUnitProvider());
            var eUnitProvider = cacheFactory.Create(new EUnitProvider());
            var rVecProvider  = cacheFactory.Create(new RVectorProvider());

            // TODO: Client wrapped in a IProvider which finds a { Target, Vector }
            // TODO: Client which determines what combo to do

            var comboClient = new ActionClient <Action>(
                new HighestScoreWinsSelector <Action>(
                    new List <IQualifier <Action> >
            {
                new SpellQualifier <Action>(
                    new List <IScorer>
                {
                    new SpellStateScorer(new SpellStateConfiguration {
                        ReadyScore = 1
                    }, ireliaQ),
                    new BinaryScorer(new BinaryScorerConfiguration(1, 0),
                                     () => qUnitProvider.Get() != default(IUnit))
                },
                    new List <IScorer>
                {
                    // Damage { Done, Overkill, Team damage, Burst }, Movement { Inside skillshots, dodge, in enemies, away from enemies }, Health { Health after, Health before }
                    // Cooldown { Reset or too high }, Does it get me closer to valuable targets (lowlife, high prio), Is the enemy using a movement spell or more abstract,
                    // is the predicted enemy position far away or coming towards me, can I cancel abilities animations with it, does the new position favor other spells
                    // Does it proc AOE effects, such as Tiamat
                },
                    () => ireliaQ.Cast(qUnitProvider.Get())),
                new SpellQualifier <Action>(
                    new List <IScorer>
                {
                    new SpellStateScorer(new SpellStateConfiguration {
                        ReadyScore = 1
                    }, ireliaQ)
                },
                    new List <IScorer>
                {
                    // Damage { Done, Overkill, Team damage, Burst }, Health { Health after, Health before }, Cooldown { Reset or too high }, Enemies in range || path given,
                    // Can I cancel abilities animations with it
                },
                    () => ireliaW.Cast()),
                new SpellQualifier <Action>(
                    new List <IScorer>
                {
                    new SpellStateScorer(new SpellStateConfiguration {
                        ReadyScore = 1
                    }, ireliaQ)
                },
                    new List <IScorer>
                {
                    // Damage { Done, Overkill, Team damage, Burst }, Health { Health after, Health before }, Cooldown { Reset or too high }, Enemies in range || path given,
                    // Can I cancel abilities animations with it
                },
                    () => ireliaE.Cast(eUnitProvider.Get())),
                new SpellQualifier <Action>(
                    new List <IScorer>
                {
                    new SpellStateScorer(new SpellStateConfiguration {
                        ReadyScore = 1
                    }, ireliaQ)
                },
                    new List <IScorer>
                {
                    // Damage { Done, Overkill, Team damage, Burst }, Health { Health after, Health before }, Cooldown { Reset or too high }, Enemies in range || path given,
                    // Can I cancel abilities animations with it
                },
                    () => ireliaR.Cast(rVecProvider.Get())),
            }
                    ),
                action => action.Invoke());

            // TODO: Determine when to do Combo etc, through keys.

            // Fires the combo engine
            this.Api.Events.OnGameUpdate += (sender, args) => comboClient.Tick();

            // Resets the cache
            cacheFactory.Reset();
        }