Esempio n. 1
0
 public void InteractWithNoble(Noble noble)
 {
     if (noble.currentWish == HoldableObject.LETTER)
     {
         DeactivateAllSprites();
         longTask    = new LongTask(letter, HoldableObject.LETTER, UnityEngine.Random.Range(1.0f, 2.0f));
         objectOwner = noble;
         progressBarBack.SetActive(true);
     }
     else if (objectInHand == noble.currentWish && noble.currentWish != HoldableObject.LETTER)
     {
         Debug.Log("Je suis content ! Merci");
         DeactivateAllSprites();
         objectInHand = HoldableObject.NONE;
         longTask     = null;
         noble.FulfillWish();
     }
     else if (objectInHand == HoldableObject.POISONED_TEA)
     {
         Debug.Log("AaAahHh ! C'est du poison !! Salaud !!");
         DeactivateAllSprites();
         objectInHand = HoldableObject.NONE;
         longTask     = null;
         noble.Poison(this);
     }
     else
     {
         Debug.Log("Gardes, débarassez moi de cet incompétent !");
         DeactivateAllSprites();
         objectInHand = HoldableObject.NONE;
         noble.FailWish();
         longTask = null;
     }
 }
Esempio n. 2
0
    //private string[] neighbours;

    //public Noble lastOwnerKnown { get; private set; }
    //public bool commodityKnown { get; private set; }

    public Province(string name, ProvinceScript pS, Commodity c, Noble o)
    {
        provinceName = name;
        provinceScript = pS;
        commodity = c;
        owner = o;
        //MakeNeighbours();
    }
Esempio n. 3
0
 public void SetOwnership(Noble n)
 {
     if (owner != null)
     {
         owner.Unclaim(this);
     }
     owner = n;
     //if (owner.playerControlled) Scout();
 }
Esempio n. 4
0
        public void CalculatesPrestigeWithTakenNobles()
        {
            uint noblePrestige = 2;

            var noble = new Noble(noblePrestige, new NobleCost());

            _sut.TakeNoble(noble);

            Assert.AreEqual(_sut.Prestige, noblePrestige);
        }
Esempio n. 5
0
        private static string ShowNoble(Noble noble)
        {
            var builder = new StringBuilder($"ID: {noble.Id}, Name: {noble.Name}, Points: {noble.PointValue}, Requirements: ");

            foreach (var item in noble.Requirements)
            {
                builder.Append($"{item.Key}={item.Value}, ");
            }
            return(builder.ToString());
        }
Esempio n. 6
0
        public override void AddComponents()
        {
            Visible = false;
            AddItem(new Static(0x10ee), 0, 0, 0);
            AddItem(new Static(0xfac), 0, 6, 0);

            switch (Utility.Random(3))
            {
            case 0:
            {
                AddItem(new Item(0xDE3), 0, 6, 0);         // Campfire
                AddItem(new Item(0x974), 0, 6, 1);         // Cauldron
                break;
            }

            case 1:
            {
                AddItem(new Item(0x1E95), 0, 6, 1);         // Rabbit on a spit
                break;
            }

            default:
            {
                AddItem(new Item(0x1E94), 0, 6, 1);         // Chicken on a spit
                break;
            }
            }

            AddItem(new Item(0x41F), 5, 5, 0); // Gruesome Standart South

            AddCampChests();

            for (int i = 0; i < 4; i++)
            {
                AddMobile(Ratmen, Utility.RandomMinMax(-7, 7), Utility.RandomMinMax(-7, 7), 0);
            }

            switch (Utility.Random(2))
            {
            case 0:
                Prisoner = new Noble();
                break;

            default:
                Prisoner = new SeekerOfAdventure();
                break;
            }

            Prisoner.IsPrisoner = true;
            Prisoner.CantWalk   = true;

            Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);
            AddMobile(Prisoner, Utility.RandomMinMax(-2, 2), Utility.RandomMinMax(-2, 2), 0);
        }
Esempio n. 7
0
    public void setValues(Noble n)
    {
        this.name         = n.name;
        this.pointsReward = n.pointsReward;

        this.ruby     = n.ruby;
        this.sapphire = n.sapphire;
        this.diamond  = n.diamond;
        this.emerald  = n.emerald;
        this.onyx     = n.onyx;

        SetNobleData();
    }
Esempio n. 8
0
    void GenerateNobles()
    {
        for (int i = 0; i < 5; i++)
        {
            GameObject n_temp = Instantiate(noble_prefab) as GameObject;
            n_temp.transform.SetParent(noble_go.transform.GetChild(i).transform);
            n_temp.transform.position = n_temp.transform.parent.position;

            Noble n = nobles[Random.Range(0, nobles.Count)];
            n_temp.GetComponent <NobleDisplay>().setValues(n);

            nobles.Remove(n);
        }
    }
Esempio n. 9
0
 void LoadNobles(TextAsset ta)
 {
     string[] data = ta.text.Split(new char[] { '\n' });
     for (int i = 1; i < data.Length - 1; i++)
     {
         string[] row = data[i].Split(new char[] { ',' });
         Noble    n   = ScriptableObject.CreateInstance(typeof(Noble)) as Noble;
         n.name = row[0];
         int.TryParse(row[1], out n.pointsReward);
         int.TryParse(row[2], out n.ruby);
         int.TryParse(row[3], out n.sapphire);
         int.TryParse(row[4], out n.diamond);
         int.TryParse(row[5], out n.emerald);
         int.TryParse(row[6], out n.onyx);
         nobles.Add(n);
     }
 }
Esempio n. 10
0
    public void updateListItem(GameObject[] nobles)
    {
        int taskIndex = 0;

        for (int i = 0; i < nobles.Length; i++)
        {
            Noble noble = nobles[i].GetComponent <Noble>();
            if (!noble.currentWish.Equals(HoldableObject.NONE))
            {
                Text taskText = tasksList[taskIndex].GetComponent <Text>();
                if (taskIndex == TASK_LIST_SIZE - 1)
                {
                    taskText.text = "And more ...";
                    return;
                }
                taskText.text = GetTextFromWish(noble.currentWish);
                taskIndex++;
            }
        }
    }
Esempio n. 11
0
 public void SetUp()
 {
     _sut = new Noble(3, new TokenCollection(white, black, blue));
 }
Esempio n. 12
0
        public override void AddComponents()
        {
            IronGate gate = new IronGate(DoorFacing.EastCCW);

            m_Gate = gate;

            gate.KeyValue = Key.RandomValue();
            gate.Locked   = true;

            AddItem(gate, -2, 1, 0);
            AddCampChests();

            //UOSI x= -2 puts these guys in the cage. I removed the - from all the 2's in this switch statement. They were all -2.
            //Wander ranges increased.
            //Added camp type setter.
            if (m_CampType == 4)
            {
                m_CampType = Utility.Random(4);
            }

            switch (m_CampType)
            {
            case 0:
            {
                AddMobile(new Orc(), 2, 2, 0, 0);
                AddMobile(new OrcishMage(), 2, 1, 0, 0);
                AddMobile(new OrcishLord(), 2, 2, 0, 0);
                AddMobile(new OrcCaptain(), 2, 1, 0, 0);
                AddMobile(new Orc(), 2, -1, 0, 0);
                AddMobile(new OrcChopper(), 2, 2, 0, 0);
                Camp = CampType.Orc;
            } break;

            case 1:
            {
                AddMobile(new Ratman(), 2, 2, 0, 0);
                AddMobile(new Ratman(), 2, 1, 0, 0);
                AddMobile(new RatmanMage(), 2, 2, 0, 0);
                AddMobile(new Ratman(), 2, 1, 0, 0);
                AddMobile(new RatmanArcher(), 2, -1, 0, 0);
                AddMobile(new Ratman(), 2, 2, 0, 0);
                Camp = CampType.Ratman;
            } break;

            case 2:
            {
                AddMobile(new Lizardman(), 2, 2, 0, 0);
                AddMobile(new Lizardman(), 2, 1, 0, 0);
                AddMobile(new Lizardman(), 2, 2, 0, 0);
                AddMobile(new Lizardman(), 2, 1, 0, 0);
                AddMobile(new Lizardman(), 2, -1, 0, 0);
                AddMobile(new Lizardman(), 2, 2, 0, 0);
                Camp = CampType.Lizardman;
            } break;

            case 3:
            {
                AddMobile(new Brigand(), 2, 2, 0, 0);
                AddMobile(new Brigand(), 2, 1, 0, 0);
                AddMobile(new Brigand(), 2, 2, 0, 0);
                AddMobile(new Brigand(), 2, 1, 0, 0);
                AddMobile(new Brigand(), 2, -1, 0, 0);
                AddMobile(new Brigand(), 2, 2, 0, 0);
                Camp = CampType.Brigand;
            } break;
            }

            //UOSI - added 'this' to the constructor for these two, which SHOULD flag them as camp prisoners.
            switch (Utility.Random(2))
            {
            case 0: Prisoner = new Noble(this); break;

            case 1: Prisoner = new SeekerOfAdventure(this); break;
            }

            //Prisoner.IsPrisoner = true;
            Prisoner.CantWalk = true;


            Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);
            //UOSI - Switched his wander range for his xOffset so he'll appear in the cage
            AddMobile(Prisoner, 0, -2, 0, 0);
        }
Esempio n. 13
0
        public override void AddComponents()
        {
            IronGate gate = new IronGate(DoorFacing.EastCCW);

            m_Gate = gate;

            gate.KeyValue = Key.RandomValue();
            gate.Locked   = true;

            AddItem(gate, -2, 1, 0);
            AddCampChests();

            switch (Utility.Random(4))
            {
            case 0:
            {
                AddMobile(new Orc(), 0, -2, 0);
                AddMobile(new OrcishMage(), 0, 1, 0);
                AddMobile(new OrcishLord(), 0, -2, 0);
                AddMobile(new OrcCaptain(), 0, 1, 0);
                AddMobile(new Orc(), 0, -1, 0);
                AddMobile(new OrcChopper(), 0, -2, 0);
            }
            break;

            case 1:
            {
                AddMobile(new Ratman(), 0, -2, 0);
                AddMobile(new Ratman(), 0, 1, 0);
                AddMobile(new RatmanMage(), 0, -2, 0);
                AddMobile(new Ratman(), 0, 1, 0);
                AddMobile(new RatmanArcher(), 0, -1, 0);
                AddMobile(new Ratman(), 0, -2, 0);
            }
            break;

            case 2:
            {
                AddMobile(new Lizardman(), 0, -2, 0);
                AddMobile(new Lizardman(), 0, 1, 0);
                AddMobile(new Lizardman(), 0, -2, 0);
                AddMobile(new Lizardman(), 0, 1, 0);
                AddMobile(new Lizardman(), 0, -1, 0);
                AddMobile(new Lizardman(), 0, -2, 0);
            }
            break;

            case 3:
            {
                AddMobile(new Brigand(), 0, -2, 0);
                AddMobile(new Brigand(), 0, 1, 0);
                AddMobile(new Brigand(), 0, -2, 0);
                AddMobile(new Brigand(), 0, 1, 0);
                AddMobile(new Brigand(), 0, -1, 0);
                AddMobile(new Brigand(), 0, -2, 0);
            }
            break;
            }

            switch (Utility.Random(2))
            {
            case 0: Prisoner = new Noble(); break;

            case 1: Prisoner = new SeekerOfAdventure(); break;
            }

            Prisoner.IsPrisoner = true;
            Prisoner.CantWalk   = true;

            Prisoner.YellHue = Utility.RandomList(0x57, 0x67, 0x77, 0x87, 0x117);
            AddMobile(Prisoner, -2, 0, 0);
        }
Esempio n. 14
0
 public void CompleteActiveTask(Noble noble)
 {
     AngryCrowdManager.INSTANCE.addPeasants();
     Debug.Log("Task fullfilled!");
 }
Esempio n. 15
0
 public void FailedActiveTask(Noble noble)
 {
     noble.OrderToKillClosestServant();
     Debug.Log("Task failed!");
 }
Esempio n. 16
0
        public void PlayTurn(Game game)
        {
            ShowGame(game);
            Console.WriteLine($"{game.CurrentPlayer.Name}'s turn");
            Console.WriteLine(ShowPlayer(game.CurrentPlayer));

            while (true)
            {
                Console.WriteLine("Select an action: ");
                Console.WriteLine("3) Take 0-3 distinct gems");
                Console.WriteLine("2) Take two gems of a kind, minimum 4");
                Console.WriteLine("r) Reserve card");
                Console.WriteLine("s) Reserve secret card");
                Console.WriteLine("p) Purchase");

                var key = Console.ReadKey();
                switch (key.KeyChar)
                {
                case '3':
                    Console.WriteLine("Select the disk types with no spaces: (d)iamond, (s)apphire, (e)merald, (r)uby, (o)nyx");
                    var input = Console.ReadLine();
                    var types = new List <GemType>(3);
                    for (int i = 0; i < input.Length; i++)
                    {
                        if (!TryLookupUpGemType(input[i], out var type))
                        {
                            Console.WriteLine($"'{input[i]}' is not a gem type.");
                            continue;
                        }
                        // Not gold
                        if (type == GemType.Gold)
                        {
                            Console.WriteLine("Gold cannot be selected.");
                            continue;
                        }
                        types.Add(type);
                    }

                    // Distinct types
                    if (types.Distinct().Count() < types.Count)
                    {
                        Console.WriteLine("Types must be unique.");
                        continue;
                    }

                    // 0-3 count
                    if (types.Count > 3)
                    {
                        Console.WriteLine("Too many types selected.");
                        continue;
                    }

                    // At least one exists in the bank
                    foreach (var disk in types)
                    {
                        if (game.Board.Bank.Available[disk] == 0)
                        {
                            Console.WriteLine($"No {disk} in the bank.");
                            continue;
                        }
                    }

                    // If this would put you over 10, discard
                    IEnumerable <KeyValuePair <GemType, int> > discards = null;
                    var toDiscard = game.CurrentPlayer.TotalDisks + types.Count - 10;
                    if (toDiscard > 0)
                    {
                        Console.WriteLine($"Select {toDiscard} disk(s) to discard.");
                        input = Console.ReadLine();
                        var discardTypes = new List <GemType>(toDiscard);
                        for (int i = 0; i < input.Length; i++)
                        {
                            if (!TryLookupUpGemType(input[i], out var discardSelection))
                            {
                                Console.WriteLine($"'{input[i]}' is not a gem type.");
                                break;
                            }
                            discardTypes.Add(discardSelection);
                        }
                        if (discardTypes.Count != input.Length)
                        {
                            continue;
                        }

                        if (discardTypes.Count != toDiscard)
                        {
                            Console.WriteLine("Wrong number of disks discarded.");
                            continue;
                        }

                        discards = discardTypes.GroupBy(t => t).Select(group => new KeyValuePair <GemType, int>(group.Key, group.Count()));
                    }

                    game.TakeDistinctGems(types, discards);
                    return;

                case '2':
                    Console.WriteLine("Select the disk type: (d)iamond, (s)apphire, (e)merald, (r)uby, (o)nyx");
                    input = Console.ReadLine();
                    if (input.Length != 1)
                    {
                        Console.WriteLine("Only enter one character.");
                        continue;
                    }

                    if (!TryLookupUpGemType(input[0], out var selection))
                    {
                        Console.WriteLine($"'{input[0]}' is not a gem type.");
                        continue;
                    }
                    // Not gold
                    if (selection == GemType.Gold)
                    {
                        Console.WriteLine("Gold cannot be selected.");
                        continue;
                    }

                    // At least 4 of that type exist in the bank
                    if (game.Board.Bank.Available[selection] < 4)
                    {
                        Console.WriteLine($"The bank must have at least for disks of that type to take two.");
                        continue;
                    }

                    // If this would put you over 10, discard
                    discards  = null;
                    toDiscard = game.CurrentPlayer.TotalDisks + 2 - 10;
                    if (toDiscard > 0)
                    {
                        Console.WriteLine($"Select {toDiscard} disk(s) to discard.");
                        input = Console.ReadLine();
                        var discardTypes = new List <GemType>(toDiscard);
                        for (int i = 0; i < input.Length; i++)
                        {
                            if (!TryLookupUpGemType(input[i], out var discardSelection))
                            {
                                Console.WriteLine($"'{input[i]}' is not a gem type.");
                                break;
                            }
                            discardTypes.Add(discardSelection);
                        }
                        if (discardTypes.Count != input.Length)
                        {
                            continue;
                        }

                        if (discardTypes.Count != toDiscard)
                        {
                            Console.WriteLine("Wrong number of disks discarded.");
                            continue;
                        }

                        discards = discardTypes.GroupBy(t => t).Select(group => new KeyValuePair <GemType, int>(group.Key, group.Count()));
                    }

                    game.TakeTwoGems(selection, discards);
                    return;

                case 'r':
                    // Verify reserve limit (3)
                    if (game.CurrentPlayer.Reserve.Count == 3)
                    {
                        Console.WriteLine($"Too many cards already reserved.");
                        continue;
                    }

                    Console.Write("Enter the card Id to reserve: ");
                    input = Console.ReadLine();

                    // Verify card available
                    if (game.Board.AvailableCards.Where(c => c.Id == input).SingleOrDefault() == null)
                    {
                        Console.WriteLine($"Card id {input} not found.");
                        continue;
                    }

                    // Check if at disk limit 10 and must discard (if there's gold left)
                    GemType?discardType = null;
                    if (game.Board.Bank.Available[GemType.Gold] > 0 && game.CurrentPlayer.TotalDisks == 10)
                    {
                        Console.WriteLine($"Select 1 disk to discard.");
                        input = Console.ReadLine();
                        if (input.Length != 1)
                        {
                            Console.WriteLine("Wrong number of disks discarded.");
                            continue;
                        }

                        if (!TryLookupUpGemType(input[0], out var type))
                        {
                            Console.WriteLine($"'{input[0]}' is not a gem type.");
                            continue;
                        }
                        discardType = type;
                    }

                    game.ReserveCard(input, discardType);
                    return;

                case 's':
                    // Verify reserve limit (3)
                    if (game.CurrentPlayer.Reserve.Count == 3)
                    {
                        Console.WriteLine($"Too many cards already reserved.");
                        continue;
                    }

                    Console.Write("Enter the card level to reserve: ");
                    input = Console.ReadLine();
                    var level = int.Parse(input);

                    // Verify level 1-3
                    if (level < 1 || level > 3)
                    {
                        Console.WriteLine("Invlaid level selected.");
                        continue;
                    }

                    // Verify level has cards
                    if (game.Board.CheckLevelDeckIsEmpty(level))
                    {
                        Console.WriteLine($"Level {level} deck is empty.");
                        continue;
                    }

                    // Check if at disk limit 10 and must discard (if there's gold left)
                    discardType = null;
                    if (game.Board.Bank.Available[GemType.Gold] > 0 && game.CurrentPlayer.TotalDisks == 10)
                    {
                        Console.WriteLine($"Select 1 disk to discard.");
                        input = Console.ReadLine();
                        if (input.Length != 1)
                        {
                            Console.WriteLine("Wrong number of disks discarded.");
                            continue;
                        }

                        if (!TryLookupUpGemType(input[0], out var type))
                        {
                            Console.WriteLine($"'{input[0]}' is not a gem type.");
                            continue;
                        }
                        discardType = type;
                    }

                    game.ReserveSecret(level, discardType);
                    return;

                case 'p':
                    Console.Write("Enter the card id to purchase, this may be from the available or your reserve: ");
                    input = Console.ReadLine();

                    // Is this available or in my reserve
                    var card = game.Board.AvailableCards.Where(c => c.Id == input).SingleOrDefault()
                               ?? game.CurrentPlayer.Reserve.Where(c => c.Id == input).SingleOrDefault();
                    if (card == null)
                    {
                        Console.WriteLine($"Card id {input} not found.");
                        continue;
                    }

                    // Can I afford it
                    if (!Utilities.CanAfford(card.Cost, game.CurrentPlayer.TotalGems))
                    {
                        Console.WriteLine($"Cannot afford card id {input}.");
                        continue;
                    }

                    // Does this earn me a noble
                    var nobles = game.Board.Nobles.Where(n =>
                                                         Utilities.WillRequirementsBeMet(n.Requirements, game.CurrentPlayer.Bonuses, card.Bonus));

                    // Do I have the choice of multiple nobles? If so which one do I want?
                    Noble noble = nobles.FirstOrDefault();
                    if (nobles.Count() > 1)
                    {
                        Console.WriteLine("Select a noble id:");
                        foreach (var n in nobles)
                        {
                            Console.WriteLine(ShowNoble(n));
                        }
                        var nobleId = input = Console.ReadLine();
                        noble = nobles.Where(n => n.Id == nobleId).FirstOrDefault();
                    }

                    game.Purchase(input, noble);
                    return;

                default:
                    Console.WriteLine($"Invalid input '{key.KeyChar}'");
                    continue;
                }
            }

            throw new NotImplementedException();
        }
Esempio n. 17
0
 public BuyDevelopment(Development development, Noble noble) : base(noble)
 {
     Development = development;
 }
Esempio n. 18
0
        private string generateBackground()
        {
            //TODO need a method to resolve conflicts between things selected in background and class and race (optimize)
            string background   = "";
            int    randomNumber = NumberGen.gen(18);

            if (randomNumber == 0)
            {
                background          = "Acolyte";
                characterBackground = new Acolyte();
            }
            else if (randomNumber == 1)
            {
                background          = "Charlatan";
                characterBackground = new Charlatan();
            }
            else if (randomNumber == 2)
            {
                background          = "Criminal";
                characterBackground = new Criminal();
            }
            else if (randomNumber == 3)
            {
                background          = "Entertainer";
                characterBackground = new Entertainer();
            }
            else if (randomNumber == 4)
            {
                background          = "Folk Hero";
                characterBackground = new FolkHero();
            }
            else if (randomNumber == 5)
            {
                background          = "Entertainer (Gladiator)";
                characterBackground = new Gladiator();
            }
            else if (randomNumber == 6)
            {
                background          = "Guild Artisan";
                characterBackground = new GuildArtisan();
            }
            else if (randomNumber == 7)
            {
                background          = "Guild Artisan (Guild Merchant)";
                characterBackground = new GuildMerchant();
            }
            else if (randomNumber == 8)
            {
                background          = "Hermit";
                characterBackground = new Hermit();
            }
            else if (randomNumber == 9)
            {
                background          = "Knight";
                characterBackground = new Knight();
            }
            else if (randomNumber == 10)
            {
                background          = "Noble";
                characterBackground = new Noble();
            }
            else if (randomNumber == 11)
            {
                background          = "Outlander";
                characterBackground = new Outlander();
            }
            else if (randomNumber == 12)
            {
                background          = "Pirate";
                characterBackground = new Pirate();
            }
            else if (randomNumber == 13)
            {
                background          = "Sage";
                characterBackground = new Sage();
            }
            else if (randomNumber == 14)
            {
                background          = "Sailor";
                characterBackground = new Sailor();
            }
            else if (randomNumber == 15)
            {
                background          = "Soldier";
                characterBackground = new Soldier();
            }
            else if (randomNumber == 16)
            {
                background          = "Spy";
                characterBackground = new Spy();
            }
            else if (randomNumber == 17)
            {
                background          = "Urchin";
                characterBackground = new Urchin();
            }

            return(background);
        }
Esempio n. 19
0
        public void LoadReport(AST.Report report)
        {
            foreach (var p in report.provinces)
            {
                var id = CoordsToId(p.coords);

                Province province;
                using (var session = store.OpenSession())
                {
                    province = GetProvince(session, id);
                }

                province.X          = p.coords.Item2;
                province.Y          = p.coords.Item1;
                province.Civ        = p.civ;
                province.Name       = p.name;
                province.Region     = p.region;
                province.Terrain    = FToUper(p.terrain);
                province.Safe       = p.safe;
                province.ReportedOn = report.turn;

                foreach (var innerLocation in p.locations)
                {
                    Location loc;
                    using (var session = store.OpenSession())
                    {
                        loc      = session.Load <Location>(innerLocation.id) ?? new Location();
                        loc.Id   = innerLocation.id;
                        loc.Host = province;
                        loc.Kind = innerLocation.kind;
                        loc.Safe = innerLocation.safe;

                        session.Store(loc);
                        session.SaveChanges();
                    }

                    if (RouteExists(province, loc.Id))
                    {
                        continue;
                    }

                    Route route = new Route
                    {
                        Target    = loc,
                        Time      = innerLocation.time,
                        Direction = RouteDirection.In
                    };
                    province.Routes.Add(route);
                }

                foreach (var r in p.routes)
                {
                    string routeId = CoordsToId(r.coords);
                    if (RouteExists(province, routeId))
                    {
                        continue;
                    }

                    Province routedProvince;
                    using (var session = store.OpenSession())
                    {
                        routedProvince         = GetProvince(session, routeId);
                        routedProvince.X       = r.coords.Item2;
                        routedProvince.Y       = r.coords.Item1;
                        routedProvince.Name    = r.province;
                        routedProvince.Terrain = FToUper(r.province);
                        routedProvince.Region  = r.region;
                        routedProvince.Id      = routeId;

                        session.Store(routedProvince);
                        session.SaveChanges();
                    }

                    Route route = new Route
                    {
                        Target = routedProvince,
                        Time   = r.time
                    };

                    RouteDirection direction;
                    if (RouteDirection.TryParse(r.direction, out direction))
                    {
                        route.Direction = direction;
                    }

                    province.Routes.Add(route);
                    using (var session = store.OpenSession())
                    {
                        session.Store(province);
                        session.SaveChanges();
                    }
                }
            }

            foreach (var n in report.nobles)
            {
                Noble noble = new Noble
                {
                    Id   = n.id,
                    Name = n.name,
                    X    = n.coords.Item2,
                    Y    = n.coords.Item1,
                };

                using (var session = store.OpenSession())
                {
                    session.Store(noble);
                    session.SaveChanges();
                }
            }
        }
Esempio n. 20
0
 public ReserveDevelopment(Development development, bool takeGold, Noble noble) : base(noble)
 {
     Development = development;
     TakeGold    = takeGold;
 }