Changed Enemy gadgets to be entirely random instead of based on Player gadgets

This commit is contained in:
Felix Ableitner 2013-09-17 23:35:47 +02:00
parent cfa93ca213
commit 7368daa599
2 changed files with 6 additions and 15 deletions

View file

@ -34,7 +34,7 @@ Enemy::Enemy(World& world, Pathfinder& pathfinder,
Character::EquippedItems Character::EquippedItems
Enemy::generateItems(EquippedItems playerItems) { Enemy::generateItems(EquippedItems playerItems) {
// Uses cast from enum to int to enum in order to increment enum values. // Uses cast from enum to int to enum in order to increment enum values.
switch (rand() % 4) { switch (rand() % 2) {
case 0: case 0:
if (playerItems.primary + 1 != Weapon::WeaponType::_LAST) if (playerItems.primary + 1 != Weapon::WeaponType::_LAST)
playerItems.primary = playerItems.primary =
@ -46,20 +46,12 @@ Enemy::generateItems(EquippedItems playerItems) {
playerItems.secondary = playerItems.secondary =
(Weapon::WeaponType) (((int) (playerItems.secondary) + 1)); (Weapon::WeaponType) (((int) (playerItems.secondary) + 1));
break;
case 2:
if (playerItems.left + 1 != Gadget::GadgetType::_LAST)
playerItems.left = (Gadget::GadgetType) (((int) (playerItems.left)
+ 1));
break;
case 3:
if (playerItems.right + 1 != Gadget::GadgetType::_LAST)
playerItems.left = (Gadget::GadgetType) (((int) (playerItems.left)
+ 1));
break; break;
} }
playerItems.left = (Gadget::GadgetType) (rand() % 4);
playerItems.right = (Gadget::GadgetType) (rand() % 4);
return playerItems; return playerItems;
} }

View file

@ -23,8 +23,7 @@ public:
NONE, NONE,
SHIELD, SHIELD,
HEAL, HEAL,
RINGOFFIRE, RINGOFFIRE
_LAST
}; };
public: public: