예제 #1
0
 public int PostTerritory(Territory territory)
 {
     return(_dal.PostTerritory(territory));
 }
예제 #2
0
 public int PutTerritory(int id, Territory territory)
 {
     return(_dal.PutTerritory(id, territory));
 }
예제 #3
0
        public House Combat(int idHouseChalleging, int idHouseChalleged, int idTerritory)
        {
            double    scoreH1, scoreH2;
            House     houseChalleging = dal.GetHouseById(idHouseChalleging);
            House     houseChalleged  = dal.GetHouseById(idHouseChalleged);
            Territory territory       = dal.GetTerritoryById(idTerritory);
            Random    rand            = new Random();

            //Unité
            scoreH1 = houseChalleging.NumberOfUnities;
            scoreH2 = houseChalleged.NumberOfUnities;

            //Territory
            if (TerritoryOwner(houseChalleging, territory))
            {
                scoreH1 *= 10;
            }
            if (TerritoryOwner(houseChalleged, territory))
            {
                scoreH2 *= 10;
            }

            //Character
            scoreH1 += CharacterScore(houseChalleging);
            scoreH2 += CharacterScore(houseChalleged);

            //House Moral
            scoreH1 *= GetHouseMoral(houseChalleging.idEntityObject);
            scoreH2 *= GetHouseMoral(houseChalleged.idEntityObject);

            //Character Warrior Witch
            if (houseChalleging.isHouseContain(new CharacterType(CharaterTypeEnum.WARRIOR)) ||
                houseChalleging.isHouseContain(new CharacterType(CharaterTypeEnum.WITCH)))
            {
                scoreH1 *= rand.Next(2, 11);
            }
            if (houseChalleged.isHouseContain(new CharacterType(CharaterTypeEnum.WARRIOR)) ||
                houseChalleged.isHouseContain(new CharacterType(CharaterTypeEnum.WITCH)))
            {
                scoreH2 *= rand.Next(2, 11);
            }

            //Character Loser
            if (houseChalleging.isHouseContain(new CharacterType(CharaterTypeEnum.LOSER)))
            {
                scoreH1 -= rand.Next(1, 101);
            }
            if (houseChalleged.isHouseContain(new CharacterType(CharaterTypeEnum.LOSER)))
            {
                scoreH2 -= rand.Next(1, 101);
            }

            //Character Tactician Leader
            if (houseChalleging.isHouseContain(new CharacterType(CharaterTypeEnum.TACTICIAN)) ||
                houseChalleging.isHouseContain(new CharacterType(CharaterTypeEnum.LEADER)))
            {
                scoreH1 += rand.Next(2, 6);
            }
            if (houseChalleged.isHouseContain(new CharacterType(CharaterTypeEnum.TACTICIAN)) ||
                houseChalleged.isHouseContain(new CharacterType(CharaterTypeEnum.LEADER)))
            {
                scoreH2 += rand.Next(2, 6);
            }


            //Winning House
            House winning = (scoreH1 > scoreH2) ? houseChalleging : houseChalleged;

            AddFight(houseChalleging, houseChalleged, winning, territory);

            return(winning);
        }
        public Territory GetTerritoryById(int id)
        {
            Territory res = dal.GetTerritoryById(id);

            return(res);
        }
예제 #5
0
        public void AddFight(House HouseChalleging, House HouseChalleged, House WinningHouse, Territory territory)
        {
            Fight fight = new Fight();

            fight.HouseChalleging = HouseChalleging;
            fight.HouseChalleged  = HouseChalleged;
            fight.WinningHouse    = WinningHouse;
            fight.Territory       = territory;
            fight.War             = GetLastWar();

            dal.SaveFight(fight);
        }