Ejemplo n.º 1
0
 public Combat(ContentManager content, int height, int width, Game1 game, Player[] p, Enemy[] e)
 {
     _content = content;
       _height = height;
       _width = width;
       maingame = game;
       random = new Random();
       highestMenuOption = 1;
       lowestMenuOption = 3;
       menuLayer = 0;
       menuoption = (int)MenuOption.Fight;
       prevKeyboardState = Keyboard.GetState();
       currentKeyboardState = Keyboard.GetState();
       thePlayers = p;
       theEnemies = e;
       messageQueue = new Queue<string>();
       AddMessage("Player Turn");
       ranAway = false;
 }
Ejemplo n.º 2
0
        private void LayerThreeAction(GameTime gameTime)
        {
            if (menuoption == 1 &&
              IsKeyClicked(Keys.Z))
              {
            if (lastMenuChoiceTime + menuinterval < gameTime.TotalGameTime)
            {
              selectedEnemy = theEnemies[0];
              ExecutePlayerAction(selectedPlayerAction, gameTime);
              selectedPlayer.hasGone = true;
            }
              }

              if (menuoption == 2 &&
              IsKeyClicked(Keys.Z))
              {
            if (lastMenuChoiceTime + menuinterval < gameTime.TotalGameTime)
            {
              selectedEnemy = theEnemies[1];
              ExecutePlayerAction(selectedPlayerAction, gameTime);
              selectedPlayer.hasGone = true;
            }
              }

              if (menuoption == 3 &&
              IsKeyClicked(Keys.Z))
              {
            if (lastMenuChoiceTime + menuinterval < gameTime.TotalGameTime)
            {
              selectedEnemy = theEnemies[2];
              ExecutePlayerAction(selectedPlayerAction, gameTime);
              selectedPlayer.hasGone = true;
            }
              }
              if (IsKeyClicked(Keys.X))
              {
            if (lastMenuChoiceTime + menuinterval < gameTime.TotalGameTime)
            {
              ChangeLayers(2);
            }
              }
        }
Ejemplo n.º 3
0
 private void ExecuteEnemyAction(Enemy e, GameTime gameTime)
 {
     lastMessageTime = gameTime.TotalGameTime;
       SetHealthReferencePoint();
       if (e.GetEnemyStats().Health > 0)
       {
     SetHealthReferencePoint();
     if (e.whichAi == 1)
     {
       e.ExecuteAI1(enemySelectedPlayer);
       AddMessage(e.Name + " attacked " + enemySelectedPlayer.Name + "!");
     }
     else if (e.whichAi == 2)
     {
       chosenEnemySkill = e.ExecuteAI2(enemySelectedPlayer, e);
       if (chosenEnemySkill != null)
       {
     AddMessage(e.Name + " cast " + e.skillA.Name + "!");
       }
       else
       {
     AddMessage(e.Name + " attacked " + enemySelectedPlayer.Name + "!");
       }
     }
     else if (e.whichAi == 3)
     {
       chosenEnemySkill = e.ExecuteAI3(enemySelectedPlayer, e);
       AddMessage(e.Name + " cast " + chosenEnemySkill.Name + "!");
     }
     DeterminePlayerMessages(enemySelectedPlayer);
     DetermineOtherMessages(enemySelectedPlayer);
       }
 }
Ejemplo n.º 4
0
        private void CreateOverWorld()
        {
            //Eric's code start

              OW = ContentRepository.getMap(3, this);
              //OWlist = new List<OverWorld>();
              //OWlist.Add(OW);
              graphics.PreferredBackBufferWidth = 800;
              graphics.PreferredBackBufferHeight = 600;

              TileMap tempTileMap = ContentRepository.getMap(4);
              TileMap tempTileMap2 = ContentRepository.getMap(5);
              TileMap tempTileMap3 = ContentRepository.getMap(8);
              TileMap tempTileMap4 = ContentRepository.getMap(7);
              OW.mapList.Add(tempTileMap);
              OW.mapList.Add(tempTileMap2);
              OW.mapList.Add(tempTileMap3);
              OW.mapList.Add(tempTileMap4);

              #region Enemy Creation

              Entity enemy1 = new Enemy(OW, tempTileMap.getTile(3, 4), 0,
            new int[] { 2, 2, 3, 3, 0, 0, 0, 0, 1, 1, 1, 1 , 2, 2, 3, 3 } , "Blue Spider");
              enemy1.setAvatarFileString("EnemySprites/BlueCreatureRight", "EnemySprites/BlueCreatureRight",
            "EnemySprites/BlueCreatureLeft", "EnemySprites/BlueCreatureLeft");
              tempTileMap.EntityList.Add(enemy1);

              Entity enemy2 = new Enemy(OW, tempTileMap.getTile(8, 11), 0,
            new int[] { 0,0,1,1,2,2,2,2,3,3,3,3,0,0,1,1 }, "Blue Spider");
              enemy2.setAvatarFileString("EnemySprites/BlueCreatureRight", "EnemySprites/BlueCreatureRight",
            "EnemySprites/BlueCreatureLeft", "EnemySprites/BlueCreatureLeft");
              tempTileMap.EntityList.Add(enemy2);

              Entity enemy3 = new Enemy(OW, tempTileMap2.getTile(2, 12), 0,
            new int[] { 1, 1, 3, 3, 3, 3, 1, 1 },
            "Purple Spider");
              enemy3.setAvatarFileString("EnemySprites/PurpleSpiderRight", "EnemySprites/PurpleSpiderRight",
            "EnemySprites/PurpleSpiderLeft", "EnemySprites/PurpleSpiderLeft");
              tempTileMap2.EntityList.Add(enemy3);

              Entity enemy4 = new Enemy(OW, tempTileMap2.getTile(1, 2), 0,
              new int[] {3,2,2,1,2,2,3,2,2,1,0,0,3,0,0,1,0,0},
              "Purple Spider");
              enemy4.setAvatarFileString("EnemySprites/PurpleSpiderRight", "EnemySprites/PurpleSpiderRight",
            "EnemySprites/PurpleSpiderLeft", "EnemySprites/PurpleSpiderLeft");
              tempTileMap2.EntityList.Add(enemy4);

              Entity enemy5 = new Enemy(OW, tempTileMap3.getTile(1, 3), 0,
            new int[] {2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3},
            "Purple Monster");
              enemy5.setAvatarFileString("EnemySprites/PurpleMonsterRight", "EnemySprites/PurpleMonsterRight",
            "EnemySprites/PurpleMonsterLeft", "EnemySprites/PurpleMonsterLeft");
              tempTileMap3.EntityList.Add(enemy5);

              Entity enemy6 = new Enemy(OW, tempTileMap3.getTile(8, 3), 0,
            new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2 },
            "Purple Monster");
              enemy6.setAvatarFileString("EnemySprites/PurpleMonsterRight", "EnemySprites/PurpleMonsterRight",
            "EnemySprites/PurpleMonsterLeft", "EnemySprites/PurpleMonsterLeft");
              tempTileMap3.EntityList.Add(enemy6);

              Entity enemy7 = new Enemy(OW, tempTileMap3.getTile(8, 14), 0,
            new int[] { 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
            "Purple Monster");
              enemy7.setAvatarFileString("EnemySprites/PurpleMonsterRight", "EnemySprites/PurpleMonsterRight",
            "EnemySprites/PurpleMonsterLeft", "EnemySprites/PurpleMonsterLeft");
              tempTileMap3.EntityList.Add(enemy7);

              Entity enemy8 = new Enemy(OW, tempTileMap3.getTile(1, 14), 0,
            new int[] { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1  ,0, 0, 0, 0, 0, 0, 0},
            "Purple Monster");
              enemy8.setAvatarFileString("EnemySprites/PurpleMonsterRight", "EnemySprites/PurpleMonsterRight",
            "EnemySprites/PurpleMonsterLeft", "EnemySprites/PurpleMonsterLeft");
              tempTileMap3.EntityList.Add(enemy8);

              Entity enemy9 = new Enemy(OW, tempTileMap3.getTile(3, 11), 0,
            new int[] { 2,2,2,3,3,3,3,3,0,0,0,1,1,1,1,1 },
            "Purple Monster");
              enemy9.setAvatarFileString("EnemySprites/PurpleMonsterRight", "EnemySprites/PurpleMonsterRight",
            "EnemySprites/PurpleMonsterLeft", "EnemySprites/PurpleMonsterLeft");
              tempTileMap3.EntityList.Add(enemy9);

              Entity enemy10 = new Enemy(OW, tempTileMap3.getTile(6, 6), 0,
            new int[] { 0,0,0,1,1,1,1,1,2,2,2,3,3,3,3,3 },
            "Purple Monster");
              enemy10.setAvatarFileString("EnemySprites/PurpleMonsterRight", "EnemySprites/PurpleMonsterRight",
            "EnemySprites/PurpleMonsterLeft", "EnemySprites/PurpleMonsterLeft");
              tempTileMap3.EntityList.Add(enemy10);
              #endregion

              #region Map Creation (includes doors)

              Entity temp;

              temp = new LockedDoor(OW, OW.OWmap.getTile(2, 7), 3, tempTileMap, null, 777);
              temp.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
              "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");
              Door tempSister = new Door(OW, tempTileMap.getTile(1, 0), 1, OW.OWmap, (Door)temp);
              tempSister.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
              "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");
              ((Door)temp).sister = tempSister;
              OW.EntityList.Add(temp);
              tempTileMap.EntityList.Add(tempSister);
              //end

              Entity temp2 = new Door(OW, tempTileMap.getTile(10, 15), 3, tempTileMap2, null);//10 15
              temp2.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
             "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");

              Door tempSister2 = new Door(OW, tempTileMap2.getTile(10, 0), 1, tempTileMap, (Door)temp2);
              tempSister2.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
              "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");
              ((Door)temp2).sister = tempSister2;
              tempTileMap.EntityList.Add(temp2);
              tempTileMap2.EntityList.Add(tempSister2);

              Entity temp3 = new Door(OW, tempTileMap2.getTile(0, 8), 2, tempTileMap3, null);//10 15
              temp3.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
             "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");

              Door tempSister3 = new Door(OW, tempTileMap3.getTile(11, 7), 0, tempTileMap2, (Door)temp3);
              tempSister3.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
              "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");
              ((Door)temp3).sister = tempSister3;
              tempTileMap2.EntityList.Add(temp3);
              tempTileMap3.EntityList.Add(tempSister3);

              Entity temp4 = new Door(OW, tempTileMap3.getTile(6, 0), 1, tempTileMap4, null);//10 15
              temp4.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
             "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");

              Door tempSister4 = new Door(OW, tempTileMap4.getTile(6, 15), 3, tempTileMap3, (Door)temp4);
              tempSister4.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
              "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");
              ((Door)temp4).sister = tempSister4;
              tempTileMap3.EntityList.Add(temp4);
              tempTileMap4.EntityList.Add(tempSister4);

              #endregion

              #region Chest ceation

              List<Item> temp_chest_items = new List<Item>();
              temp_chest_items.Add(new Key("Test Chest Key", 1));
              Chest tempChest = new Chest(OW, OW.OWmap.getTile(1, 5), 100, temp_chest_items);
              tempChest.setAvatarFileString("EntityAvatar/Chest/Chest_Only_HeatherLeeHarvey", "EntityAvatar/Chest/Chest_Only_HeatherLeeHarvey",
              "EntityAvatar/Chest/Chest_Only_HeatherLeeHarvey", "EntityAvatar/Chest/Chest_Only_HeatherLeeHarvey");
              OW.OWmap.EntityList.Add(tempChest);

              temp_chest_items = new List<Item>();
              temp_chest_items.Add(new Key("Door Key", 777));
              //temp_chest_items.Add(new Item("Rat-Tail"));
              //temp_chest_items.Add(new Item("MacGuffin"));
              //temp_chest_items.Add(new Item("Red Potion"));
              //temp_chest_items.Add(new Item("Katana"));
              tempChest = new LockedChest(OW, OW.OWmap.getTile(1, 3), 100, temp_chest_items, 1);
              tempChest.setAvatarFileString("EntityAvatar/Chest/Chest_Only_HeatherLeeHarvey", "EntityAvatar/Chest/Chest_Only_HeatherLeeHarvey",
              "EntityAvatar/Chest/Chest_Only_HeatherLeeHarvey", "EntityAvatar/Chest/Chest_Only_HeatherLeeHarvey");
              OW.OWmap.EntityList.Add(tempChest);

              #endregion

              NPC doc = new NPC(OW, tempTileMap.getTile(8, 8), NPC_Type.Doctor);
              doc.setAvatarFileString("EntityAvatar/NPC/NPC_Doctor_Bot", "EntityAvatar/NPC/NPC_Doctor_Bot",
              "EntityAvatar/NPC/NPC_Doctor_Bot", "EntityAvatar/NPC/NPC_Doctor_Bot");
              tempTileMap.EntityList.Add(doc);
        }
Ejemplo n.º 5
0
        private void CreateCombat(Enemy e)
        {
            PlayerStatistics playerStats = party[0].GetPlayerStats();
              int[] pToE = new int[4] //player to enemy stats
              {
            playerStats.Attack, playerStats.Defence, playerStats.Concentration, playerStats.Health
              };

              e.SetEnemySprites();
              Texture2D enemySprite = e.EnemySprite();
              string enemyName = e.Name;
              /*
              enemy = new Enemy[3]
            {
                new Enemy(pToE[0]-5,pToE[1]-5,pToE[2]-5,pToE[3]-75, enemyName+" 1", enemySprite),//Can also add skills
                new Enemy(pToE[1]-3,pToE[1]-3,pToE[2]-3,pToE[3]-50, enemyName+" 2", enemySprite),
                new Enemy(pToE[0]-1,pToE[1]-1,pToE[2]-1,pToE[3]-25, enemyName+" 3", enemySprite)
            };
               * */
              enemy = new Enemy[3]
            {
                new Enemy(pToE[0]-5,pToE[1]-5,pToE[2]-5,1, enemyName+" 1", enemySprite),//Can also add skills
                new Enemy(pToE[1]-3,pToE[1]-3,pToE[2]-3,1, enemyName+" 2", enemySprite),
                new Enemy(pToE[0]-1,pToE[1]-1,pToE[2]-1,1, enemyName+" 3", enemySprite)
            };//Change health back to normal

              combat = new Combat(Content, graphics.PreferredBackBufferHeight,
              graphics.PreferredBackBufferWidth, this, party, enemy);
              combat.LoadContent();
              combat.SetSpriteBatch(spriteBatch);

              combatBackgroundID = OW.OWmap.getTile(OW.Xpos, OW.Ypos).Texture;
        }
Ejemplo n.º 6
0
        //defaults to current direction
        public bool playerStep()
        {
            Tile forward = getForward();
              if (forward == null || forward.Impassable)
            return false;

              else if (forward.entity != null)
              {
            if (forward.entity.IsEnemy())
            {
              inCombat = true;
              combatEnemy = (Enemy)forward.entity;
              return false;
            }
            forward.entity.OnCollision();
            return false;
              }
              else
              {
            if (Facing == 0)
              Xpos--;
            else if (Facing == 1)
              Ypos++;
            else if (Facing == 2)
              Xpos++;
            else if (Facing == 3)
              Ypos--;
            else
              return false;
            return true;
              }
        }
Ejemplo n.º 7
0
 public bool CheckForEnemyCollision()
 {
     foreach (Entity e in EntityList)
       {
     if (e.IsEnemy() && e.StartCombat())
     {
       ((Enemy)e).StopCombat();
       combatEnemy = (Enemy)e;
       return true;
     }
       }
       return false;
 }
Ejemplo n.º 8
0
        private void CreateOverWorld()
        {
            //Eric's code start

              OW = ContentRepository.getMap(3, this);
              //OWlist = new List<OverWorld>();
              //OWlist.Add(OW);
              graphics.PreferredBackBufferWidth = 800;
              graphics.PreferredBackBufferHeight = 600;

              TileMap tempTileMap = ContentRepository.getMap(4);
              TileMap tempTileMap2 = ContentRepository.getMap(5);
              TileMap tempTileMap3 = ContentRepository.getMap(8);
              TileMap tempTileMap4 = ContentRepository.getMap(7);
              OW.mapList.Add(tempTileMap);
              OW.mapList.Add(tempTileMap2);
              OW.mapList.Add(tempTileMap3);
              OW.mapList.Add(tempTileMap4);

              #region Enemy Creation

              Entity enemy1 = new Enemy(OW, tempTileMap.getTile(5, 5), 0, new int[] { 0, 1, 2, 3 }, "Blue Spider");
              enemy1.setAvatarFileString("EnemySprites/BlueCreatureRight", "EnemySprites/BlueCreatureRight",
            "EnemySprites/BlueCreatureLeft", "EnemySprites/BlueCreatureLeft");
              tempTileMap.EntityList.Add(enemy1);

              Entity enemy2 = new Enemy(OW, tempTileMap.getTile(8, 8), 0, new int[] { 2, 3, 0, 1 }, "Blue Spider");
              enemy2.setAvatarFileString("EnemySprites/BlueCreatureRight", "EnemySprites/BlueCreatureRight",
            "EnemySprites/BlueCreatureLeft", "EnemySprites/BlueCreatureLeft");
              tempTileMap.EntityList.Add(enemy2);

              Entity enemy3 = new Enemy(OW, tempTileMap2.getTile(8, 8), 0,
            new int[] { 1, 1, 1, 1, 3, 3, 3, 3 },
            "Purple Spider");
              enemy3.setAvatarFileString("EnemySprites/PurpleSpiderRight", "EnemySprites/PurpleSpiderRight",
            "EnemySprites/PurpleSpiderLeft", "EnemySprites/PurpleSpiderLeft");
              tempTileMap2.EntityList.Add(enemy3);

              Entity enemy4 = new Enemy(OW, tempTileMap2.getTile(5, 4), 0,
              new int[] { 0, 0, 2, 2, 2, 2, 0, 0 },
              "Purple Spider");
              enemy4.setAvatarFileString("EnemySprites/PurpleSpiderRight", "EnemySprites/PurpleSpiderRight",
            "EnemySprites/PurpleSpiderLeft", "EnemySprites/PurpleSpiderLeft");
              tempTileMap2.EntityList.Add(enemy4);

              Entity enemy5 = new Enemy(OW, tempTileMap3.getTile(8, 14), 0,
            new int[] { 0, 0, 0, 0, 2, 2, 2, 2 },
            "Purple Monster");
              enemy5.setAvatarFileString("EnemySprites/PurpleMonsterRight", "EnemySprites/PurpleMonsterRight",
            "EnemySprites/PurpleMonsterLeft", "EnemySprites/PurpleMonsterLeft");
              tempTileMap3.EntityList.Add(enemy5);

              Entity enemy6 = new Enemy(OW, tempTileMap3.getTile(4, 13), 0,
            new int[] { 2, 2, 2, 2, 0, 0, 0, 0},
            "Purple Monster");
              enemy6.setAvatarFileString("EnemySprites/PurpleMonsterRight", "EnemySprites/PurpleMonsterRight",
            "EnemySprites/PurpleMonsterLeft", "EnemySprites/PurpleMonsterLeft");
              tempTileMap3.EntityList.Add(enemy6);

              #endregion

              #region Map Creation (includes doors)

              Entity temp;

              temp = new Door(OW, OW.OWmap.getTile(2, 7), 3, tempTileMap, null);
              temp.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
              "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");
              Door tempSister = new Door(OW, tempTileMap.getTile(1, 0), 1, OW.OWmap, (Door)temp);
              tempSister.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
              "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");
              ((Door)temp).sister = tempSister;
              OW.EntityList.Add(temp);
              tempTileMap.EntityList.Add(tempSister);
              //end

              Entity temp2 = new Door(OW, tempTileMap.getTile(10, 15), 3, tempTileMap2, null);//10 15
              temp2.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
             "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");

              Door tempSister2 = new Door(OW, tempTileMap2.getTile(10, 0), 1, tempTileMap, (Door)temp2);
              tempSister2.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
              "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");
              ((Door)temp2).sister = tempSister2;
              tempTileMap.EntityList.Add(temp2);
              tempTileMap2.EntityList.Add(tempSister2);

              Entity temp3 = new Door(OW, tempTileMap2.getTile(1, 15), 3, tempTileMap3, null);//10 15
              temp3.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
             "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");

              Door tempSister3 = new Door(OW, tempTileMap3.getTile(10, 0), 1, tempTileMap2, (Door)temp3);
              tempSister3.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
              "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");
              ((Door)temp3).sister = tempSister3;
              tempTileMap2.EntityList.Add(temp3);
              tempTileMap3.EntityList.Add(tempSister3);

              Entity temp4 = new Door(OW, tempTileMap3.getTile(6, 15), 3, tempTileMap4, null);//10 15
              temp4.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
             "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");

              Door tempSister4 = new Door(OW, tempTileMap4.getTile(5, 0), 1, tempTileMap3, (Door)temp4);
              tempSister4.setAvatarFileString("EntityAvatar/Door/Door_0", "EntityAvatar/Door/Door_1",
              "EntityAvatar/Door/Door_2", "EntityAvatar/Door/Door_3");
              ((Door)temp4).sister = tempSister4;
              tempTileMap3.EntityList.Add(temp4);
              tempTileMap4.EntityList.Add(tempSister4);

              #endregion
        }
Ejemplo n.º 9
0
        public Skill ExecuteAI3(Player p, Enemy e)
        {
            Skill chosenSkill;
              int randomNumber = random.Next(1, 100);

              if (randomNumber > 50)
              {
            chosenSkill = skillA;
              }
              else
              {
            chosenSkill = skillB;
              }

              if (chosenSkill.isDamage)
              {
            int damage = (int)(enemyStats.Concentration * chosenSkill.skillRatio) - p.GetPlayerStats().Defence;
            if (damage <= 0)
            {
              damage = 1;
            }
            p.GetPlayerStats().SubtractHealth(damage);
              }
              else if (chosenSkill.isHealing)
              {
            int health = (int)(enemyStats.Concentration * chosenSkill.skillRatio);
            e.GetEnemyStats().addHealth(health);
            Console.WriteLine(health);
              }
              return chosenSkill;
        }
Ejemplo n.º 10
0
 public Skill ExecuteAI2(Player p, Enemy e)
 {
     int randomNumber = random.Next(1, 100);
       Skill chosenSkill;
       if (randomNumber > 50)
       {
     chosenSkill = null;
     int damage = enemyStats.Attack - p.GetPlayerStats().Defence;
     if (damage < 0)
     {
       damage = 1;
     }
     p.GetPlayerStats().SubtractHealth(damage);
       }
       else
       {
     chosenSkill = skillA;
     if (skillA.isDamage)
     {
       int damage = (int)(enemyStats.Concentration * skillA.skillRatio) - p.GetPlayerStats().Defence;
       if (damage <= 0)
       {
     damage = 1;
       }
       p.GetPlayerStats().SubtractHealth(damage);
     }
     else if (skillA.isHealing)
     {
       int health = (int)(enemyStats.Concentration * skillA.skillRatio);
       e.GetEnemyStats().addHealth(health);
     }
       }
       return chosenSkill;
 }
Ejemplo n.º 11
0
 public void ExecuteSkillB(Enemy e, Player p)
 {
     if (skillB.isDamage)
       {
     int damage = (int)(playerStats.Concentration * skillB.skillRatio) - e.GetEnemyStats().Defence;
     if (damage < 0)
     {
       damage = 1;
     }
     e.GetEnemyStats().SubtractHealth(damage);
       }
       else if (skillB.isHealing)
       {
     int health = (int)(playerStats.Concentration * skillB.skillRatio);
     p.GetPlayerStats().addHealth(health);
       }
 }
Ejemplo n.º 12
0
 public int ExecuteBasicAttack(Enemy e)
 {
     int damage = playerStats.Attack - e.GetEnemyStats().Defence;
       if (damage <= 0)
       {
     damage = 1;
       }
       e.GetEnemyStats().SubtractHealth(damage);
       return damage;
 }
Ejemplo n.º 13
0
 //defaults to current direction
 public bool playerStep()
 {
     Tile forward = getForward();
       if (forward == null || forward.Impassable)
     return false;
       else if (forward.entity != null)
       {
     if (forward.entity.IsEnemy())
     {
       InCombat = true;
       //Console.WriteLine("ENTERED COMBAT!");
       combatEnemy = (Enemy)forward.entity;
       forward.entity.remove();
       return false;
     }
     forward.entity.OnCollision();
     return false;
       }
       else
       {
     if (Facing == 0)
       Xpos--;
     else if (Facing == 1)
       Ypos++;
     else if (Facing == 2)
       Xpos++;
     else if (Facing == 3)
       Ypos--;
     else
       return false;
     return true;
       }
 }