예제 #1
0
    public static Minion SummonMinion(string laneGuid, int attack, int defense, string name, MinionBuilder builder)
    {
        Lane lane = GameState.GetLane(laneGuid);
        if (lane != null)
        {
            if (builder == null) {
                builder = new MinionBuilder();
            }

            Minion minion = new Minion()
            {
                Name = name,

                InitialAttack = attack,
                InitialDurability = defense,

                Defensive = builder.Defensive,
                Protect = builder.Protect,
                Scrounge = builder.Scrounge,
                OnFire = builder.OnFire,
                Blitz = builder.Blitz,
                Hazmat = builder.Hazmat,
                LaneDamage = builder.LaneDamage,

                GUID = Guid.NewGuid().ToString(),
                MorphidGUID = GameState.ActiveMorphid.GUID
            };

            lane.Minions = lane.Minions.
                Where(x => x.MorphidGUID != minion.MorphidGUID).
                Concat(new Minion[1] {minion}).
                ToArray();

            GameStateWatcher.OnMinionSpawn(minion);
            minion.OnSpawn();

            return minion;
        }
        return null;
    }