Exemplo n.º 1
0
        public void NotifyMinionSpawned(IMinion m, TeamId team)
        {
            var ms = new MinionSpawn(_navGrid, m);

            _packetHandlerManager.BroadcastPacketTeam(team, ms, Channel.CHL_S2C);
            NotifySetHealth(m);
        }
Exemplo n.º 2
0
 protected Deuce(IMinion ns, IMinion ne, double noteLength)
 {
     this.ns         = ns;
     this.ne         = ne;
     this.noteLength = noteLength;
     this.state      = 1;
 }
Exemplo n.º 3
0
 private void RemoveMinionAura(IMinion minion)
 {
     foreach (var m in PlayedMinions)
     {
         m.RemoveAura(minion);
     }
 }
Exemplo n.º 4
0
        public void Buff(IMinion buffer, IMinion minion, int attack = 0, int health = 0, Attribute attributes = Attribute.None, Action <TriggerParams> deathRattle = null, bool aura = false)
        {
            int amount = buffer?.Level ?? 1;

            attack *= amount;
            health *= amount;

            if (!aura)
            {
                minion.Attack     += attack;
                minion.Health     += health;
                minion.Attributes |= attributes;
            }
            else
            {
                minion.AddAura(buffer, new Buff()
                {
                    Attack = attack, Health = health, Attribute = attributes
                });
            }

            if (deathRattle != null)
            {
                minion.Keywords |= Keywords.DeathRattle;
                minion.OnDeath  += deathRattle;
            }
        }
Exemplo n.º 5
0
        public void Attack(Board defenderBoard)
        {
            IMinion attackingMinion = GetNextAttacker();

            if (attackingMinion.Attack == 0)
            {
                return;
            }

            int attacks = attackingMinion.Attributes.HasFlag(Attribute.WindFury) ? 2 : 1;

            for (int i = 0; i < attacks; i++)
            {
                IMinion defendingMinion = defenderBoard.GetRandomDefender();

                if (defendingMinion == null)
                {
                    break;
                }

                Console.WriteLine(string.Format(@"{0} {1} Is Attacking {2} {3}", Player.Name, attackingMinion.ToString(), defenderBoard.Player.Name, defendingMinion.ToString()));

                MinionAttack(attacker: attackingMinion, defender: defendingMinion, defenderBoard);
            }
        }
Exemplo n.º 6
0
 protected override void OnKillEnemyMinion(IMinion minion)
 {
     if (minion.Buffs.GetBuff(MinionBuffs.HuntersMark) != null)
     {
         this.Promote();
     }
 }
Exemplo n.º 7
0
        /// <summary>
        ///     Return the starttick of the attacking turret.
        /// </summary>
        /// <param name="minion">
        ///     The minion.
        /// </param>
        /// <returns>
        ///     The <see cref="bool" />
        /// </returns>
        public static int TurretAggroStartTick(IMinion minion)
        {
            var activeTurret =
                ActiveAttacks.Values.FirstOrDefault(m => m.Source is ITurret && m.Target.Compare(minion));

            return(activeTurret?.StartTick ?? 0);
        }
Exemplo n.º 8
0
		private void Tock (Object state)
		{
			List<IMinion> toDo = new List<IMinion> ();
			lock (this.capsules) {
				long t = tick++;
				if (capsules.Count == 0)
					return;
				ICapsule c = capsules.GetFirst ();
				IMinion m = c.GetReadiedMinion (t);
				while (m != null) {
					Console.WriteLine ("{0}\t Playing: {1}", t, m);
					capsules.Remove (c);
					if (t == 24) {
						Console.WriteLine ("----- Popped: {0} {1}", c.GetTicksToStart (), capsules);

					}
					if (!c.CanDispose ()) {
						// Sorted to the new start tick
						capsules.Add (c);
					}

					if (t == 24) {
						Console.WriteLine ("------ Reorg: {0} {1}", c.GetTicksToStart (), capsules);

					}
					toDo.Add (m);
					if (capsules.Count == 0)
						break;
					c = capsules.GetFirst ();
					m = c.GetReadiedMinion (t);
				}
			}
			//taskMaster.Invoke (toDo);
		}
Exemplo n.º 9
0
        public void MarchingMinionsTest()
        {
            ICapsule notes = BigCapsule.GetMarchingMinions(0,
                                                           Note.GetNote(Note.Pitch.A4, 4, 85),
                                                           Note.GetNote(Note.Pitch.B4, 8, 100));

            Assert.AreEqual(36, notes.GetTicksToComplete(), "Ticks to complete");
            IMinion onNote1 = notes.GetReadiedMinion(0);

            Assert.AreEqual(24, onNote1.TicksToComplete());
            Assert.IsFalse(notes.CanDispose());
            IMinion offNote1 = notes.GetReadiedMinion(24);

            Assert.AreEqual(0, offNote1.TicksToComplete());
            Assert.IsFalse(notes.CanDispose());
            Assert.AreEqual(12, notes.GetTicksToComplete(), "Ticks to complete");
            IMinion onNote2 = notes.GetReadiedMinion(24);

            Assert.AreEqual(12, onNote2.TicksToComplete());
            Assert.IsFalse(notes.CanDispose());
            IMinion offNote2 = notes.GetReadiedMinion(36);

            Assert.AreEqual(0, offNote2.TicksToComplete());
            Assert.IsTrue(notes.CanDispose());
        }
Exemplo n.º 10
0
        private void RemoveAuras(IMinion minion)
        {
            RemoveMinionAura(minion);

            if (BoardAuras.ContainsKey(minion))
            {
                BoardAuras.Remove(minion);
            }
        }
Exemplo n.º 11
0
        public void CleaveAttack(IMinion activator, IMinion target)
        {
            var adjacent = GetAdjacentMinions(target);

            foreach (var minion in adjacent)
            {
                MinionTakeDamage(minion, activator.Attack);
            }
        }
Exemplo n.º 12
0
        public void BuffAdjacent(IMinion minion, int attack, int health, Attribute attributes)
        {
            var adjacents = GetAdjacentMinions(minion);

            foreach (var adj in adjacents)
            {
                Buff(adj, attack, health, attributes);
            }
        }
        public void OnFinishCasting(IObjAiBase owner, ISpell spell, IAttackableUnit target)
        {
            var castrange    = spell.SpellData.CastRange[0];
            var apbonus      = owner.Stats.AbilityPower.Total * 0.2f;
            var damage       = 35 + ((15 * (spell.Level - 1)) + apbonus); //TODO: Should replace minion AA damage
            var jackduration = 5.0f;                                      //TODO: Split into Active duration and Hidden duration when Invisibility is implemented
            var attspeed     = 1 / 1.8f;                                  // 1.8 attacks a second = ~.56 seconds per attack, could not extrapolate from minion stats
            //TODO: Implement Fear buff and ShacoBoxSpell
            //var fearrange = 300;
            var fearduration = 0.5f + (0.25 * (spell.Level - 1));
            var ownerPos     = new Vector2(owner.X, owner.Y);
            var spellPos     = new Vector2(spell.X, spell.Y);

            if (owner.WithinRange(ownerPos, spellPos, castrange))
            {
                IMinion m = AddMinion((IChampion)owner, "ShacoBox", "ShacoBox", spell.X, spell.Y);
                AddParticle(owner, "JackintheboxPoof.troy", spell.X, spell.Y);

                var attackrange = m.Stats.Range.Total;

                if (m.IsVisibleByTeam(owner.Team))
                {
                    if (!m.IsDead)
                    {
                        var units = GetUnitsInRange(m, attackrange, true);
                        foreach (var value in units)
                        {
                            if (owner.Team != value.Team && value is IAttackableUnit && !(value is IBaseTurret) && !(value is IObjAnimatedBuilding))
                            {
                                //TODO: Change TakeDamage to activate on Jack AutoAttackHit, not use CreateTimer, and make Pets use owner spell stats
                                m.SetTargetUnit(value);
                                m.AutoAttackTarget          = value;
                                m.AutoAttackProjectileSpeed = 1450;
                                m.AutoAttackHit(value);
                                for (petTimeAlive = 0.0f; petTimeAlive < jackduration; petTimeAlive += attspeed)
                                {
                                    CreateTimer(petTimeAlive, () => {
                                        if (!value.IsDead && !m.IsDead)
                                        {
                                            value.TakeDamage(owner, damage, DamageType.DAMAGE_TYPE_MAGICAL, DamageSource.DAMAGE_SOURCE_SPELL, false);
                                        }
                                    });
                                }
                            }
                        }
                        CreateTimer(jackduration, () =>
                        {
                            if (!m.IsDead)
                            {
                                m.Die(m); //TODO: Fix targeting issues
                            }
                        });
                    }
                }
            }
        }
Exemplo n.º 14
0
        public void Remove(IMinion defendingMinion)
        {
            int i = PlayedMinions.IndexOf(defendingMinion);

            if (i < NextAttacker)
            {
                NextAttacker--;
            }
            PlayedMinions.Remove(defendingMinion);
        }
Exemplo n.º 15
0
 private void OnMinionTookDamage(IMinion tookDamage)
 {
     foreach (var minion in PlayedMinions.Where(m => m != tookDamage))
     {
         minion.OnMinionDamaged(new TriggerParams()
         {
             Activator = minion, Board = this, Target = tookDamage
         });
     }
 }
Exemplo n.º 16
0
 private void OnMinionLostDivineShield(IMinion lostDivine)
 {
     foreach (var minion in PlayedMinions)
     {
         minion.OnMinionLostDivineShield(new TriggerParams()
         {
             Activator = minion, Board = this, Target = lostDivine
         });
     }
 }
Exemplo n.º 17
0
 private void OnMinionAttacked(IMinion attacker)
 {
     foreach (var minion in PlayedMinions)
     {
         minion.OnMinionAttacked(new TriggerParams()
         {
             Activator = minion, Board = this, Target = attacker
         });
     }
 }
Exemplo n.º 18
0
 private void OnMinionSummon(IMinion summoned, int index)
 {
     foreach (IMinion minion in PlayedMinions)
     {
         minion.OnMinionSummon(new TriggerParams()
         {
             Activator = minion, Index = index, Summon = summoned, Board = this, Player = Player
         });
     }
 }
Exemplo n.º 19
0
 private void OnMinionDied(IMinion deadMinion, Board defenderBoard)
 {
     foreach (var minion in PlayedMinions.Where(m => m != deadMinion))
     {
         minion.OnMinionDied(new TriggerParams()
         {
             Activator = minion, Target = deadMinion, Board = this, RivalBoard = defenderBoard
         });
     }
 }
Exemplo n.º 20
0
        public void Invoke(IMinion minion)
        {
            IMidiMinion m = minion as IMidiMinion;

            if (m != null)
            {
                byte[] juices = m.ExtractJuices(0);
                output.SendAsync(juices, 0, 3, 0);
            }
        }
Exemplo n.º 21
0
 public void BuffAllWithAttribute(IMinion buffer, Attribute attribute, int attack, int health, bool aura = false)
 {
     foreach (var minion in PlayedMinions)
     {
         if (minion.Attributes.HasFlag(attribute))
         {
             Buff(buffer, minion, attack, health, aura: aura);
         }
     }
 }
Exemplo n.º 22
0
 public void BuffAllOfType(IMinion buffer, MinionType type, int attack = 0, int health = 0, Attribute attributes = Attribute.None, Action <TriggerParams> deathRattle = null, bool aura = false)
 {
     foreach (var minion in PlayedMinions.Where(m => m != buffer))
     {
         if ((type & minion.MinionType) != 0)
         {
             Buff(buffer, minion, attack, health, attributes, deathRattle, aura);
         }
     }
 }
Exemplo n.º 23
0
        public void Buff(IMinion minion, int attack = 0, int health = 0, Attribute attributes = Attribute.None, Action <TriggerParams> deathRattle = null)
        {
            minion.Attack     += attack;
            minion.Health     += health;
            minion.Attributes |= attributes;

            if (deathRattle != null)
            {
                minion.OnDeath += deathRattle;
            }
        }
Exemplo n.º 24
0
 void MinionStep(IMinion minion)
 {
     if (minion.Owner.Side == HeroSide.Top)
     {
         SetState(WellSwitchState.Top);
     }
     else
     {
         SetState(WellSwitchState.Bottom);
     }
 }
Exemplo n.º 25
0
        public void BuffRandom(IMinion buffer, int attack = 0, int health = 0, Attribute attributes = Attribute.None, MinionType type = MinionType.All)
        {
            var buffee = GetRandomMinion(type);

            if (buffee == null)
            {
                return;
            }

            Buff(buffer, buffee, attack, health, attributes);
        }
Exemplo n.º 26
0
        public static bool IsJungleBuff(this IMinion minion)
        {
            switch (minion.CharName)
            {
            case "SRU_Blue":
            case "SRU_Red":
                return(true);

            default:
                return(false);
            }
        }
Exemplo n.º 27
0
        public void NoteOnAndOffTest()
        {
            Assert.AreEqual(24, this.note.GetTicksToComplete(), "Ticks to complete");
            IMinion onNote = this.note.GetReadiedMinion(0);

            Assert.AreEqual(24, onNote.TicksToComplete());
            Assert.IsFalse(this.note.CanDispose());
            IMinion offNote = this.note.GetReadiedMinion(24);

            Assert.AreEqual(0, offNote.TicksToComplete());
            Assert.IsTrue(this.note.CanDispose());
        }
Exemplo n.º 28
0
    public void Initialize(IMinion minion)
    {
        this.minion = minion;

        collider        = this.GetComponentStrict <BoxCollider2D>();
        collisionFilter = new ContactFilter2D();
        var layerMask = new LayerMask();

        layerMask.value |= 1 << 8;
        collisionFilter.SetLayerMask(layerMask);
        collisionFilter.useTriggers = true;
    }
Exemplo n.º 29
0
        private void OnMinionDied(IMinion deadMinion)
        {
            for (int i = 0; i < PlayedMinions.Count; i++)
            {
                PlayedMinions[i].OnMinionDied(new TriggerParams()
                {
                    Activator = PlayedMinions[i], Target = deadMinion, Board = this, RivalBoard = RivalBoard
                });
            }

            RivalBoard.ClearDeaths();
        }
Exemplo n.º 30
0
 public void Play(IMinion minion, int index = 0, IMinion target = null)
 {
     OnMinionSummon(minion, index);
     PlayedMinions.Insert(index, minion);
     for (int j = 0; j < minion.Level; j++)
     {
         minion.OnPlayed(new TriggerParams()
         {
             Activator = minion, Index = index, Target = target, Board = this, Player = Player
         });
     }
 }