コード例 #1
0
        public void Battle_ReturnLogsBattleOne_ReturnsString()
        {
            //Arrange
            FireElve    c1 = new FireElve();
            Dragon      c2 = new Dragon();
            Orc         c3 = new Orc();
            Wizzard     c4 = new Wizzard();
            FireSpell   c5 = new FireSpell();
            WaterSpell  c6 = new WaterSpell();
            Goblin      c7 = new Goblin();
            NormalSpell c8 = new NormalSpell();

            List <Card> deckOne = new List <Card>();
            List <Card> deckTwo = new List <Card>();

            deckOne.Add(c7); deckOne.Add(c3); deckOne.Add(c8); deckOne.Add(c5); deckOne.Add(c6);
            deckTwo.Add(c1); deckTwo.Add(c2); deckTwo.Add(c3); deckTwo.Add(c4); deckTwo.Add(c5);


            BattleHandler game   = new BattleHandler(deckOne, deckTwo);
            int           winner = game.Battle(); // Player One wins here!

            // Act
            List <String> logEntrys = game.ReturnLogs();
            String        lastLog   = logEntrys.Last();

            // Assert
            Assert.IsNotNull(lastLog);
        }
コード例 #2
0
        public void Battle_DeterminesWinnerOne_ReturnsInt()
        {
            //Arrange
            FireElve    c1 = new FireElve();
            Dragon      c2 = new Dragon();
            Orc         c3 = new Orc();
            Wizzard     c4 = new Wizzard();
            FireSpell   c5 = new FireSpell();
            WaterSpell  c6 = new WaterSpell();
            Goblin      c7 = new Goblin();
            NormalSpell c8 = new NormalSpell();

            List <Card> deckOne = new List <Card>();
            List <Card> deckTwo = new List <Card>();

            deckOne.Add(c7); deckOne.Add(c3); deckOne.Add(c8); deckOne.Add(c5); deckOne.Add(c6);
            deckTwo.Add(c1); deckTwo.Add(c2); deckTwo.Add(c3); deckTwo.Add(c4); deckTwo.Add(c5);


            BattleHandler game = new BattleHandler(deckOne, deckTwo);

            // Act
            int winner = game.Battle();

            // Assert
            Assert.AreEqual(1, winner);
        }
コード例 #3
0
        private Hero HeroWithType(string name, string type)
        {
            Hero hero = new Hero();

            if (type == "Brute")
            {
                hero = new Brute(name);
                //Brute brute = new Brute();
                //hero = brute.GetDefaultValues(name);
            }
            else if (type == "Ranger")
            {
                hero = new Ranger(name);
            }
            else if (type == "Paladin")
            {
                hero = new Paladin(name);
            }
            else if (type == "Wizzard")
            {
                hero = new Wizzard(name);
            }
            else
            {
                throw new ArgumentException("The type was not correct");
            }

            return(hero);
        }
コード例 #4
0
        public void Constructor_WithParameters_ReturnsTrue()
        {
            //Arrange
            Wizzard wiz = new Wizzard("Morgane", 300, element.FIRE, 80);

            //Assert
            Assert.AreEqual(wiz.Name, "Morgane");
        }
コード例 #5
0
        public void Constructor_Base_ReturnsTrue()
        {
            //Arrange
            Wizzard wiz = new Wizzard();

            // Assert
            Assert.IsTrue(wiz.Name == "Merrlin");
        }
コード例 #6
0
ファイル: Battle.cs プロジェクト: Gigi-White/SWE1-MTCG
        //----------------------------------------------------create the card-----------------------------------------------------------------
        private Card CreateCard(string cardId)
        {
            List <string> cardData = Database.selectCardData(cardId);
            string        cardname = cardData[0];
            float         damage   = float.Parse(cardData[1]);
            string        cardtype = cardData[2];
            string        element  = cardData[3];

            if (cardtype == "Monster")
            {
                switch (cardname)
                {
                case "Dragon":
                    Card dragonCard = new Dragon(damage);
                    return(dragonCard);

                case "FireElfe":
                    Card elfCard = new FireElfe(damage);
                    return(elfCard);

                case "Knight":
                    Card knightCard = new Knight(damage);
                    return(knightCard);

                case "Ork":
                    Card orkCard = new Ork(damage);
                    return(orkCard);

                case "WaterGoblin":
                    Card goblinCard = new WaterGoblin(damage);
                    return(goblinCard);

                case "Wizzard":
                    Card wizzardCard = new Wizzard(damage);
                    return(wizzardCard);
                }
            }
            else if (cardtype == "Spell")
            {
                switch (cardname)
                {
                case "RegularSpell":
                    Card normalCard = new NormalSpell(damage);
                    return(normalCard);

                case "FireSpell":
                    Card fireCard = new FireSpell(damage);
                    return(fireCard);

                case "WaterSpell":
                    Card waterCard = new WaterSpell(damage);
                    return(waterCard);
                }
            }


            return(null);
        }
コード例 #7
0
ファイル: MonsterCardTestClass.cs プロジェクト: Taha-cmd/MCTG
        public void TestWizzardVsOrk()
        {
            // Wizzard can control Orks so they are not able to damage them. => wizzard always win
            Card wizzard = new Wizzard();
            Card ork     = new Ork();

            Assert.IsTrue(wizzard.Attack(ork));
            Assert.IsFalse(ork.Attack(wizzard));
        }
コード例 #8
0
        public void Insert(Wizzard wizzard)
        {
            string sqlite = "select * from Species where Species.Identifier = '" + wizzard.Species.Identifier + "'";

            sqlite += " UNION ";
            sqlite += "select * from Gender where gender.Identifier = '" + wizzard.Gender.Identifier + "' ";
            sqlite += " UNION ";
            sqlite += "select * from House where House.Identifier = '" + wizzard.House.Identifier + "' ";
            sqlite += " UNION ";
            sqlite += "select * from Ancestry where Ancestry.Identifier = '" + wizzard.Ancestry.Identifier + "' ";
            sqlite += " UNION ";
            sqlite += "select * from colour where colour.Identifier = '" + wizzard.HairColour.Identifier + "' ";
            sqlite += " UNION ";
            sqlite += "select * from colour where colour.Identifier = '" + wizzard.EyeColour.Identifier + "' ";
            sqlite += " UNION ";
            sqlite += "select * from Patronus where Patronus.Identifier = '" + wizzard.Patronus.Identifier + "';";
            SQLiteConnection connection = new SQLiteConnection(connectionString);
            var wizzardData             = connection.Query(sqlite);

            wizzard.Species.Id    = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.Species.Identifier).FirstOrDefault()?.Id);
            wizzard.Gender.Id     = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.Gender.Identifier).FirstOrDefault()?.Id);
            wizzard.House.Id      = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.House.Identifier).FirstOrDefault()?.Id);
            wizzard.Ancestry.Id   = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.Ancestry.Identifier).FirstOrDefault()?.Id);
            wizzard.HairColour.Id = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.HairColour.Identifier).FirstOrDefault()?.Id);
            wizzard.EyeColour.Id  = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.EyeColour.Identifier).FirstOrDefault()?.Id);
            wizzard.Patronus.Id   = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.Patronus.Identifier).FirstOrDefault()?.Id);

            sqlite = @"insert into Wizzard (Name, SpeciesId, GenderId, HouseId, 
                       DateOfBirth, YearOfBirth, AncestryId, EyeColourId, 
                       HairColourId, WandId, PatronusId, HogwartsStudent, 
                       HogwartsStaff, Actor, Alive, Image)
                       values(@Name, @speciesId, @GenderId, @HouseId, @DateOfBirth, @YearOfBirth, 
                        @ancestryId, @eyeColourId, @hairColourId, @wandId, @patronusId, @hogwartsStudent, 
                        @hogwartsStaff, @actor, @alive, @image);";

            connection.Execute(sqlite,
                               new
            {
                Id              = wizzard.Id,
                Name            = wizzard.Name,
                speciesId       = wizzard.Species.Id,
                GenderId        = wizzard.Gender.Id,
                HouseId         = wizzard.House.Id,
                DateOfBirth     = wizzard.DateOfBirth,
                YearOfBirth     = wizzard.YearOfBirth,
                ancestryId      = wizzard.Ancestry.Id,
                eyeColourId     = wizzard.EyeColour.Id,
                hairColourId    = wizzard.HairColour.Id,
                wandId          = wizzard.Wand.Id,
                patronusId      = wizzard.Patronus.Id,
                hogwartsStudent = wizzard.HogwartsStudent,
                hogwartsStaff   = wizzard.HogwartsStaff,
                actor           = wizzard.Actor,
                alive           = wizzard.Alive,
                image           = wizzard.Image
            });
        }
コード例 #9
0
        static void Main(string[] args)
        {
            Assassin a1  = new Assassin();
            Knight   k1  = new Knight();
            Monk     m1  = new Monk();
            Warrior  w1  = new Warrior();
            Wizzard  wi1 = new Wizzard();

            GameEngine.Fight(w1, wi1);
        }
コード例 #10
0
        [Test] // Wizzard against MonsterCard -> expect Dmg stays the same
        public void CalcDamage_AgainstMonsterCard_ReturnsInt()
        {
            //Arrange
            Wizzard wiz     = new Wizzard();
            Wizzard evilwiz = new Wizzard();
            //Act
            int wizDamage = wiz.CalcDamage(evilwiz);

            //Assert
            Assert.AreEqual(wizDamage, wiz.Damage);
        }
コード例 #11
0
        [Test]//Dem Wizzard können Orks nichts anhaben weil er sie verzaubert.

        public void WizzardFightAgainstOrk()
        {
            Card Jaina  = new Wizzard(25);
            Card Thrall = new Ork(35);

            Jaina.SetDamage(Thrall, Thrall.Attack(Jaina));

            var actualDamage = Jaina.Damage;

            Assert.AreEqual(0, actualDamage);
        }
コード例 #12
0
        [Test] // Enemy Wizzard against Orc -> expect 0 Dmg
        public void CalcEnemyDamage_AgainstOrc_ReturnsInt()
        {
            //Arrange
            Orc     justOrc = new Orc();
            Wizzard wiz     = new Wizzard();
            //Act
            int justOrcDamage  = justOrc.CalcDamage(wiz);
            int expectedDamage = 0;

            //Assert
            Assert.AreEqual(expectedDamage, justOrcDamage);
        }
コード例 #13
0
        [Test] // Enemy Orc against Wizzard -> expect 0 enemy Dmg
        public void CalcEnemyDamage_AgainstOrc_ReturnsInt()
        {
            //Arrange
            Wizzard wiz     = new Wizzard();
            Orc     orkbolg = new Orc();
            //Act
            int enemyDamage    = wiz.CalcEnemyDamage(orkbolg);
            int expectedDamage = 0;

            //Assert
            Assert.AreEqual(expectedDamage, enemyDamage);
        }
コード例 #14
0
        [Test] // Wizzard against NORMAL Spell -> expect Dmg doubled
        public void CalcDamage_AgainstNormalSpell_ReturnsInt()
        {
            //Arrange
            Wizzard     wiz        = new Wizzard();
            NormalSpell enemySpell = new NormalSpell();
            //Act
            int wizDamage      = wiz.CalcDamage(enemySpell);
            int expectedDamage = 24;

            //Assert
            Assert.AreEqual(expectedDamage, wizDamage);
        }
コード例 #15
0
        public void Test_HasPlayer1WonRound_WizzardP1_OrkP2_Return_Win()
        {
            // Arrange
            var wizzard = new Wizzard("845f0dc7-37d0-426e-994e-43fc3ac83c08", "Name", 10, Element.Normal);
            var ork     = new Ork("99f8f8dc-e25e-4a95-aa2c-782823f36e2a", "Name", 15, Element.Normal);

            // Act
            int result = Mtcg.Battle.HasPlayer1WonRound(wizzard, ork);

            // Assert
            Assert.AreEqual(1, result);
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: szydzik/CSharpProjectsLab
        static void Main(string[] args)
        {
            Wizzard wizz1    = new Wizzard("Wizzard pierwszy");
            Thief   thief1   = new Thief("Thief pierwszy");
            Warrior warrior1 = new Warrior("Warrior pierwszy");

            Weapon w1 = new Weapon("Premium Sword", 500, 50);

            warrior1.Weapon = w1;

            Console.WriteLine(warrior1.ToString());

            Console.ReadKey();
        }
コード例 #17
0
        public static void BridgeDemo()
        {
            CharachterClass Paladin = new Paladin();
            CharachterClass Assasin = new Assasin();
            CharachterClass Wizzard = new Wizzard();
            IWeapon         Staff   = new Staff();
            IWeapon         Sword   = new Sword();
            IWeapon         Claws   = new Claws();

            Staff.GiveBonus(Wizzard);
            Sword.GiveBonus(Paladin);
            Claws.GiveBonus(Assasin);
            Claws.GiveBonus(Wizzard);
        }
コード例 #18
0
    private void LoadPlayer(int x, int y)
    {
        Player player;

        try
        {
            PlayerType playerType = (PlayerType)Enum.Parse(typeof(PlayerType), GameEnvironment.GameSettingsManager.GetValue("character"));
            switch (playerType)
            {
            case PlayerType.Bard:
                player = new Bard();
                break;

            case PlayerType.Warrior:
                player = new Warrior();
                break;

            case PlayerType.Wizzard:
                player = new Wizzard();
                break;

            default:
                player = new Warrior();
                break;
            }
        }
        catch
        {
            player = new Warrior();
        }
        GameObjectList entities = GetObject("entities") as GameObjectList;

        entities.Add(player);
        player.SetupPlayer();
        player.MovePositionOnGrid(x, y);

        if (MultiplayerManager.Online && false)
        {
            foreach (LobbyPlayer lobbyplayer in MultiplayerManager.Party.playerlist.playerlist)
            {
                if (lobbyplayer.ishost == false)
                {
                    Item           item  = new Item(id: "player2");
                    GameObjectList items = GetObject("items") as GameObjectList;
                    entities.Add(item);
                    item.MovePositionOnGrid(50, 50);
                }
            }
        }
    }
コード例 #19
0
    ActionEffect Apply(Wizzard entity)
    {
        // evaluate
        var effect = new ActionEffect();

        foreach (var property in Properties)
        {
            entity.Defend(property, effect);
        }
        // then apply
        entity.Apply(effect);
        // return the spell total effects for pretty printing
        return(effect);
    }
コード例 #20
0
        private ICard InitalizeCardAsObject(string id, string name, float damage, string elementType, string cardType)
        {
            if (cardType == CardType.Dragon.ToString())
            {
                var card = new Dragon(id, name, damage, (Element)Enum.Parse(typeof(Element), elementType));
                return(card);
            }
            else if (cardType == CardType.Elf.ToString())
            {
                var card = new Elf(id, name, damage, (Element)Enum.Parse(typeof(Element), elementType));
                return(card);
            }
            else if (cardType == CardType.Goblin.ToString())
            {
                var card = new Goblin(id, name, damage, (Element)Enum.Parse(typeof(Element), elementType));
                return(card);
            }
            else if (cardType == CardType.Knight.ToString())
            {
                var card = new Knight(id, name, damage, (Element)Enum.Parse(typeof(Element), elementType));
                return(card);
            }
            else if (cardType == CardType.Kraken.ToString())
            {
                var card = new Kraken(id, name, damage, (Element)Enum.Parse(typeof(Element), elementType));
                return(card);
            }
            else if (cardType == CardType.Ork.ToString())
            {
                var card = new Ork(id, name, damage, (Element)Enum.Parse(typeof(Element), elementType));
                return(card);
            }
            else if (cardType == CardType.Wizzard.ToString())
            {
                var card = new Wizzard(id, name, damage, (Element)Enum.Parse(typeof(Element), elementType));
                return(card);
            }
            else if (cardType == CardType.Spell.ToString())
            {
                var card = new Spell(id, name, damage, (Element)Enum.Parse(typeof(Element), elementType));
                return(card);
            }

            return(null);
        }
コード例 #21
0
 public override void _Ready()
 {
     _rand.Randomize();
     _hud               = GetNode <HUD>("HUD");
     _arena             = GetNode <Arena>("../Arena");
     _wizzard           = GetNode <Wizzard>("../Friend/Wizzard");
     _playerSpawner     = GetNode <Node2D>("PlayerSpawner");
     _musicPlayer       = GetNode <AudioStreamPlayer>("MusicPlayer");
     _player            = SpawnPlayer();
     _monsterSpawnTimer = new Timer
     {
         OneShot   = false,
         Autostart = true,
         WaitTime  = 2f
     };
     _monsterSpawnTimer.Connect("timeout", this, nameof(SpawnMonster));
     AddChild(_monsterSpawnTimer);
     _musicPlayer.Stream = _dungeonMusic;
     _musicPlayer.Play();
 }
コード例 #22
0
        public bool Update(WizzardModel wizzardModel)
        {
            try
            {
                Wizzard wizzard = new Wizzard();
                wizzard.Species    = new Species();
                wizzard.Gender     = new Gender();
                wizzard.House      = new House();
                wizzard.Ancestry   = new Ancestry();
                wizzard.EyeColour  = new Colour();
                wizzard.HairColour = new Colour();
                wizzard.Patronus   = new Patronus();
                wizzard.Wand       = new Wand();

                wizzard.Id   = wizzardModel.Id;
                wizzard.Name = wizzardModel.Name;
                wizzard.Species.Identifier    = wizzardModel.Species;
                wizzard.Gender.Identifier     = wizzardModel.Gender;
                wizzard.House.Identifier      = wizzardModel.House;
                wizzard.DateOfBirth           = wizzardModel.DateOfBirth;
                wizzard.YearOfBirth           = wizzardModel.YearOfBirth;
                wizzard.Ancestry.Identifier   = wizzardModel.Ancestry;
                wizzard.EyeColour.Identifier  = wizzardModel.EyeColour;
                wizzard.HairColour.Identifier = wizzardModel.HairColour;
                wizzard.Wand.Id             = wizzardModel.Wand.Id;
                wizzard.Patronus.Identifier = wizzardModel.Patronus;
                wizzard.HogwartsStudent     = wizzardModel.HogwartsStudent;
                wizzard.HogwartsStaff       = wizzardModel.HogwartsStaff;
                wizzard.Actor = wizzardModel.Actor;
                wizzard.Alive = wizzardModel.Alive;
                wizzard.Image = wizzardModel.Image;

                _wizzardRepository.Update(wizzard);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #23
0
        public WizzardModel GetById(int id)
        {
            try
            {
                Wizzard      wizzard      = _wizzardRepository.GetById(id);
                WizzardModel wizzardModel = new WizzardModel();
                wizzardModel.Wand = new WandModel();

                wizzardModel.Id                = wizzard.Id;
                wizzardModel.Name              = wizzard.Name;
                wizzardModel.Species           = wizzard.Species?.Identifier;
                wizzardModel.Gender            = wizzard.Gender?.Identifier;
                wizzardModel.House             = wizzard.House?.Identifier;
                wizzardModel.DateOfBirth       = wizzard.DateOfBirth;
                wizzardModel.YearOfBirth       = wizzard.YearOfBirth;
                wizzardModel.Ancestry          = wizzard.Ancestry?.Identifier;
                wizzardModel.EyeColour         = wizzard.EyeColour?.Identifier;
                wizzardModel.HairColour        = wizzard.HairColour?.Identifier;
                wizzardModel.Wand.Id           = wizzard.Wand?.Id;
                wizzardModel.Wand.WoodMaterial = wizzard.Wand?.WoodMaterial?.Identifier;
                wizzardModel.Wand.CoreMaterial = wizzard.Wand?.CoreMaterial?.Identifier;
                wizzardModel.Wand.Length       = wizzard.Wand?.Length;
                wizzardModel.Patronus          = wizzard.Patronus?.Identifier;
                wizzardModel.HogwartsStudent   = wizzard.HogwartsStudent;
                wizzardModel.HogwartsStaff     = wizzard.HogwartsStaff;
                wizzardModel.Actor             = wizzard.Actor;
                wizzardModel.Alive             = wizzard.Alive;
                wizzardModel.Image             = wizzard.Image;

                return(wizzardModel);
            }
            catch
            {
                return(null);
            }
        }
コード例 #24
0
        public bool Update(Wizzard wizzard)
        {
            Wizzard _wizzard = GetById(wizzard.Id);

            string sqliteUpdate = "update Wizzard set";

            if (wizzard.Name != _wizzard.Name)
            {
                sqliteUpdate += " Name = @wizzardName,";
            }
            if (wizzard.Species != _wizzard.Species)
            {
                sqliteUpdate += " SpeciesId = @wizzardSpecies,";
            }
            if (wizzard.Wand.Id != _wizzard.Wand?.Id)
            {
                sqliteUpdate += " WandId = @wizzardWand,";
            }
            if (wizzard.Patronus != _wizzard.Patronus)
            {
                sqliteUpdate += " PatronusId = @wizzardPatronus,";
            }
            if (wizzard.HogwartsStudent != _wizzard.HogwartsStudent)
            {
                sqliteUpdate += " set HogwartsStudent = @wizzardHogwartsStudent,";
            }
            if (wizzard.HogwartsStaff != _wizzard.HogwartsStaff)
            {
                sqliteUpdate += " set HogwartsStaff = @wizzardHogwartsStaff,";
            }
            if (wizzard.Actor != _wizzard.Actor)
            {
                sqliteUpdate += " set Actor = @wizzardActor,";
            }
            if (wizzard.Alive != _wizzard.Alive)
            {
                sqliteUpdate += " set Alive = @wizzardAlive";
            }
            sqliteUpdate  = sqliteUpdate.Remove(sqliteUpdate.Length - 1, 1);
            sqliteUpdate += " where Wizzard.Id = @wizzardId;";

            string sqlite = "select * from Species where Species.Identifier = '" + wizzard.Species.Identifier + "'";

            sqlite += " UNION ";
            sqlite += "select * from Gender where gender.Identifier = '" + wizzard.Gender.Identifier + "' ";
            sqlite += " UNION ";
            sqlite += "select * from House where House.Identifier = '" + wizzard.House.Identifier + "' ";
            sqlite += " UNION ";
            sqlite += "select * from Ancestry where Ancestry.Identifier = '" + wizzard.Ancestry.Identifier + "' ";
            sqlite += " UNION ";
            sqlite += "select * from colour where colour.Identifier = '" + wizzard.HairColour.Identifier + "' ";
            sqlite += " UNION ";
            sqlite += "select * from colour where colour.Identifier = '" + wizzard.EyeColour.Identifier + "' ";
            sqlite += " UNION ";
            sqlite += "select * from Patronus where Patronus.Identifier = '" + wizzard.Patronus.Identifier + "';";
            SQLiteConnection connection = new SQLiteConnection(connectionString);
            var wizzardData             = connection.Query(sqlite);

            wizzard.Species.Id    = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.Species.Identifier).FirstOrDefault()?.Id);
            wizzard.Gender.Id     = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.Gender.Identifier).FirstOrDefault()?.Id);
            wizzard.House.Id      = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.House.Identifier).FirstOrDefault()?.Id);
            wizzard.Ancestry.Id   = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.Ancestry.Identifier).FirstOrDefault()?.Id);
            wizzard.HairColour.Id = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.HairColour.Identifier).FirstOrDefault()?.Id);
            wizzard.EyeColour.Id  = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.EyeColour.Identifier).FirstOrDefault()?.Id);
            wizzard.Patronus.Id   = Convert.ToInt32(wizzardData.Where(x => x.Identifier == wizzard.Patronus.Identifier).FirstOrDefault()?.Id);

            try
            {
                connection.Execute(sqliteUpdate,
                                   new
                {
                    wizzardName            = wizzard.Name,
                    wizzardSpecies         = wizzard.Species.Id,
                    wizzardWand            = wizzard.Wand.Id,
                    wizzardPatronus        = wizzard.Patronus.Id,
                    wizzardHogwartsStudent = wizzard.HogwartsStudent,
                    wizzardHogwartsStaff   = wizzard.HogwartsStaff,
                    wizzardActor           = wizzard.Actor,
                    wizzardAlive           = wizzard.Alive,
                    wizzardId = wizzard.Id
                });
                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #25
0
        public Wizzard GetById(int id)
        {
            string           sqLite     = @"select * from Wizzard 
                            left join Species on Wizzard.SpeciesId = Species.Id
                            left join Gender on Wizzard.GenderId = Gender.Id
                            left join House on Wizzard.HouseId = House.Id
                            left join Ancestry on Wizzard.AncestryId = Ancestry.Id
                            left join Colour eye on Wizzard.EyeColourId = eye.Id
                            left join Colour hair on Wizzard.HairColourId = hair.Id
                            left join Wand on Wizzard.WandId = Wand.Id
                            left join Material mWood on Wand.WoodMaterialId = mWood.Id
                            left join MaterialType mtWood on mWood.MaterialTypeId = mtWood.Id
                            left join Material mCore on Wand.CoreMaterialId = mCore.Id
                            left join MaterialType mtCore on mCore.MaterialTypeId = mtCore.Id
                            left join Patronus on Wizzard.PatronusId = Patronus.Id
                            where Wizzard.Id = " + id + ";";
            SQLiteConnection connection = new SQLiteConnection(connectionString);
            Wizzard          wizzard    = connection.Query <Wizzard>
                                              (sqLite,
                                              new[]
            {
                typeof(Wizzard),
                typeof(Species),
                typeof(Gender),
                typeof(House),
                typeof(Ancestry),
                typeof(Colour),
                typeof(Colour),
                typeof(Wand),
                typeof(Material),
                typeof(MaterialType),
                typeof(Material),
                typeof(MaterialType),
                typeof(Patronus)
            }
                                              , objects =>
            {
                Wizzard _wizzard      = objects[0] as Wizzard;
                Species species       = objects[1] as Species;
                Gender gender         = objects[2] as Gender;
                House house           = objects[3] as House;
                Ancestry ancestry     = objects[4] as Ancestry;
                Colour eyeColour      = objects[5] as Colour;
                Colour hairColour     = objects[6] as Colour;
                Wand wand             = objects[7] as Wand;
                Material woodMaterial = objects[8] as Material;
                MaterialType mt1      = objects[9] as MaterialType;
                Material coreMaterial = objects[10] as Material;
                MaterialType mt2      = objects[11] as MaterialType;
                Patronus patronus     = objects[12] as Patronus;

                _wizzard.Species    = species;
                _wizzard.Gender     = gender;
                _wizzard.House      = house;
                _wizzard.Ancestry   = ancestry;
                _wizzard.EyeColour  = eyeColour;
                _wizzard.HairColour = hairColour;
                _wizzard.Wand       = wand;
                if (wand != null)
                {
                    wand.WoodMaterial = woodMaterial;
                    if (woodMaterial != null)
                    {
                        wand.WoodMaterial.MaterialType = mt1;
                    }

                    wand.CoreMaterial = coreMaterial;
                    if (coreMaterial != null)
                    {
                        wand.CoreMaterial.MaterialType = mt2;
                    }
                }
                _wizzard.Patronus = patronus;

                return(_wizzard);
            },
                                              splitOn: "Id,Id,Id,Id,Id,Id,Id,Id,Id,Id,Id,Id").FirstOrDefault();

            return(wizzard);
        }
コード例 #26
0
ファイル: LevelLoading.cs プロジェクト: LRV2K1/Valkan
    private void LoadPlayer(int x, int y)
    {
        Player player;

        try
        {
            PlayerType playerType = (PlayerType)Enum.Parse(typeof(PlayerType), GameEnvironment.GameSettingsManager.GetValue("character"));
            switch (playerType)
            {
            case PlayerType.Bard:
                player = new Bard();
                break;

            case PlayerType.Warrior:
                player = new Warrior();
                break;

            case PlayerType.Wizzard:
                player = new Wizzard();
                break;

            default:
                player = new Warrior();
                break;
            }
        }
        catch
        {
            player = new Warrior();
        }
        GameObjectList entities = GetObject("entities") as GameObjectList;

        entities.Add(player);
        player.SetupPlayer();
        player.MovePositionOnGrid(x, y);

        players.Add(player.Id);

        if (MultiplayerManager.Online)
        {
            int i = 1;
            foreach (LobbyPlayer lobbyplayer in MultiplayerManager.Party.playerlist.playerlist)
            {
                if (lobbyplayer.ishost == false)
                {
                    Player     player2;
                    PlayerType playerType = (PlayerType)Enum.Parse(typeof(PlayerType), lobbyplayer.character);
                    switch (playerType)
                    {
                    case PlayerType.Bard:
                        player2 = new Bard(false, "player" + i);
                        break;

                    case PlayerType.Warrior:
                        player2 = new Warrior(false, "player" + i);
                        break;

                    case PlayerType.Wizzard:
                        player2 = new Wizzard(false, "player" + i);
                        break;

                    default:
                        player2 = new Warrior(false, "player" + i);
                        break;
                    }
                    entities.Add(player2);
                    player2.SetupPlayer();
                    player2.MovePositionOnGrid(x, y + 1);
                    players.Add(player2.Id);
                }
                i++;
            }
        }
    }
コード例 #27
0
        public List <Wizzard> Get()
        {
            string sqLite = @"SELECT * FROM Wizzard
                           LEFT JOIN Species on wizzard.SpeciesId = Species.Id
                           LEFT JOIN Gender on wizzard.GenderId = Gender.Id
                           LEFT JOIN House on wizzard.HouseId = House.Id
                           LEFT JOIN Ancestry on wizzard.AncestryId = Ancestry.Id
                           LEFT JOIN Colour c on wizzard.EyeColourId = c.Id
                           LEFT JOIN Colour c2 on wizzard.HairColourId = c2.Id
                           LEFT JOIN Wand on wizzard.WandId = Wand.Id
                           LEFT JOIN Material m1 on Wand.WoodMaterialId = M1.Id
                           LEFT JOIN MaterialType mt1 on m1.MaterialTypeId = mt1.Id
                           LEFT JOIN Material m2 on Wand.CoreMaterialId = M2.Id
                           LEFT JOIN MaterialType mt2 on m2.MaterialTypeId = mt2.Id
                           LEFT JOIN patronus on wizzard.PatronusId = Patronus.Id";

            SQLiteConnection connection = new SQLiteConnection(connectionString);
            List <Wizzard>   wizzards   = connection.Query <Wizzard>
                                              (sqLite,
                                              new[]
            {
                typeof(Wizzard),
                typeof(Species),
                typeof(Gender),
                typeof(House),
                typeof(Ancestry),
                typeof(Colour),
                typeof(Colour),
                typeof(Wand),
                typeof(Material),
                typeof(MaterialType),
                typeof(Material),
                typeof(MaterialType),
                typeof(Patronus)
            }
                                              , objects =>
            {
                Wizzard wizzard       = objects[0] as Wizzard;
                Species species       = objects[1] as Species;
                Gender gender         = objects[2] as Gender;
                House house           = objects[3] as House;
                Ancestry ancestry     = objects[4] as Ancestry;
                Colour eyeColour      = objects[5] as Colour;
                Colour hairColour     = objects[6] as Colour;
                Wand wand             = objects[7] as Wand;
                Material woodMaterial = objects[8] as Material;
                MaterialType mt1      = objects[9] as MaterialType;
                Material coreMaterial = objects[10] as Material;
                MaterialType mt2      = objects[11] as MaterialType;
                Patronus patronus     = objects[12] as Patronus;

                wizzard.Species    = species;
                wizzard.Gender     = gender;
                wizzard.House      = house;
                wizzard.Ancestry   = ancestry;
                wizzard.EyeColour  = eyeColour;
                wizzard.HairColour = hairColour;
                wizzard.Wand       = wand;
                if (wand != null)
                {
                    wand.WoodMaterial = woodMaterial;
                    if (woodMaterial != null)
                    {
                        wand.WoodMaterial.MaterialType = mt1;
                    }

                    wand.CoreMaterial = coreMaterial;
                    if (coreMaterial != null)
                    {
                        wand.CoreMaterial.MaterialType = mt2;
                    }
                }
                wizzard.Patronus = patronus;

                return(wizzard);
            },
                                              splitOn: "Id,Id,Id,Id,Id,Id,Id,Id,Id,Id,Id,Id").ToList();

            return(wizzards);
        }