Beispiel #1
0
	void HudItemDesc::onDraw(Renderer2D &out) const {
		HudLayer::onDraw(out);
		FRect rect = this->rect();

		if(!m_item.isDummy()) {
			float ypos = topOffset() + rect.y();

			FRect uv_rect;
			auto texture = m_item.guiImage(false, uv_rect);
			float2 size(texture->width() * uv_rect.width(), texture->height() * uv_rect.height());

			float2 pos = (float2)(int2)(float2(rect.center().x - size.x * 0.5f, ypos));
			out.addFilledRect(FRect(pos, pos + size), uv_rect, {texture, mulAlpha(ColorId::white, alpha())});

			ypos += size.y + 10.0f;
			FRect desc_rect(rect.x() + 5.0f, ypos, rect.ex() - 5.0f, rect.ey() - 5.0f);
			// TODO: fix drawing of text that does not fit
		
			string params_desc;
			if(m_item.type() == ItemType::weapon)
				params_desc = Weapon(m_item).paramDesc();
			else if(m_item.type() == ItemType::ammo)
				params_desc = Ammo(m_item).paramDesc();
			else if(m_item.type() == ItemType::armour)
				params_desc = Armour(m_item).paramDesc();

			m_font->draw(out, float2(rect.x() + 5.0f, ypos), {titleColor(), titleShadowColor()}, params_desc);
		}
	}
Beispiel #2
0
Player::Player(std::vector<NPC>* npcs, sf::Clock* timer, int tileSize, sf::Vector2i position, sf::Vector2i size, std::vector<std::vector<Entity*>>* entityMap, TileMap* tileMap, sf::Texture* texture) : Creature(timer, tileSize, position, size, entityMap, tileMap, texture) {
	this->npcs = npcs;

	//setting smooth movement variables to false
	for (int a = 0; a < 4; a++) {
		moving[a] = false;
	}

	//setting attacking variables to false
	for (int a = 0; a < 4; a++) {
		attacking[a] = false;
	}

	//setting baseStats
	baseStats[StatName::SPEED] = 1;
	baseStats[StatName::HEALTH] = 400;
	baseStats[StatName::ATTACK] = 10;
	baseStats[StatName::DEFENSE] = 10;
	baseStats[StatName::BASEDAMAGE] = 10;
	gold = 30;

	//setting stats to baseStats
	resetStats();

	//creating Weapons
	std::map<int, float> statModifiers;
	statModifiers[StatName::ATTACK] = 0;
	statModifiers[StatName::DEFENSE] = 0;
	statModifiers[StatName::BASEDAMAGE] = 0;

	weapons.push_back(Weapon("Unarmed", Weapon::Type::MELEE, statModifiers, 0.5, 0, "resources/unarmed.png"));

	//equiping unarmed weapon
	equipWeapon(weapons[0]);
}
Beispiel #3
0
Water::Water(Sint16 xcord, Sint16 ycord, const ParameterMap& param):
  Object(xcord,ycord,param) {
    weapon=Weapon(-1,W_WATER,WS_WATER);
    /* Parameters */
    if (hasParam(parameters,"audio_water_land")) au_water=scenario->sndcache->loadWAV(parameters["audio_water_land"]);
      else au_water=scenario->sndcache->loadWAV("splash2.wav");
}
Beispiel #4
0
Weapon Store::getItem(string name)
{
    int s, i;

    s = weapons.size();
    for (i = 0; i < s; i++)
    {
        if (weapons.at(i).getName().compare(name) == 0)
        {
            return weapons.at(i);
        }
    }
    s = potions.size();
    for (i = 0; i < s; i++)
    {
        if (potions.at(i).getName().compare(name) == 0)
        {
            return potions.at(i);
        }
    }
    s = spells.size();
    for (i = 0; i < s; i++)
    {
        if (spells.at(i).getName().compare(name) == 0)
        {
            return spells.at(i);
        }
    }
    return Weapon();
}
Beispiel #5
0
Erik::Erik(Sint16 xcord, Sint16 ycord, const ParameterMap& param):
  Player(xcord,ycord,param),
  jump(V_JUMP),
  jump2(V_JUMP2) {
    weapon=Weapon(-1,W_PRESSURE,WS_PRESSURE);

    /* Parameters */
    if (hasParam(parameters,"anim_erik_jump_left"))          anim_erik_jump_left=loadAnimation(getParameters(parameters["anim_erik_jump_left"],':'));
    if (hasParam(parameters,"anim_erik_jump_right"))         anim_erik_jump_right=loadAnimation(getParameters(parameters["anim_erik_jump_right"],':'));
    if (hasParam(parameters,"anim_erik_jump2_left"))         anim_erik_jump2_left=loadAnimation(getParameters(parameters["anim_erik_jump2_left"],':'));
    if (hasParam(parameters,"anim_erik_jump2_right"))        anim_erik_jump2_right=loadAnimation(getParameters(parameters["anim_erik_jump2_right"],':'));
    if (hasParam(parameters,"anim_erik_start_run_left"))     anim_erik_start_run_left=loadAnimation(getParameters(parameters["anim_erik_start_run_left"],':'));
    if (hasParam(parameters,"anim_erik_start_run_right"))    anim_erik_start_run_right=loadAnimation(getParameters(parameters["anim_erik_start_run_right"],':'));
    if (hasParam(parameters,"anim_erik_run_left"))           anim_erik_run_left=loadAnimation(getParameters(parameters["anim_erik_run_left"],':'));
    if (hasParam(parameters,"anim_erik_run_right"))          anim_erik_run_right=loadAnimation(getParameters(parameters["anim_erik_run_right"],':'));
    if (hasParam(parameters,"anim_erik_swim_left"))          anim_erik_swim_left=loadAnimation(getParameters(parameters["anim_erik_swim_left"],':'));
    if (hasParam(parameters,"anim_erik_swim_right"))         anim_erik_swim_right=loadAnimation(getParameters(parameters["anim_erik_swim_right"],':'));
    if (hasParam(parameters,"anim_erik_swim_up_left"))       anim_erik_swim_up_left=loadAnimation(getParameters(parameters["anim_erik_swim_up_left"],':'));
    if (hasParam(parameters,"anim_erik_swim_up_right"))      anim_erik_swim_up_right=loadAnimation(getParameters(parameters["anim_erik_swim_up_right"],':'));
    if (hasParam(parameters,"anim_erik_hit_water_left"))     anim_erik_hit_water_left=loadAnimation(getParameters(parameters["anim_erik_hit_water_left"],':'));
    if (hasParam(parameters,"anim_erik_hit_water_right"))    anim_erik_hit_water_right=loadAnimation(getParameters(parameters["anim_erik_hit_water_right"],':'));

    if (!hasParam(parameters,"audio_hit")) au_hit=scenario->sndcache->loadWAV("erikhit.wav");

    if (hasParam(parameters,"audio_jump")) au_jump=scenario->sndcache->loadWAV(parameters["audio_jump"]);
      else au_jump=scenario->sndcache->loadWAV("rboots.wav");
    if (hasParam(parameters,"audio_run")) au_jump=scenario->sndcache->loadWAV(parameters["audio_run"]);
      else au_run=NULL;
}
Beispiel #6
0
int	main(void) {
    {
        Weapon club = Weapon("crude spiked club");
        HumanA bob("Bob", club);
        bob.attack();
        club.setType("some other type of club");
        bob.attack();
    }
    {
        Weapon club = Weapon("crude spiked club");
        HumanB jim("Jim");
        jim.setWeapon(club);
        jim.attack();
        club.setType("some other type of club");
        jim.attack();
    }
}
Beispiel #7
0
Weapon * Weapon::create(const SEquip & equip) {
    CCASSERT(equip.type == EQUIP_TYPE_WEAPON, "用你麻痹的其它类型");
    const WeaponConfig * pConfig = g_pGameConfig->getWeaponConfig(equip.model);
    Weapon * pWeapon = NEW Weapon(pConfig);
    pWeapon->m_atk = pConfig->atk + (pConfig->atk/20) * (equip.level - 1);
    CCASSERT(NULL !=  pWeapon, "check ur memory");
    return pWeapon;
}
Beispiel #8
0
void init() {
    weapons.push_back( Weapon("gun", Vector3(0.f, 0.f, 0.f), 5.f, 10.f, 30.f) );
    targets.push_back( Target("boat", 
                               Vector3(10.f, 0.f, 10.f),
                               Vector3(8.f, -2.f, 8.f),
                               Vector3(12.f, 2.f, 12.f),
                               30.f) );
}
Beispiel #9
0
Spike::Spike(Sint16 xcord, Sint16 ycord, const ParameterMap& param):
  Object(xcord,ycord,param) {
    weapon=Weapon(-10,W_TOUCH,WS_SPIKE);

    /* Parameters */
    if (hasParam(parameters,"direction")) dir=getDirFromString(parameters["direction"]);
      else dir=DIR_UP;
    otype|=(DIR_ALL&(~dir));
}
Player::Player(string na, int he, int dp, string ar) {
    name=na;
    health=he;
    dps=dp;
    arche=ar;
    weapon=Weapon();
    maxHlth=he;
    waveCnt=0;
}
Beispiel #11
0
Class::Class(const ClassType &t) :
_classType(t)
{
	if (__classType == ClassType.Wizard){
		_rock = Skill("Meteor", Skill::SkillType::Rock);
		_paper = Skill("Earthquake", Skill::SkillType::Paper);
		_scissors = Skill("Blizzard", Skill::SkillType::Scissors);
		_weapon = Weapon("Staff");
		_name = "Mage"
	}
Beispiel #12
0
int main()
{
	Weapon sword  = Weapon("Steel Sword", 35,100,10,0,"sword",1);
	Item * sPtr = &sword;
	Inventory inv = Inventory(sPtr);
	Inventory * invPtr = &inv;
	Character chris  = Character("Chris", "Thief", "Human", 23,invPtr);
	chris.getInventory()->addItem(sword);
	chris.printStats();
}
Player::Player() {
    name="default";
    health=0;
    dps=0;
    arche="default";
    weapon=Weapon();
    maxHlth=0;
    waveCnt=0;
    selfH=0;
}
	Weapon ICharacter::unequipWeapon()
		{
			Weapon returnWeapon = weapon;			

			updateStats(-weapon.getStrength(), -weapon.getDexterity(), -weapon.getConstitution(), -weapon.getIntelligence(), -weapon.getWisdom(), -weapon.getCharisma());

			this -> weapon = Weapon(0, 0, 0, 0, 0, 0);

			return returnWeapon;
		}
Beispiel #15
0
	void ActorInventory::load(Stream &sr) {
		Inventory::load(sr);
		u8 flags;
		sr >> flags;

		m_weapon = flags & 1? Weapon(Item(sr)) : m_dummy_weapon;
		m_armour = flags & 2? Armour(Item(sr)) : Item::dummyArmour();
		m_ammo.item = flags & 4? Item(sr) : Item::dummyAmmo();
		m_ammo.count = flags & 4? decodeInt(sr) : 0;
	}
Beispiel #16
0
void Equipment::deequip_weapon() {
	if (has_weapon()) {
		inventory.add(weapon.as_item(), 1);
		weapon = Weapon(NONE);

		if (!valid_to_use_projectile(projectile)) {
			deequip_projectiles();
		}
	}
}
Player::Player(string n,int pick) {
    if(pick==1) {
        name=n;
        health=500;
        dps=70;
        arche="Ranger";
        weapon=Weapon(1);
        special="Headshot";
        specC=5;
        selfH=60;
    } else if(pick==2) {
        name=n;
        health=450;
        dps=90;
        arche="Warlock";
        weapon=Weapon(2);
        special="Transfusion";
        specC=5;
        selfH=50;
    } else if(pick==3) {
        name=n;
        health=550;
        dps=50;
        arche="Paladin";
        weapon=Weapon(3);
        special="Fortify";
        specC=5;
        selfH=70;
    } else {
        name=n;
        health=400;
        dps=100;
        arche="Beserker";
        weapon=Weapon(4);
        special="Ragnarok";
        specC=5;
        selfH=40;
    }
    maxHlth=health;
    waveCnt=0;
}
Beispiel #18
0
Weapon WeaponFactory::getNewWeapon(WeaponType weapon)
{
	for (int i = 0; i < weaponTypes.size(); i++)
	{
		if (weaponTypes[i] == weapon)
		{
			cout << i << endl;
			return weapons[i];
		}
	}
	return Weapon();
}
Beispiel #19
0
Weapon Weapon::randomWeapon(){
    Weapon w = Weapon();
    int price = 0;
    w.setPrice(price);
    w.loadRandomType();
    w.addPower();
    for (int i=0; i< w.getPower() ; i++){
        w += w.loadRandomWeaponBuff();
    }
    w.setName(w.getName() + ", " + iTos(w.getDd1()) + "d" + iTos(w.getDd2()));
    w.setName(w.getName() + (w.getRange() != 1 ? + ", " + iTos(w.getRange()) + "m" : "") );
    return w;
}
Beispiel #20
0
Baleog::Baleog(Sint16 xcord, Sint16 ycord, const ParameterMap& param):
  Player(xcord,ycord,param) {
    weapon=Weapon(-1,W_STRIKE);

    /* Parameters */
    if (hasParam(parameters,"anim_baleog_sword_left")) anim_baleog_sword_left=loadAnimation(getParameters(parameters["anim_baleog_sword_left"],':'));
      else anim_baleog_sword_left=loadAnimation(scenario->imgcache->loadImage(8,"BaleogCyborg_Slash_left.png"),8,BP_MD,ATYPE_ONCE);
    if (hasParam(parameters,"anim_baleog_sword_right")) anim_baleog_sword_right=loadAnimation(getParameters(parameters["anim_baleog_sword_right"],':'));
      else anim_baleog_sword_right=loadAnimation(scenario->imgcache->loadImage(8,"BaleogCyborg_Slash_right.png"),8,BP_MD,ATYPE_ONCE);

    if (hasParam(parameters,"audio_sword")) au_sword=scenario->sndcache->loadWAV(parameters["audio_sword"]);
      else au_sword=scenario->sndcache->loadWAV("swrdsw2.wav");
}
Beispiel #21
0
Zombie::Zombie(Sint16 xcord, Sint16 ycord, const ParameterMap& param):
  Monster(xcord,ycord,param),
  T_Attack_Bite(1500) {
    weapon=Weapon(-1,W_STRIKE);

    /* Parameters */
    if (!hasParam(parameters,"anim_left"))  anim_left=loadAnimation(scenario->imgcache->loadImage(2,"olaf1_left.bmp"),2,BP_MD,ATYPE_LOOP,2);
    if (!hasParam(parameters,"anim_right")) anim_right=loadAnimation(scenario->imgcache->loadImage(2,"olaf1_right.bmp"),2,BP_MD,ATYPE_LOOP,2);

    if (!hasParam(parameters,"maxspeedx")) maxspeedx=80;
    if (hasParam(parameters,"audio_attack")) au_attack=scenario->sndcache->loadWAV(parameters["audio_attack"]);
      else au_attack=scenario->sndcache->loadWAV("clang.wav");
}
Beispiel #22
0
Actor::Actor(Stream &sr)
    :EntityImpl(sr), m_actor(*m_proto.actor) {
    m_inventory.setDummyWeapon(Weapon(*m_actor.punch_weapon));

    u8 flags;
    sr.unpack(flags, m_stance, m_action);
    m_hit_points = decodeInt(sr);
    m_sound_variation = decodeInt(sr);
    m_client_id = decodeInt(sr);
    m_faction_id = decodeInt(sr);

    if(flags & 1)
        sr >> m_target_angle;
    else
static void player_use_projectile_spell(GameState* gs, PlayerInst* p,
                                        SpellEntry& spl_entry, const Projectile& projectile,
                                        const Pos& target) {
    MTwist& mt = gs->rng();
    AttackStats projectile_attack(Weapon(), projectile);
    ProjectileEntry& pentry = projectile.projectile_entry();
    bool wallbounce = pentry.can_wall_bounce;
    int nbounces = pentry.number_of_target_bounces;

    GameInst* pinst = new ProjectileInst(projectile,
                                         p->effective_atk_stats(mt, projectile_attack), p->id,
                                         Pos(p->x, p->y), target, pentry.speed, pentry.range, NONE,
                                         wallbounce, nbounces);
    gs->add_instance(pinst);
}
std::string ChooseClassPanel::getClassWeapons(const CharacterClass &characterClass) const
{
	int lengthCounter = 0;
	const int weaponCount = static_cast<int>(characterClass.getAllowedWeapons().size());

	// Sort as they are listed in the CharacterClassParser.
	auto allowedWeapons = characterClass.getAllowedWeapons();
	std::sort(allowedWeapons.begin(), allowedWeapons.end());

	std::string weaponsString;

	// Decide what the weapon string says.
	if (weaponCount == 0)
	{
		// If the class is allowed zero weapons, it still doesn't exclude fists, I think.
		weaponsString = "None";
	}
	else
	{
		// Collect all allowed weapon display names for the class.
		for (int i = 0; i < weaponCount; ++i)
		{
			const auto weaponType = allowedWeapons.at(i);
			const auto dummyMetal = MetalType::Iron;
			auto typeString = Weapon(weaponType, dummyMetal).typeToString();
			lengthCounter += static_cast<int>(typeString.size());
			weaponsString.append(typeString);

			// If not the the last element, add a comma.
			if (i < (weaponCount - 1))
			{
				weaponsString.append(", ");

				// If too long, add a new line.
				if (lengthCounter > ChooseClassPanel::MAX_TOOLTIP_LINE_LENGTH)
				{
					lengthCounter = 0;
					weaponsString.append("\n   ");
				}
			}
		}
	}

	weaponsString.append(".");

	return weaponsString;
}
Beispiel #25
0
void LogIntoLayer::clickLogInto(CCObject* pSender)
{
	map<string,string> post;
	post["api"] = "login";
	post["username"]=usernameText->getString();
	post["password"]=passwordText->getString();
	std::string jsonStr = POST(post);
	JsonBox::Value data;
	CCLOG(jsonStr.c_str());
	data.loadFromString(jsonStr);
	if(data["result"].getString()=="OK"){
		CCLOG("Login Successfully!");
		USER->setUserID(atoi(data["0"]["user_id"].getString().c_str()));
		USER->setUsername(data["0"]["username"].getString());
		USER->setPassword(data["0"]["password"].getString());
		USER->setLevel(atoi(data["0"]["level"].getString().c_str()));
		USER->setExp(atoi(data["0"]["exp"].getString().c_str()));
		USER->setBasicAGI(atoi(data["0"]["basic_agi"].getString().c_str()));
		USER->setBasicSTR(atoi(data["0"]["basic_str"].getString().c_str()));
		USER->setBasicDEF(atoi(data["0"]["basic_def"].getString().c_str()));
		Equipment* equipment = new Equipment();
		equipment->setWeapon(Weapon(atoi(data["0"]["current_weapon"].getString().c_str())));
		equipment->setBase(Base(atoi(data["0"]["current_base"].getString().c_str())));
		equipment->setPlate(Plate(atoi(data["0"]["current_plate"].getString().c_str())));//
		USER->setOpenChaptersNumber(atoi(data["0"]["open_chapters_number"].getString().c_str()));
		USER->setWinOnlineGamesNumber(atoi(data["0"]["win_online_game_number"].getString().c_str()));
		USER->setPlayOnlineGamesNumber(atoi(data["0"]["play_online_game_number"].getString().c_str()));
		USER->setMoney(atoi(data["0"]["money"].getString().c_str()));
		CCLOG(data["0"]["money"].getString().c_str());
		USER->setHonor(atoi(data["0"]["honor"].getString().c_str()));
		USER->setHasSignin(true);
		USER->setIsBeginner(false);
		USER->flush();
		CCNode* parent = this->getParent();
		this->removeFromParentAndCleanup();
		INFORMATION_BOX("Login successfully!",parent);
	}
	else{
		PopWindowsLayer::createInfomationBox("Login failed!",this);
	}
}
Beispiel #26
0
Weapon Store::purchaseItem(int i, int gold)
{
    if (i > 0)
    {
        switch (option)
        {
            case 1:
                if (i <= weapons.size() && weapons.at(i - 1).getCost() <= gold)
                {
                    return weapons.at(i - 1);
                }
                else if (weapons.at(i - 1).getCost() <= gold)
                {
                    cout << "\r\nNot enough gold!\r\n";
                }
                break;
            case 2:
                if (i <= spells.size() && spells.at(i - 1).getCost() <= gold)
                {
                    return spells.at(i - 1);
                }
                else if (spells.at(i - 1).getCost() <= gold)
                {
                    cout << "\r\nNot enough gold!\r\n";
                }
                break;
            case 3:
                if (i <= potions.size() && potions.at(i - 1).getCost() <= gold)
                {
                    return potions.at(i - 1);
                }
                else if (potions.at(i - 1).getCost() <= gold)
                {
                    cout << "\r\nNot enough gold!\r\n";
                }
                break;
        }
    }
    return Weapon();
}
Beispiel #27
0
bool BaseAI::startTurn()
{
  int count = 0;
  count = getWallCount();
  walls.clear();
  walls.resize(count);
  for(int i = 0; i < count; i++)
  {
    walls[i] = Wall(getWalls()+i);
  }
  count = getCrateCount();
  crates.clear();
  crates.resize(count);
  for(int i = 0; i < count; i++)
  {
    crates[i] = Crate(getCrates()+i);
  }
  count = getWeaponCount();
  weapons.clear();
  weapons.resize(count);
  for(int i = 0; i < count; i++)
  {
    weapons[i] = Weapon(getWeapons()+i);
  }
  count = getHumanCount();
  humans.clear();
  humans.resize(count);
  for(int i = 0; i < count; i++)
  {
    humans[i] = Human(getHumans()+i);
  }
  count = getZombieCount();
  zombies.clear();
  zombies.resize(count);
  for(int i = 0; i < count; i++)
  {
    zombies[i] = Zombie(getZombies()+i);
  }
  count = getAirstrikeCount();
  airstrikes.clear();
  airstrikes.resize(count);
  for(int i = 0; i < count; i++)
  {
    airstrikes[i] = Airstrike(getAirstrikes()+i);
  }
  count = getSpawnzoneCount();
  spawnzones.clear();
  spawnzones.resize(count);
  for(int i = 0; i < count; i++)
  {
    spawnzones[i] = Spawnzone(getSpawnzones()+i);
  }

  if(turnNum() == 1)
  {
    init();
    if(!isHuman())
    {
      return true;
     }
  }

  if(isHuman())
  {
    return runHuman();
  }
  else
  {
    return runZombie();
  }
}
Beispiel #28
0
Spaceship::Spaceship(sf::Texture &t, sf::Texture &expt, sf::SoundBuffer& expBuffer) : anim(0,0), weapon(Weapon()),SpaceObject(t,expt,expBuffer,HEALTH_MAX = 1500,5)
{
    sprite.setTexture(t);
    sprite.setTextureRect(sf::IntRect(anim.x, anim.y, 100, 94));
    sprite.setScale(sf::Vector2f(0.6, 0.6));
    sprite.setPosition(100, 100);
}
bool Battle::fight()
{
    bool attack = false, display = true;

    if (option == INVENTORY)
    {
        display = false;
    }

    spell = &Weapon();

    srand(timeCount + hero->getHealth() + monster.getHealth() + monster.getPrize() + monster.getStrength());

    while (option == FIGHT || option == SPELL || option == INVENTORY)
    {
        timeCount++;

        if (option == INVENTORY && !display)
        {
            hero->displayInventory(SHOW_ALL);
            display = true;

            cout << "\r\n\n\tHP: " << hero->getHealth();
            cout << "\tMana: " << hero->getMana();
            cout << "\tMonster HP: " << monster.getHealth();
            cout << "\r\n1) Fight\r\n2) Cast a Spell\r\n3) Inventory\r\n4) Flee\r\n>>";
            cin >> option;

            if (option != FIGHT && option != SPELL && option != INVENTORY)
            {
                cout << "\r\nYou fled the battle!\r\n\n";
                return false;
            }
            else if (option == 3)
            {
                display = false;
            }
        }

        if (timeCount % hMod == 0
            && timeCount % mMod != 0)
        {
            attack = heroAttack();
        }
        else if (timeCount % mMod == 0
            && timeCount % hMod != 0)
        {
            spellOngoing(0, 0);

            attack = monsterAttack();
        }
        else if (timeCount % mMod == 0
            && timeCount % hMod == 0)
        {
            if (hMod <= mMod)
            {
                attack = heroAttack();

                if (attack)
                {
                    spellOngoing(0, 0);

                    attack = monsterAttack();
                }
            }
            else if (hMod >= mMod)
            {
                spellOngoing(0, 0);

                attack = monsterAttack();

                if (attack)
                {
                    attack = heroAttack();
                }
            }
        }

        if (hero->isDead() || monster.isDead())
        {
            return hero->isDead();
        }

        if (attack)
        {
            cout << "\r\n\n\tHP: " << hero->getHealth();
            cout << "\tMana: " << hero->getMana();
            cout << "\tMonster HP: " << monster.getHealth();
            cout << "\r\n1) Fight\r\n2) Cast a Spell\r\n3) Inventory\r\n4) Flee\r\n>>";
            cin >> option;

            if (option != FIGHT && option != SPELL && option != INVENTORY)
            {
                cout << "\r\nYou fled the battle!\r\n\n";
                return false;
            }
            else if (option == INVENTORY)
            {
                display = false;
            }
        }

        attack = false;
    }
Beispiel #30
-1
void buildatlas_weapon(std::vector<Weapon>& atlas)
{
	// Weapon(Name, Description, Die Quatity, Die Sides, Hit Rate)
	atlas.push_back(Weapon("Iron Dagger", "A short blade made of iron with a leather-bound hilt", 1, 4, 1));
	atlas.push_back(Weapon("Long Sword", "A galvanized steel blade with ample length and a respectable point", 1, 6, 2));
	atlas.push_back(Weapon("Excalibur", "The legendary blade, bestowed upon you by the Lady of the Lake", 3, 6, 5));

	return;
}