Skip to content

Commit

Permalink
added equipment uses
Browse files Browse the repository at this point in the history
  • Loading branch information
picardrulez committed Feb 4, 2014
1 parent f45a9c4 commit 0a5c98c
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 50 deletions.
28 changes: 27 additions & 1 deletion battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,29 @@ int monsterAttack(int speed, int attack, string enemyType)
displayEnemy(enemyType);
cout << " You get hit for "<< damageDealt << " damage!\n\n";
playerHealth = playerHealth - damageDealt;
srand(static_cast<unsigned int>(time(0)));
int randomNumber = rand();
int armorSelection = (randomNumber % 4);
if (armorSelection == 0)
{
itemUses = player_ehelm[0][2];
player_ehelm[0][2] = itemUses - 1;
}
else if (armorSelection == 1)
{
itemUses = player_eplate[0][2];
player_eplate[0][2] = itemUses - 1;
}
else if (armorSelection == 2)
{
itemUses = player_egauntlets[0][2];
player_egauntlets[0][2] = itemUses - 1;
}
else if (armorSelection == 3)
{
itemUses = player_eboots[0][2];
player_eboots[0][2] = itemUses;
}
cout << " Health is at "<< playerHealth << "!\n\n";
if (playerHealth <= 0)
{
Expand Down Expand Up @@ -122,6 +145,8 @@ int playerAttack(int speed, int attack, string enemyType)
displayEnemyHit(enemyType);
cout << " You hit the monster for " << damageDealt << " damage!\n\n\n";
xp = xp + damageDealt;
itemUses = player_eweapon[0][2];
player_eweapon[0][2] = itemUses - 1;
monsterHealth = monsterHealth - damageDealt;
if (monsterHealth <= 0)
{
Expand Down Expand Up @@ -235,7 +260,8 @@ int lootEnemy(string enemy)
itemNumber = userInput - 1;
pos1 = enemy_inv[itemNumber][0];
pos2 = enemy_inv[itemNumber][1];
addInventory(pos1,pos2);
itemUses = (findItemUses(pos1,pos2) / 2);
addInventory(pos1,pos2, itemUses);
enemyDropItem(itemNumber);
}
}
Expand Down
30 changes: 15 additions & 15 deletions create.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,38 +45,38 @@ void initialItems()
if (playerInfo[1] == 1)
{
//add sword
addInventory(0, 0);
addInventory(0, 0, 50);
//add helm
addInventory(1, 0);
addInventory(1, 0, 50);
//add gauntlets
addInventory(1, 3);
addInventory(1, 3, 50);
//add boots
addInventory(1, 6);
addInventory(1, 6, 50);

}
//Druid Creation
else if (playerInfo[1] == 2)
{
//add riding boots
addInventory(1, 7);
addInventory(1, 7, 20);
//add magic potions
addInventory(2, 2);
addInventory(2, 2);
addInventory(2,2);
addInventory(2, 2, 1);
addInventory(2, 2, 1);
addInventory(2, 2, 1);
//add food
addInventory(2,9);
addInventory(2, 9, 1);
}
//Thief Creation
else if (playerInfo[1] == 3)
{
//Add axe
addInventory(0,4);
addInventory(0,4,75);
//add booze collection
addInventory(2,4);
addInventory(2,4);
addInventory(2,4);
addInventory(2,4,1);
addInventory(2,4,1);
addInventory(2,4,1);
//add rations
addInventory(2,7);
addInventory(2,7);
addInventory(2,7,1);
addInventory(2,7,1);
}
}
Loading

0 comments on commit 0a5c98c

Please sign in to comment.