コード例 #1
2
ファイル: DragonAnimator.cs プロジェクト: jlonardi/igp-DnM
 void Start()
 {
     animator = GetComponent<Animator>();
     dragon = GetComponent<Dragon>();
     animator.SetBool("Flying",false);
     animator.SetBool("Breath Fire", false);
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: peterkirilov/SoftUni-1
        static void Main()
        {
            // Dragon with 100 HP
            var dragon = new Dragon("Alduin", 300, 100);

            List<Warrior> warriors = new List<Warrior>();
            warriors.Add(new Warrior("Ulfric Stormcloak", 80, 80));
            warriors.Add(new Warrior("Cicero", 15, 50));
            warriors.Add(new Warrior("Jarl Balgruuf", 40, 30));

            foreach (var warrior in warriors)
            {
                dragon.Attach(warrior);
            }

            var war = warriors.First();
            Console.WriteLine(war.Inventory.FirstOrDefault());
            // Nothing happens
            dragon.HealthPoints -= 20;
            // Nothing happens
            dragon.HealthPoints -= 10;
            // Dragon dies
            dragon.HealthPoints -= 90;

            Console.WriteLine(war.Inventory.First());
        }
コード例 #3
0
ファイル: DragonWings.cs プロジェクト: zillix/LD33
 // Use this for initialization
 void Start()
 {
     anim = gameObject.GetComponent<Animator> ();
     startSpeed = anim.speed;
     dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
     currentSpeed = startSpeed;
 }
コード例 #4
0
	public void initGame()
	{
		resetGame ();
		Dragon dragon_01 = new Dragon(Elementos.Fuego.ToString(),
		                              200, // daño base
		                              Random.Range(0,20), // daño critico
		                              Random.Range(0,50), // daño azar
		                              0, // bono elemento
		                              Jugadores.Jugador_uno.ToString(), // jugador propietario
		                              true, // turno
		                              1000); // vida
		Dragon dragon_02 = new Dragon(Elementos.Hielo.ToString(),
		                              200, // daño base
		                              Random.Range(0,20), // daño critico
		                              Random.Range(0,50), // daño azar
		                              0, // bono elemento
		                              Jugadores.Jugador_uno.ToString(), // jugador propietario
		                              false, // turno
		                              1000); // vida
		Dragon dragon_03 = new Dragon(Elementos.Sombra.ToString(),
		                              200, // daño base
		                              Random.Range(0,20), // daño critico
		                              Random.Range(0,50), // daño azar
		                              0, // bono elemento
		                              Jugadores.Jugador_uno.ToString(), // jugador propietario
		                              false, // turno
		                              1000); // vida
		
		Dragon dragon_04 = new Dragon(Elementos.Fuego.ToString(),
		                              200, // daño base
		                              Random.Range(0,20), // daño critico
		                              Random.Range(0,50), // daño azar
		                              0, // bono elemento
		                              Jugadores.Jugador_dos.ToString(), // jugador propietario
		                              false, // turno
		                              1000); // vida
		Dragon dragon_05 = new Dragon(Elementos.Hielo.ToString(),
		                              200, // daño base
		                              Random.Range(0,20), // daño critico
		                              Random.Range(0,50), // daño azar
		                              0, // bono elemento
		                              Jugadores.Jugador_dos.ToString(), // jugador propietario
		                              false, // turno
		                              1000); // vida
		Dragon dragon_06 = new Dragon(Elementos.Sombra.ToString(),
		                              200, // daño base
		                              Random.Range(0,20), // daño critico
		                              Random.Range(0,50), // daño azar
		                              0, // bono elemento
		                              Jugadores.Jugador_dos.ToString(), // jugador propietario
		                              false, // turno
		                              1000); // vida

		dragonesPartida.Add (dragon_01);
		dragonesPartida.Add (dragon_02);
		dragonesPartida.Add (dragon_03);
		dragonesPartida.Add (dragon_04);
		dragonesPartida.Add (dragon_05);
		dragonesPartida.Add (dragon_06);
	}
コード例 #5
0
ファイル: Program.cs プロジェクト: cierrajw/dragon-slaying
        /// <summary>
        /// Runs a battle between a Hero and a Dragon. Ends when one of them has 0 HitPoints.
        /// </summary>
        /// <param name="hero">The Hero in the battle.</param>
        /// <param name="enemy">The Dragon in the battle.</param>
        static void Battle(Hero hero, Dragon enemy)
        {
            // TODO++: modify Battle to take a List<Dragon> of enemies, and have each of them attack every time through the loop.
            // You may want to have the Hero automatically attack the first enemy in the list that is still alive.
            Die myDie = new Die(20);
            Console.WriteLine(MyHero);

            Console.WriteLine("VERSUS");

            Console.WriteLine(MyEnemy);

            while (MyHero.IsAlive())
            {
                int attackRoll = myDie.Roll();
                Console.WriteLine("Rolled {0} for attack phase", attackRoll);
                MyHero.Attack(MyEnemy, attackRoll);
                Console.WriteLine(MyEnemy);

                if (!MyEnemy.IsAlive())
                {
                    Console.WriteLine("{0} slayed {1}!", MyHero.Name, MyEnemy.Name);
                    break;
                }
                int defenseRoll = myDie.Roll();
                Console.WriteLine("Rolled {0} for defense phase", defenseRoll);
                MyHero.Defend(MyEnemy, defenseRoll);
                Console.WriteLine(MyHero);
            }

            if (!MyHero.IsAlive())
            {
                Console.WriteLine("{0} was defeated by {1}. :(", MyHero.Name, MyEnemy.Name);
            }
        }
コード例 #6
0
ファイル: Player.cs プロジェクト: zillix/LD33
 // Use this for initialization
 void Start()
 {
     rb2d = gameObject.GetComponent<Rigidbody2D> ();
     animator = gameObject.GetComponent<Animator> ();
     movement = getDefaultMovement ();
     dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
     textManager = GameObject.FindGameObjectWithTag ("TextManager").GetComponent<TextManager> ();
 }
コード例 #7
0
ファイル: Pump.cs プロジェクト: zillix/LD33
 // Use this for initialization
 void Start()
 {
     triggerable = (ITriggerable)triggerObject.GetComponent (typeof(ITriggerable));
     anim = gameObject.GetComponent<Animator> ();
     dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
     game = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
     sounds = GameObject.FindGameObjectWithTag ("SoundBank").GetComponent<SoundBank> ();
 }
コード例 #8
0
ファイル: DragonJaw.cs プロジェクト: zillix/LD33
    // Use this for initialization
    void Start()
    {
        rb2d = gameObject.GetComponent<Rigidbody2D> ();
        startRotation = rb2d.transform.rotation;
        targetRotation = startRotation;

        dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
    }
コード例 #9
0
ファイル: Button.cs プロジェクト: zillix/LD33
 void Start()
 {
     jawTriggerable = (ITriggerable)jawTriggerObject.GetComponent (typeof(ITriggerable));
     emitterTriggerable = (ITriggerable)emitterTriggerObject.GetComponent (typeof(ITriggerable));
     furnace = furnaceObject.GetComponent<Furnace> ();
     dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
     anim = buttonObject.GetComponent<Animator> ();
     game = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
     sounds = GameObject.FindGameObjectWithTag ("SoundBank").GetComponent<SoundBank> ();
 }
コード例 #10
0
ファイル: DragonArmy.cs プロジェクト: ROSSFilipov/CSharp
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());

        var dragonArmy = new List<Dragon>();

        for (int i = 0; i < n; i++)
        {
            string[] currentDragon = Console.ReadLine().Split(new char[0], StringSplitOptions.RemoveEmptyEntries);

            string color = currentDragon[0];
            string name = currentDragon[1];
            int damage = currentDragon[2] == "null" ? 45 : int.Parse(currentDragon[2]);
            int health = currentDragon[3] == "null" ? 250 : int.Parse(currentDragon[3]);
            int armor = currentDragon[4] == "null" ? 10 : int.Parse(currentDragon[4]);

            Dragon dragon = new Dragon(color, name, damage, health, armor);

            if (!dragonArmy.ContainsDragon(dragon))
            {
                dragonArmy.Add(dragon);
            }
            else
            {
                int index = dragonArmy.IndexOfDragon(dragon);
                dragonArmy[index].Name = name;
                dragonArmy[index].Color = color;
                dragonArmy[index].Damage = damage;
                dragonArmy[index].Health = health;
                dragonArmy[index].Armor = armor;
            }
        }

        var sortedDragons = dragonArmy.OrderBy(y => y.Name).GroupBy(x => x.Color);

        foreach (var item in sortedDragons)
        {
            Console.WriteLine("{0}::({1:F2}/{2:F2}/{3:F2})",
                item.Key,
                item.Average(x => x.Damage),
                item.Average(x => x.Health),
                item.Average(x => x.Armor));

            foreach (var dragon in item)
            {
                Console.WriteLine("-{0}->damage:{1}, health:{2}, armor:{3}",
                    dragon.Name,
                    dragon.Damage,
                    dragon.Health,
                    dragon.Armor);
            }
        }
    }
コード例 #11
0
ファイル: Lever.cs プロジェクト: zillix/LD33
    // Use this for initialization
    void Start()
    {
        tailTriggerable = (ITriggerable)tailTriggerObject.GetComponent (typeof(ITriggerable));
        wingsTriggerable = (ITriggerable)wingsTriggerObject.GetComponent (typeof(ITriggerable));
        anim = gameObject.GetComponent<Animator> ();
        dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
        game = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();

        sounds = GameObject.FindGameObjectWithTag ("SoundBank").GetComponent<SoundBank> ();
        wingSounds.clip = sounds.adjustTail;
        wingSounds.loop = true;
    }
コード例 #12
0
ファイル: GameArea.cs プロジェクト: 925coder/NDC2014
        public void Setup()
        {
            // Add the dragon
            _dragon = new Dragon(_content, _spriteBatch, _gameInput) { Position = new Vector2(WorldWidth / 2f, WorldHeight - 16 - 16) };

            // Setup walls
            _walls.Add(new Wall(_content, _spriteBatch, new Rectangle(0, 0, WorldWidth, 16)));
            _walls.Add(new Wall(_content, _spriteBatch, new Rectangle(0, 0, 16, WorldHeight)));
            _walls.Add(new Wall(_content, _spriteBatch, new Rectangle(0, WorldHeight - 16, WorldWidth, 16)));
            _walls.Add(new Wall(_content, _spriteBatch, new Rectangle(WorldWidth - 16, 0, 16, WorldHeight)));

            CreateBackgroudTexture();
            SetupCamera();
        }
コード例 #13
0
        public void Only_one_character_alive_after_battle_encounter_1()
        {
            Satan  satan  = new Satan(10, 9000, 0);
            Dragon dragon = new Dragon(56, 52, 34);
            Orc    orc    = new Orc(23, 34, 4);

            ShadowHunter shadowHunter = new ShadowHunter(1, 10, 10);
            Angel        angel        = new Angel(231, 223, 343);
            Archer       archer       = new Archer(2323, 323, 32);
            Knight       knight       = new Knight(23, 3334, 132);

            BattleEncounter encounter = new BattleEncounter(new List <AbstractHero>()
            {
                shadowHunter,
                angel,
                archer,
                knight
            },
                                                            new List <AbstractVillain>()
            {
                satan,
                dragon,
                orc
            });

            encounter.RunEncounter();

            int heroesAlive   = 0;
            int villainsAlive = 0;

            foreach (var hero in encounter.Heroes)
            {
                if (hero.IsAlive())
                {
                    heroesAlive++;
                }
            }
            foreach (var villain in encounter.Villains)
            {
                if (villain.IsAlive())
                {
                    villainsAlive++;
                }
            }


            Assert.IsTrue(heroesAlive == 0 || villainsAlive == 0);
        }
コード例 #14
0
    private void CreateANewDragon()
    {
        _Dragon = new Dragon();

        var width  = Panel.GetComponent <RectTransform>().sizeDelta.x;
        var height = Panel.GetComponent <RectTransform>().sizeDelta.y;

        var PictureSize = width / 20;

        // Head of Dragon
        var instance = Instantiate <Image>(ImagePrefab, Panel.transform);

        instance.GetComponent <RectTransform>().sizeDelta = new Vector2(PictureSize, PictureSize);
        instance.sprite = Sprites["Dragonhead"];
        var randomX        = UnityEngine.Random.Range(5, 15);
        var randomY        = UnityEngine.Random.Range(5, 15);
        var PositionOfHead = new System.Tuple <int, int>(randomX, randomY);

        instance.GetComponent <RectTransform>().position = _Positions[PositionOfHead];
        _Dragon._DragonParts.Add(PositionOfHead, instance);
        _Dragon.Tuples.Add(instance, PositionOfHead);
        _Dragon.ListOfParts.Add(instance);

        //Turn head of Dragon
        TurnHeadofDragon(GetRandomDirection());

        //Body of Dragon 1
        instance = Instantiate <Image>(ImagePrefab, Panel.transform);
        instance.GetComponent <RectTransform>().sizeDelta = new Vector2(PictureSize, PictureSize);
        instance.sprite = Sprites["Dragonbody"];
        var PositionFirstBodyPart = GetNextPositionOfBody(PositionOfHead);

        instance.GetComponent <RectTransform>().position = (_Positions[PositionFirstBodyPart]);
        _Dragon._DragonParts.Add(PositionFirstBodyPart, instance);
        _Dragon.Tuples.Add(instance, PositionFirstBodyPart);
        _Dragon.ListOfParts.Add(instance);

        //Body of Dragon 2
        instance = Instantiate <Image>(ImagePrefab, Panel.transform);
        instance.GetComponent <RectTransform>().sizeDelta = new Vector2(PictureSize, PictureSize);
        instance.sprite = Sprites["Dragonbody"];
        var PositionSecondBodyPart = GetNextPositionOfBody(PositionFirstBodyPart);

        instance.GetComponent <RectTransform>().position = (_Positions[PositionSecondBodyPart]);
        _Dragon._DragonParts.Add(PositionSecondBodyPart, instance);
        _Dragon.Tuples.Add(instance, PositionSecondBodyPart);
        _Dragon.ListOfParts.Add(instance);
    }
コード例 #15
0
 private void OnTriggerStay2D(Collider2D col)
 {
     if (col.tag == "Enemy")
     {
         if (col.gameObject.layer == 8)
         {
             Demon demon = col.gameObject.GetComponentInChildren <Demon>();
             demon.SubHealth(attackDamage);
         }
         if (col.gameObject.layer == 9)
         {
             Dragon dragon = col.gameObject.GetComponentInChildren <Dragon>();
             dragon.SubHealth(attackDamage);
         }
     }
 }
コード例 #16
0
        static void Main(string[] args)
        {
            var dragon = new Dragon()
            {
                Age = 5
            };

            if (dragon is IBird bird)
            {
                bird.Fly();
            }
            if (dragon is ILizard lizard)
            {
                lizard.Crawl();
            }
        }
コード例 #17
0
ファイル: DragonTests.cs プロジェクト: bilalr/BRTamagotchi
        public void DragonTest()
        {
            //Arrange
            Dragon dragon;

            //Act
            dragon = new Dragon("DragonTest");

            //Assert
            Assert.AreEqual("DragonTest", dragon.Name);
            Assert.AreEqual(1, dragon.Age);
            Assert.AreEqual(5, dragon.HungerLevel);
            Assert.AreEqual(1, dragon.Weight);
            Assert.AreEqual(5, dragon.Happiness);
            Assert.AreEqual(Life.Baby, dragon.Life);
        }
コード例 #18
0
        public void Test_DeckShouldNotAddCardWhenThereAreAlreadyTwoCopies()
        {
            //arrange
            CardStack deck   = new Deck();
            Card      dragon = new Dragon("Great Dragon", 40, ElementType.Normal);

            //act
            bool cardAdded;

            deck.AddCard(dragon);
            deck.AddCard(dragon);
            cardAdded = deck.AddCard(dragon);

            //assert
            Assert.IsFalse(cardAdded);
        }
コード例 #19
0
        static void Main(string[] args)
        {
            Dragon dragon = new Dragon();

            dragon.Engage();

            Skeleton skeleton = new Skeleton();

            skeleton.Engage();

            ZombieWolf wolf = new ZombieWolf();

            wolf.Engage();

            Console.ReadKey();
        }
コード例 #20
0
ファイル: StartUp.cs プロジェクト: MeGaDeTH91/SoftUni
        public static void Main()
        {
            Logger combatLog = new CombatLogger();
            Logger eventLog  = new EventLogger();

            combatLog.SetSuccessor(eventLog);

            Warrior warrior = new Warrior("Mountain", 10, combatLog);
            Dragon  dragon  = new Dragon("Dracarys", 100, 25, combatLog);

            IExecutor executor = new CommandExecutor();

            ICommand targetCommand = new TargetCommand(warrior, dragon);

            targetCommand.Execute();
        }
コード例 #21
0
    private void loadDragons(string filename)
    {
        StreamReader filereader = null;
        FileInfo     fileinf    = null;

        fileinf = new FileInfo(Application.dataPath + datafilessubdirectory + filename);
        if (fileinf == null)
        {
            Debug.Log("Error loading file:\t" + filename);
            return;
        }

        filereader = fileinf.OpenText();
        if (filereader == null)
        {
            Debug.Log("Error Reading file:\t" + filename);
            return;
        }


        string fileline  = null;
        Dragon newdragon = null;

        while ((fileline = filereader.ReadLine()) != null)
        {
            string name; string value;
            getStringValuePair(fileline, out name, out value);

            if (name.CompareTo("Dragon") == 0)
            {
                newdragon = new Dragon();
            }
            else if (name.CompareTo("Health") == 0)
            {
                newdragon.maxhealth = float.Parse(value);
            }

            /*there is no dragon name now just dragontype
             * else if (name.CompareTo ("Name") == 0)
             * newdragon.dragonname = value;
             * */
            else if (name.CompareTo("EndDragon") == 0)
            {
                dragons.Add(newdragon); newdragon = null;
            }
        }
    }
コード例 #22
0
        public void SpawnDragon(Player player, int numberOfBats = 100, BlockPos spawnPos = null)
        {
            var coordinates = player.KnownPosition;

            if (spawnPos != null)
            {
                if (spawnPos.XRelative)
                {
                    coordinates.X += spawnPos.X;
                }
                else
                {
                    coordinates.X = spawnPos.X;
                }

                if (spawnPos.YRelative)
                {
                    coordinates.Y += spawnPos.Y;
                }
                else
                {
                    coordinates.Y = spawnPos.Y;
                }

                if (spawnPos.ZRelative)
                {
                    coordinates.Z += spawnPos.Z;
                }
                else
                {
                    coordinates.Z = spawnPos.Z;
                }
            }

            int limit = (int)Math.Sqrt(numberOfBats);

            for (int x = 0; x < limit; x++)
            {
                for (int z = 0; z < limit; z++)
                {
                    var dragon = new Dragon(player.Level);
                    dragon.NoAi          = false;
                    dragon.KnownPosition = coordinates + new Vector3(x * 15, 0, z * 15);
                    dragon.SpawnEntity();
                }
            }
        }
コード例 #23
0
    void damageCheck(int crit, move move, Dragon target, Dragon user)
    {
        float typage = 1f; //The type (dis)advantage

        foreach (Type weakness in target.type.weaknesses)
        {
            if (weakness == move.type)
            {
                typage = 2f;
                break;
            }
        }

        foreach (Type resistance in target.type.resistances)
        {
            if (resistance == move.type)
            {
                typage = 0.5f;
                break;
            }
        }

        int   ATK  = 0;
        int   DEF  = 0;
        float STAB = 1f;

        //select physical or special stats
        if (move.physical)
        {
            ATK = user.ATK;
            DEF = target.DEF;
        }
        else
        {
            ATK = user.SPA;
            DEF = target.SPD;
        }

        //check for stab
        if (move.type == user.type)
        {
            STAB = 1.5f;
        }

        target.currentHP -= Mathf.FloorToInt(((((((2 * user.level) / 5) + 2) * move.power * ATK / DEF) / 50) + 2) * crit * STAB * typage);
    }
コード例 #24
0
        List <talk> GetTalkActiveList(string response)
        {
            List <talk>          ls     = new List <talk>();
            Dragon               result = JsonConvert.DeserializeObject <Dragon>(response);
            List <TalkativeList> temp   = new List <TalkativeList>();

            temp = result.talkativeList;
            foreach (var item in temp)
            {
                talk tk = new talk();
                tk.qqid = item.uin;
                tk.name = item.name;
                tk.days = item.desc;
                ls.Add(tk);
            }
            return(ls);
        }
コード例 #25
0
        public void Dragon_CanDieOf_Loneliness()
        {
            // Create a dragon.
            var dragon = new Dragon("test");

            // Create the life metric processor.
            var lifeMetricProcessor = new LifeMetricProcessor(dragon);

            var dragonActor = Sys.ActorOf(Props.Create(() => new DragonActor(lifeMetricProcessor)));

            // Ignore the dragon until it dies of loneliness.
            dragon.DecreaseHappiness(100);

            // Do a health check on the dragon.
            dragonActor.Tell(new HealthCheck(dragon));
            Assert.False(ExpectMsg <HealthReport>().Alive);
        }
コード例 #26
0
        public async Task AddDragonAsync(List <string> stringTags, string fileName)
        {
            using (var db = new DragonContext()) {
                List <Tag> tags = await CreateTagListFromStringTagsAsync(db, stringTags);

                var dragon = new Dragon()
                {
                    Filename = fileName
                };
                List <DragonTag> dragonTags = CreateDragonTags(tags, dragon);

                dragon.DragonTags = dragonTags;
                await db.AddAsync(dragon);

                await db.SaveChangesAsync();
            }
        }
コード例 #27
0
        public static Dragon CreateRandom()
        {
            Dragon dragon = new Dragon();

            dragon.Name        = HelperManager.CreateRandomName(_firstNames, _lastNames);
            dragon.Age         = HelperManager.RandomGenerator.Next(1, 101);
            dragon.Description = "A big dragon.";
            dragon.Gold        = HelperManager.RandomGenerator.Next(1, 1001);
            dragon.Weapon      = new Breath {
                Name = "Breath", Description = "A breath attack.", Type = (Breath.BreathType)HelperManager.RandomGenerator.Next(0, 6)
            };
            dragon.MaxHP = HelperManager.RandomGenerator.Next(10, 21);
            dragon.HP    = dragon.MaxHP;
            dragon.Realm = RealmManager.CreateRandom();

            return(dragon);
        }
コード例 #28
0
ファイル: Program.cs プロジェクト: ivayloivanof/HQC
        public static void Main()
        {
            // Dragon with 100 HP
            var dragon = new Dragon("Alduin", 300, 100);
            
            List<Warrior> warriors = new List<Warrior>();
            warriors.Add(new Warrior("Ulfric Stormcloak", 80, 80));
            warriors.Add(new Warrior("Cicero", 15, 50));
            warriors.Add(new Warrior("Jarl Balgruuf", 40, 30));

            // Nothing happens
            dragon.HealthPoints -= 20;
            // Nothing happens
            dragon.HealthPoints -= 10;
            // Dragon dies
            dragon.HealthPoints -= 90;
        }
コード例 #29
0
        public void Test_DeckShouldOnlyGetRandomCardThatIsInDeck()
        {
            //arrange
            CardStack deck      = new Deck();
            Card      dragon    = new Dragon("Great Dragon", 40, ElementType.Normal);
            Card      fireSpell = new FireSpell("Fireball", 60);


            //act
            deck.AddCard(dragon);
            deck.AddCard(fireSpell);
            Card randomCard = ((Deck)deck).GetRandomCard();
            bool isInDeck   = ((Deck)deck).IsInDeck(randomCard);

            //assert
            Assert.IsTrue(isInDeck);
        }
コード例 #30
0
        public void Run()
        {
            var combatLogger = new CombatLogger();
            var eventLogger  = new EventLogger();

            combatLogger.SetSuccessor(eventLogger);

            var warrior = new Warrior("gosho", 10, combatLogger);
            var dragon  = new Dragon("pesho", 100, 25, combatLogger);

            var executor = new CommandExecutor();
            var command  = new TargetCommand(warrior, dragon);
            var attack   = new AttackCommand(warrior);

            executor.ExecuteCommand(command);
            executor.ExecuteCommand(attack);
        }
コード例 #31
0
        // Creating the final level of the game
        // Killing the final boss will end the game
        // So there is no need to create stairs down
        public DungeonMap CreateFinalLevel(SchedulingSystem schedule)
        {
            map.Initialize(width, height);
            Rectangle playerSpawn = new Rectangle(10, height / 2 - 5, 8, 8);
            Rectangle bossSpawn   = new Rectangle(width / 2, 0, width / 2 - 1, height - 2);

            List <ICell> playerRoom = new List <ICell>();
            List <ICell> bossRoom   = new List <ICell>();

            for (int i = playerSpawn.X; i < playerSpawn.X + playerSpawn.Width; i++)
            {
                for (int j = playerSpawn.Y; j < playerSpawn.Y + playerSpawn.Height; j++)
                {
                    map.SetCellProperties(i, j, true, true, false);
                    playerRoom.Add(map.GetCell(i, j));
                }
            }

            for (int i = bossSpawn.X; i < bossSpawn.X + bossSpawn.Width; i++)
            {
                for (int j = bossSpawn.Y; j < bossSpawn.Y + bossSpawn.Height; j++)
                {
                    map.SetCellProperties(i, j, true, true, false);
                    bossRoom.Add(map.GetCell(i, j));
                }
            }

            for (int i = playerSpawn.Center.X; i < bossSpawn.Center.X; i++)
            {
                map.SetCellProperties(i, playerSpawn.Center.Y, true, true, false);
            }
            map.Rooms.Add(playerRoom);
            map.Rooms.Add(bossRoom);
            PlacePlayer();

            var dragon = Dragon.Create(1);

            dragon.X = bossSpawn.Center.X;
            dragon.Y = bossSpawn.Center.Y;

            map.AddMonster(dragon);
            CreateStairs();
            // Setting the second stairs at 0,0 to avoid exception
            map.StairsDown.X = map.StairsDown.Y = 0;
            return(map);
        }
コード例 #32
0
ファイル: Program.cs プロジェクト: schenkofil/OPN
        static void Main(string[] args)
        {
            var dragon = new Dragon("Smak", 1000, 55, 20, _flipACoinResult);
            var hero   = new Hero("Hero", 2000, 55, 20, !_flipACoinResult);
            int i      = 1;

            Console.WriteLine("Fight started");

            while (dragon.Health > 0 || hero.Health > 0)
            {
                Console.WriteLine($"\n Round: {i} \n");

                double attack  = dragon.OnTurn ? dragon.Attack() : hero.Attack();
                double defense = !dragon.OnTurn ? dragon.Defense() : hero.Defense();
                double result  = (attack - defense) > 0 ? attack - defense : 0;

                if (hero.OnTurn)
                {
                    dragon.Health -= result;
                    Console.WriteLine($"Hero dealt {result} damage to dragon.");
                    Console.WriteLine($"Dragon HP: {dragon.Health}");
                    if (dragon.Health <= 0)
                    {
                        Console.WriteLine("Dragon died");
                        break;
                    }
                }
                else
                {
                    hero.Health -= result;
                    Console.WriteLine($"Dragon dealt {result} damage to hero.");
                    Console.WriteLine($"Hero HP: {hero.Health}");
                    if (hero.Health <= 0)
                    {
                        Console.WriteLine("Hero died");
                        break;
                    }
                }

                hero.OnTurn   = !hero.OnTurn;
                dragon.OnTurn = !dragon.OnTurn;
                i++;
            }

            Console.WriteLine("Fight ended");
        }
コード例 #33
0
    // Use this for initialization
    public override void Start()
    {
        soundManager = GetComponent <FlightSoundManager>();
        base.Start();
        SetGameState(GameState.Running);
        GameObject dragonObject = (GameObject)Instantiate(dragonPrefab, new Vector3(-2 * cam.aspect, 0, 0), Quaternion.identity);

        GetComponent <ScoreGUI>().SetMedalRequirements(bronzeMedalScore, silverMedalScore, goldMedalScore);
        flightGUI           = GetComponent <FlightGUI>();
        dragon              = dragonObject.GetComponent <Dragon>();
        worldBounds.extents = new Vector3(worldBounds.extents.x * cam.aspect, 1, worldBounds.extents.z);
        backgroundPlane.transform.localScale = new Vector3(cam.aspect, 1, 1);

        fairyDelay             = Random.Range(fairyDelayMin, fairyDelayMax);
        pickupAudioSource      = GetComponent <AudioSource>();
        pickupAudioSource.clip = soundManager.Pickup;
    }
コード例 #34
0
        static void Main(string[] args)
        {
            //
            // OLD MACDONALD
            //

            List <ISingAbout> animals = new List <ISingAbout>();

            animals.Add(new Horse());
            animals.Add(new Elephant());
            animals.Add(new Dragon());
            animals.Add(new Tractor());

            FarmAnimal flyingThing = new Dragon();

            IFlyable trogdor = GetFlyingThing();


            foreach (ISingAbout item in animals)
            {
                SingAbout(item);
            }

            /*
             *
             * // Let's try singing about a Farm Animal
             * FarmAnimal animal = new Horse();
             * SingAbout(animal);
             *
             * // Horse horse = (Horse)animal;
             * // horse.Gallop();
             *
             * Elephant elephant = new Elephant();
             * SingAbout(elephant);
             *
             * Dragon dragon = new Dragon();
             * SingAbout(dragon);
             * // Same thing as: SingAbout(new Dragon());
             */

            // What if we wanted to sing about other things on the farm that were
            // singable but not farm animals?
            // Can it be done?

            Console.ReadLine();
        }
コード例 #35
0
ファイル: Form1.cs プロジェクト: mozkurt27/Game_Example
        private void btnStart_Click(object sender, EventArgs e)
        {
            Gamer  = new Player();
            Dragon = new Dragon();
            if (rbWarrior.Checked)
            {
                Gamer.CreatePlayer(txtUserName.Text, true);
            }
            else
            {
                Gamer.CreatePlayer(txtUserName.Text, false);
            }
            Form2 f = new Form2(this);

            Hide();
            f.Show();
        }
コード例 #36
0
        public static Dragon[] GetAll()
        {
            var data = new Dragon[]
            {
                new Dragon(1, "Camis, Longtail", "http://placekitten.com/200/600", "black", "fire", new string[] { }),
                new Dragon(2, "Belry, The Skinny One", "http://placekitten.com/400/400", "yellow", "acid", new string[] { }),
                new Dragon(3, "Ykeo, The Tender", "http://placekitten.com/340/322", "blue", "fire", new string[] { }),
                new Dragon(4, "Luseiroiss, The Warrior", "http://placekitten.com/756/453", "red", "water", new string[] { }),
                new Dragon(5, "Kadram, The Voiceless", "http://placekitten.com/200/222", "brown", "fire", new string[] { }),
                new Dragon(6, "Yzzen, The White", "http://placekitten.com/433/600", "white", "poison", new string[] { }),
                new Dragon(7, "Asad, Warmheart", "http://placekitten.com/543/876", "red", "fire", new string[] { }),
                new Dragon(8, "Aideinth, The Kind", "http://placekitten.com/122/524", "green", "acid", new string[] { }),
                new Dragon(9, "Teivro, Lord Of The Brown", "http://placekitten.com/443/222", "green", "corrosion", new string[] { }),
            };

            return(data);
        }
コード例 #37
0
        public async Task <IActionResult> HitAsync(int dragonId)
        {
            int    heroIdClaim = 0;
            bool   isHeroId    = GetAuthHeroId(ref heroIdClaim);
            Dragon dragon      = await _dragonService.GetDragonById(dragonId);

            Hero hero = await _heroService.GetHeroByIdAsync(heroIdClaim);

            if (hero == null || !isHeroId || dragon == null)
            {
                return(BadRequest(new { errorText = "Couldnt find a hero or a dragon" }));
            }
            //--------------------------
            int dragonHealtPointNow = await _hitService.HeroHitDragon(dragon, hero);

            return(Ok(dragonHealtPointNow));
        }
コード例 #38
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);
        }
コード例 #39
0
        public async Task <int> HeroHitDragon(Dragon dragon, Hero hero)
        {
            Random rnd                 = new Random();
            int    hitPower            = hero.WeaponDamage + rnd.Next(1, 3);
            int    dragonHealtPointNow = dragon.CurrentHealthPoint - hitPower;

            Hit heroStrike = new Hit()
            {
                CreatedAt = DateTime.Now, DragonId = dragon.Id, HeroId = hero.Id, HitPower = hitPower
            };

            dragon.CurrentHealthPoint = dragonHealtPointNow;
            await _ctx.Hits.AddAsync(heroStrike);

            await _ctx.SaveChangesAsync();

            return(dragonHealtPointNow);
        }
コード例 #40
0
    public Dragon_GameController deployDragon(GameObject dragonprefab, DragonType dtype, Vector3 pos)
    {
        Dragon dragonattrib = getDragonObject(dtype);

        //instantiate dragon prefab
        GameObject dragon = GameObject.Instantiate(dragonprefab);

        dragon.GetComponent <Dragon_GameController> ().setDragonAttribs(dragonattrib);

        //set the transform
        Transform tf = dragon.transform;

        tf.position = pos;


        //return the newly ceated dragon's dragon_controller object
        return(dragon.GetComponent <Dragon_GameController>());
    }
コード例 #41
0
ファイル: Animals0.cs プロジェクト: peidevs/code4fun
    public static Animal Make(AnimalType type) {
        Animal result = null;

        switch (type)
        {
            case AnimalType.Bear:
                result = new Bear();
                break;            
            case AnimalType.Dragon:
                result = new Dragon();
                break;            
            default:
                result = new Tiger();
                break;            
        } 

        return result;
    }
コード例 #42
0
ファイル: Program.cs プロジェクト: ivayloivanof/HQC
        public static void Main()
        {
            // Dragon with 100 HP
            var dragon = new Dragon("Alduin", 300, 100);

            List <Warrior> warriors = new List <Warrior>();

            warriors.Add(new Warrior("Ulfric Stormcloak", 80, 80));
            warriors.Add(new Warrior("Cicero", 15, 50));
            warriors.Add(new Warrior("Jarl Balgruuf", 40, 30));

            // Nothing happens
            dragon.HealthPoints -= 20;
            // Nothing happens
            dragon.HealthPoints -= 10;
            // Dragon dies
            dragon.HealthPoints -= 90;
        }
コード例 #43
0
ファイル: Hero.cs プロジェクト: cierrajw/dragon-slaying
 /// <summary>
 /// Runs an attack phase for the Hero.
 /// <para>Damage is calculated by taking the <paramref name="diceRoll"/> parameter, adding the Hero's <see cref="Offense"/>, and subtracting the <paramref name="opponent"/>'s Defense.</para>
 /// <para>The damage must be zero or positive - if it is calculated to be negative using the above formula, no damage is dealt.</para>
 /// <para>If the <paramref name="diceRoll"/> is 1, the attack fails and the damage dealt is 0, regardless of the above calculations.</para> If the <paramref name="diceRoll"/> is 20, the attack is a critical hit and automatically succeeds with a value that is three times the Hero's "natural" <see cref="Offense"/>.</para>
 /// <para>After damage is calculated according to the above rules, the Dragon receives the damage by having that amount subtracted from the Dragon's <see cref="Dragon.HitPoints"/></para>
 /// </summary>
 /// <param name="opponent">The Dragon to attack</param>
 /// <param name="diceRoll">A number (1-20) from a dice roll, relating to the effectiveness of the attack</param>
 public void Attack(Dragon opponent, int diceRoll)
 {
     int dragonDamage = diceRoll + Offense - opponent.Defense;
     if (dragonDamage < 0)
     {
         dragonDamage = 0;
     }
     if (diceRoll == 1)
     {
         dragonDamage = 0;
     }
     if (diceRoll == 20)
     {
         dragonDamage = Offense * 3;
     }
     opponent.HitPoints -= dragonDamage;
     // opponent.HitPoints = opponent.HitPoints - dragonDamage;
 }
コード例 #44
0
        public void createDragon()
        {
            //Arrange
            ICard card1;

            //Act
            card1 = new Dragon(100);
            Cardname      desiredName    = Cardname.Dragon;
            int           desiredDamage  = 100;
            Element_types desiredElement = Element_types.Fire;
            string        desiredType    = "Monster";

            //Assert
            Assert.AreEqual(desiredDamage, card1.damage);
            Assert.AreEqual(desiredName, card1.name);
            Assert.AreEqual(desiredElement, card1.element_type);
            Assert.AreEqual(desiredType, card1.type);
        }
コード例 #45
0
ファイル: Program.cs プロジェクト: GabrielaVasileva/SoftUni
    public static void Main(string[] args)
    {
        Logger combatLog = new CombatLogger();
        Logger eventLog  = new EventLogger();

        combatLog.SetSuccessor(eventLog);

        IAttackGroup group = new Group();

        group.AddMember(new Warrior("Quannarin", 10, combatLog));
        group.AddMember(new Warrior("Pancho", 15, combatLog));

        ITarget dragon = new Dragon("Mincho", 200, 25);

        IExecutor executor    = new CommandExecutor();
        ICommand  groupTarget = new GroupTargetCommand(group, dragon);
        ICommand  attack      = new GroupAttackCommand(group);
    }
コード例 #46
0
ファイル: BubbleFactory.cs プロジェクト: runegri/NDC2014
        public static Bubble CreateBubble(GameWorld gameWorld, Dragon dragon)
        {
            var bubbleType = Rnd.Next(0, 6);

            Bubble bubble;
            float startImpulse = 20;

            switch (bubbleType)
            {
                case 5:
                    bubble = new RockBubble(gameWorld);
                    startImpulse = 60;
                    break;
                case 4:
                case 3:
                    bubble = new ExplodingBubble(gameWorld);
                    break;
                case 2:
                case 1:
                case 0:
                    bubble = new Bubble(gameWorld);
                    break;
                default:
                    throw new InvalidOperationException("Bubble type: " + bubbleType);
            }

            bubble.Position = dragon.Position;

            if (dragon.LookDirection == LookDirection.Right)
            {
                bubble.Position += new Vector2(Dragon.Width, 0);
                bubble.Body.ApplyLinearImpulse(new Vector2(startImpulse, 0));
            }
            else
            {
                bubble.Position -= new Vector2(Dragon.Width, 0);
                bubble.Body.ApplyLinearImpulse(new Vector2(-startImpulse, 0));
            }

            return bubble;
        }
コード例 #47
0
        public static void Main()
        {
            // Dragon with 100 HP
            var dragon = new Dragon("Alduin", 300, 100);

            List<Warrior> warriors = new List<Warrior>();
            warriors.Add(new Warrior("Ulfric Stormcloak", 80, 80));
            warriors.Add(new Warrior("Cicero", 15, 50));
            warriors.Add(new Warrior("Jarl Balgruuf", 40, 30));

            dragon.OnDragonDeath += (sender, args) =>
            {
                foreach (var warrior in warriors)
                {
                    warrior.Update(new Weapon(10, 10));
                }
            };

            foreach (var warrior in warriors)
            {
                dragon.Attach(warrior);
            }

            // Nothing happens
            dragon.HealthPoints -= 20;
            // Nothing happens
            dragon.HealthPoints -= 10;
            // Dragon dies
            dragon.HealthPoints -= 90;

            Console.WriteLine(warriors[0].AttackPoints);
            Console.WriteLine(warriors[0].HealthPoints);
            Console.WriteLine(warriors[1].AttackPoints);
            Console.WriteLine(warriors[1].HealthPoints);
            Console.WriteLine(warriors[2].AttackPoints);
            Console.WriteLine(warriors[2].HealthPoints);
        }
コード例 #48
0
ファイル: Program.cs プロジェクト: AsenTahchiyski/SoftUni
        static void Main()
        {
            // Dragon with 100 HP
            var dragon = new Dragon("Alduin", 300, 100);

            List<Warrior> warriors = new List<Warrior>
            {
                new Warrior("Ulfric Stormcloak", 80, 80),
                new Warrior("Cicero", 15, 50),
                new Warrior("Jarl Balgruuf", 40, 30)
            };

            foreach (var warrior in warriors)
            {
                dragon.Attach(warrior);
            }

            // Nothing happens
            dragon.HealthPoints -= 20;
            // Nothing happens
            dragon.HealthPoints -= 10;
            // Dragon dies
            dragon.HealthPoints -= 90;
        }
コード例 #49
0
ファイル: TriggerHandler.cs プロジェクト: jlonardi/igp-DnM
 void Awake()
 {
     TriggerHandler.instance = this;
     dragon = GameObject.Find("Dragon").GetComponent<Dragon>();
 }
コード例 #50
0
        public BaseItem GetItemByItemID(int itemID)
        {
            DbParameter itemIdParameter = _db.CreateParameter(DbNames.GETITEMBYITEMID_ITEMID_PARAMETER, itemID);
            itemIdParameter.DbType = DbType.Int32;

            BaseItem b = null;

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETITEMBYITEMID_STOREDPROC, CommandType.StoredProcedure, itemIdParameter);

            int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID);
            int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID);
            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA);
            int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS);
            int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL);
            int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES);
            int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES);
            int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE);
            int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES);
            int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE);
            int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE);
            int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING);
            int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE);
            int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF);
            int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER);
            int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE);
            int ordinalITEM_REBIRTHHOLEITEM = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLEITEM);
            int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES);
            int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1);
            int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2);
            int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3);
            int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4);
            int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1);
            int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2);
            int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3);
            int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4);
            int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape)
                {
                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                        c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES);
                        c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1);
                        c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1);
                        c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2);
                        c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2);
                        c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3);
                        c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3);
                        c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4);
                        c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES);
                    e.Durability = reader.GetInt16(ordinalITEM_CURDURA);
                    e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA);
                    e.Damage = reader.GetInt16(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt16(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.Plus = reader.GetByte(ordinalITEM_PLUS);
                    e.Slvl = reader.GetByte(ordinalITEM_SLVL);
                    e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES);
                    e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES);
                    e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE);
                    e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES);
                    e.DragonDamage = reader.GetInt16(ordinalITEM_DRAGONDAMAGE);
                    e.DragonDefence = reader.GetInt16(ordinalITEM_DRAGONDEFENCE);
                    e.DragonAttackRating = reader.GetInt16(ordinalITEM_DRAGONATTACKRATING);
                    e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE);
                    e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF);
                    e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER);
                    e.RebirthHole = reader.GetByte(ordinalITEM_REBIRTHHOLE);
                    e.RebirthHoleItem = reader.GetByte(ordinalITEM_REBIRTHHOLEITEM);
                    e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }

                b.ItemID = reader.GetInt32(ordinalITEM_ITEMID);
                b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID);
                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = reader.GetByte(ordinalITEM_BAG);
                b.Slot = reader.GetByte(ordinalITEM_SLOT);
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_COST);
            }

            reader.Close();
            _db.Close();

            return b;
        }
コード例 #51
0
ファイル: StartLever.cs プロジェクト: zillix/LD33
 // Use this for initialization
 void Start()
 {
     anim = gameObject.GetComponent<Animator> ();
     dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
     sounds = GameObject.FindGameObjectWithTag ("SoundBank").GetComponent<SoundBank> ();
 }
コード例 #52
0
        public List<BaseItem> GetAllItemsInBag(byte bag, int characterId)
        {
            DbParameter bagIdParameter = _db.CreateParameter(DbNames.GETALLITEMSBYBAGID_BAGID_PARAMETER, bag);
            bagIdParameter.DbType = DbType.Byte;

            DbParameter characterIdParameter = _db.CreateParameter(DbNames.GETALLITEMSBYBAGID_CHARACTERID_PARAMETER, characterId);
            characterIdParameter.DbType = DbType.Int32;

            List<BaseItem> items = new List<BaseItem>();

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLITEMSBYBAGID_STOREDPROC, CommandType.StoredProcedure, bagIdParameter, characterIdParameter);

            int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID);
            int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID);
            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA);
            int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS);
            int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL);
            int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES);
            int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES);
            int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE);
            int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES);
            int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE);
            int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE);
            int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING);
            int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE);
            int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF);
            int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER);
            int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE);
            int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_IMBUEDATA = reader.GetOrdinal(DbNames.ITEM_IMBUEDATA);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES);
            int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1);
            int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2);
            int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3);
            int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4);
            int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1);
            int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2);
            int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3);
            int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4);
            int ordinalITEM_PETID = reader.GetOrdinal(DbNames.ITEM_PETID);
            int ordinalITEM_DAMAGEABSORB = reader.GetOrdinal(DbNames.ITEM_DAMAGEABSORB);
            int ordinalITEM_DEFENSEABSORB = reader.GetOrdinal(DbNames.ITEM_DEFENSEABSORB);
            int ordinalITEM_ATTACKRATINGABSORB = reader.GetOrdinal(DbNames.ITEM_ATTACKRATINGABSORB);
            int ordinalITEM_LIFEABSORB = reader.GetOrdinal(DbNames.ITEM_LIFEABSORB);
            int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                BaseItem b = null;

                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape || BType == (byte)bType.Mirror)
                {

                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                        c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES);
                        c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1);
                        c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1);
                        c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2);
                        c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2);
                        c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3);
                        c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3);
                        c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4);
                        c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4);
                    }
                    if (BType == (byte)bType.Mirror)
                    {
                        // bkind 4 = mirror, 0 = jar
                        b = new Mirror();
                        Mirror m = b as Mirror;

                        m.PetID = reader.GetInt32(ordinalITEM_PETID);
                        m.LifeAbsorb = reader.GetInt16(ordinalITEM_LIFEABSORB);
                        m.DamageAbsorb = reader.GetInt16(ordinalITEM_DAMAGEABSORB);
                        m.DefenseAbsorb = reader.GetInt16(ordinalITEM_DEFENSEABSORB);
                        m.AttackRatingAbsorb = reader.GetInt16(ordinalITEM_ATTACKRATINGABSORB);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES);
                    e.Durability = reader.GetInt16(ordinalITEM_CURDURA);
                    e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA);
                    e.Damage = reader.GetInt32(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt32(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt32(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.Plus = reader.GetByte(ordinalITEM_PLUS);
                    e.Slvl = reader.GetByte(ordinalITEM_SLVL);
                    e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES);
                    e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES);
                    e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE);
                    e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES);
                    e.DragonDamage = reader.GetInt32(ordinalITEM_DRAGONDAMAGE);
                    e.DragonDefence = reader.GetInt32(ordinalITEM_DRAGONDEFENCE);
                    e.DragonAttackRating = reader.GetInt32(ordinalITEM_DRAGONATTACKRATING);
                    e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE);
                    e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF);
                    e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER);
                    e.RebirthHole = reader.GetInt16(ordinalITEM_REBIRTHHOLE);
                    e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }
                    if (BKind == (byte)bKindStones.RbItem)
                    {
                        b = new RbHoleItem();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                    im.ImbueData = reader.GetByte(ordinalITEM_IMBUEDATA);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }
                    if (BKind == (byte)bKindBooks.RebirdBook)
                    {
                        b = new RebirthBook();
                    }
                    if (BKind == (byte)bKindBooks.FourthBook)
                    {
                        b = new FourthBook();
                    }
                    if (BKind == (byte)bKindBooks.FeSkillBook)
                    {
                        b = new FeSkillBook();
                    }
                    if (BKind == (byte)bKindBooks.FeBook)
                    {
                        b = new FiveElementBook();
                    }
                    if (BKind == (byte)bKindBooks.FocusBook)
                    {
                        b = new FocusBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }
                if (BType == (byte)bType.StoreTag)
                {
                    b = new StoreTag();

                    StoreTag tag = b as StoreTag;
                    tag.TimeLeft = reader.GetInt16(ordinalITEM_CURDURA);
                    tag.TimeMax = reader.GetInt16(ordinalITEM_MAXDURA);
                }
                if (BType == (byte)bType.PetItem)
                {
                    if (BKind == (byte)bKindPetItems.Taming)
                        b = new TameItem();
                    if (BKind == (byte)bKindPetItems.Food)
                        b = new PetFood();
                    if (BKind == (byte)bKindPetItems.Potion)
                        b = new PetPotion();
                    if (BKind == (byte)bKindPetItems.Resurect)
                        b = new PetResurrectItem();

                    PetItem p = b as PetItem;
                    p.TameChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    p.DecreaseWildness = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                    p.HealLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                }
                if (BType == (byte)bType.Pill)
                {
                    if (BKind == (byte)bKindPills.Rebirth)
                        b = new RebirthPill();

                    RebirthPill p = b as RebirthPill;
                    p.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    p.RequiredRebirth = reader.GetByte(ordinalITEM_CLASS);
                    p.ToRebirth = (byte)(p.RequiredRebirth + 1);
                    p.IncreaseSp = reader.GetInt16(ordinalITEM_DEX);
                }

                b.ItemID = reader.GetInt32(ordinalITEM_ITEMID);
                b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID);
                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = reader.GetByte(ordinalITEM_BAG);
                b.Slot = reader.GetByte(ordinalITEM_SLOT);
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_COST);

                items.Add(b);
            }

            reader.Close();
            _db.Close();

            return items;
        }
コード例 #53
0
        public BaseItem GetImbueDropItem()
        {
            List<BaseItem> items = new List<BaseItem>();

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETIMBUEDROPITEM_STOREDPROC, CommandType.StoredProcedure);

            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.DROPITEM_DURABILITY);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                BaseItem b = null;

                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }
                    if (BKind == (byte)bKindStones.RbItem)
                    {
                        b = new RbHoleItem();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                b.ItemID = 0;
                b.OwnerID = 0;
                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = 0;
                b.Slot = 0;
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = 1;
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_COST);
                items.Add(b);
            }

            reader.Close();
            _db.Close();

            if (items.Count > 0)
            {
                Random rand = new Random();
                int itemPos = rand.Next(0, items.Count);
                return items[itemPos];
            }
            else
                return null;
        }
コード例 #54
0
ファイル: DragonArmy.cs プロジェクト: ROSSFilipov/CSharp
    public static int IndexOfDragon(this List<Dragon> dragonList, Dragon other)
    {
        int index = 0;

        for (int i = 0; i < dragonList.Count; i++)
        {
            if (dragonList[i].Name == other.Name && dragonList[i].Color == other.Color)
            {
                index = i;
            }
        }

        return index;
    }
コード例 #55
0
ファイル: DragonArmy.cs プロジェクト: ROSSFilipov/CSharp
    public static bool ContainsDragon(this List<Dragon> dragonList, Dragon other)
    {
        bool containsDragon = false;
        for (int i = 0; i < dragonList.Count; i++)
        {
            if (dragonList[i].Name == other.Name && dragonList[i].Color == other.Color)
            {
                containsDragon = true;
                break;
            }
        }

        return containsDragon;
    }
コード例 #56
0
 /// <summary>
 /// Add a new album to the repository
 /// </summary>
 /// <param name="source"><see cref="Album"/> to add</param>
 /// <returns>newly added <see cref="Album"/></returns>
 public Dragon.Core.Domain.Album Add(Dragon.Core.Domain.Album source)
 {
     throw new NotImplementedException();
 }
コード例 #57
0
ファイル: GameWorld.cs プロジェクト: 925coder/NDC2014
 public void PlayerDied(Dragon dragon)
 {
     if (!dragon.IsDead && dragon.Age > MinTimeBeforeFirstDeath)
     {
         dragon.Die();
         dragon.Position = _dragonStartPosition;
     }
 }
コード例 #58
0
ファイル: Wheel.cs プロジェクト: zillix/LD33
 // Use this for initialization
 void Start()
 {
     triggerable = (ITriggerable)triggerObject.GetComponent (typeof(ITriggerable));
     player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
     dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
     playerFeet = GameObject.FindGameObjectWithTag("PlayerFeet");
     collider = gameObject.GetComponent<BoxCollider2D> ();
     game = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
 }
コード例 #59
0
ファイル: GameWorld.cs プロジェクト: 925coder/NDC2014
        public void Setup()
        {
            _dragon = new Dragon(this) { Position = _dragonStartPosition };
            _allGameOjbects.Add(_dragon);

            _walls.Add(new Wall(this, new Rectangle(0, 0, WorldWidth, 16)));
            _walls.Add(new Wall(this, new Rectangle(0, 0, 16, WorldHeight)));
            _walls.Add(new Wall(this, new Rectangle(0, WorldHeight - 16, WorldWidth, 16)));
            _walls.Add(new Wall(this, new Rectangle(WorldWidth - 16, 0, 16, WorldHeight)));

            _walls.Add(new Wall(this, new Rectangle(200, 450, 208, 16)) { SolidWall = false });
            _walls.Add(new Wall(this, new Rectangle(408, 350, 16, 116)));

            CreateBackgroudTexture();
            SetupCamera();

            _debugView.LoadContent(_graphicsDevice, _content);
        }
コード例 #60
0
        private static List<ISpaceCraft> BuildF9Dragon(IMassiveBody planet, string craftDirectory, VehicleConfig vehicle, float offset = 0)
        {
            var dragon = new Dragon(craftDirectory, planet.Position + new DVector2(offset, -planet.SurfaceRadius), planet.Velocity, vehicle.PayloadMass);
            var dragonTrunk = new DragonTrunk(craftDirectory, DVector2.Zero, DVector2.Zero);

            var f9S1 = new F9S1(craftDirectory, DVector2.Zero, DVector2.Zero);
            var f9S2 = new F9S2(craftDirectory, DVector2.Zero, DVector2.Zero, 8.3);

            dragon.AddChild(dragonTrunk);
            dragonTrunk.SetParent(dragon);
            dragonTrunk.AddChild(f9S2);
            f9S2.SetParent(dragonTrunk);
            f9S2.AddChild(f9S1);
            f9S1.SetParent(f9S2);

            return new List<ISpaceCraft>
            {
                dragon, dragonTrunk, f9S2, f9S1
            };
        }