本文整理汇总了C++中Armor::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Armor::getName方法的具体用法?C++ Armor::getName怎么用?C++ Armor::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Armor
的用法示例。
在下文中一共展示了Armor::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equip
void Player::equip(Equipment * eq)
{
Armor * pArm = dynamic_cast<Armor*>(eq);
if (pArm != NULL)
{
vInventory.push_back(armor);
armor = pArm;
cout << "You have equipped a " << pArm->getName() << "!" << endl;
}
Weapon * pWeap = dynamic_cast<Weapon *>(eq);
if (pWeap != NULL)
{
vInventory.push_back(weapon);
weapon = pWeap;
cout << "You have equipped a " << pWeap->getName() << "!" << endl;
}
}
示例2: getViewScreen
void MenuInventory::getViewScreen() {
DM::say("Gear:");
Player *player = _game->getPlayer();
Weapon *main = player->getMainWeapon();
if (main) {
int base = player->getStrength();
string type = "";
switch (main->getWeaponType()) {
case WeaponType::SIMPLE:
type = "Simple Weapon";
break;
case WeaponType::FINESSE:
if (player->getDexterity() > player->getStrength()) {
base = player->getDexterity();
}
type = "Finesse Weapon";
break;
case WeaponType::MARTIAL:
type = "Martial Weapon";
break;
case WeaponType::HEAVY:
type = "heavy Weapon";
break;
case WeaponType::SHIELD:
type = "Shield";
break;
}
DM::say("\t<Main> Weapon: " + main->getName() + " (" + to_string(main->getDiceAmount()) + "d" +
to_string(main->getDiceSize()) + "+" + to_string(base) + " " + type + ")");
} else {
DM::say("\t<Main> Weapon: None");
}
Weapon *off = player->getOffHandWeapon();
if (off) {
int base = player->getStrength();
string type = "";
switch (off->getWeaponType()) {
case WeaponType::SIMPLE:
type = "Simple Weapon";
break;
case WeaponType::FINESSE:
if (player->getDexterity() > player->getStrength()) {
base = player->getDexterity();
}
type = "Finesse Weapon";
break;
case WeaponType::MARTIAL:
type = "Martial Weapon";
break;
case WeaponType::HEAVY:
type = "heavy Weapon";
break;
case WeaponType::SHIELD:
type = "Shield (+2AC)";
break;
}
DM::say("\t<Off>hand Weapon: " + off->getName() + " (" + to_string(off->getDiceAmount()) + "d" +
to_string(off->getDiceSize()) + "+" + to_string(base) + " " + type + ")");
} else {
DM::say("\t<Off>hand Weapon: None");
}
Armor *armor = player->getArmor();
if (armor) {
string extra = "";
switch (armor->getArmorType()) {
case ArmorType::LIGHT:
extra = " + Dex ";
break;
case ArmorType::MEDIUM:
extra = " + max 2 Dex ";
break;
case ArmorType::HEAVY:
break;
}
DM::say("\t<Armor>: " + armor->getName() + " ( AC: " + to_string(armor->getBaseAC()) + extra + ")");
} else {
DM::say("\t<Armor>: None");
}
DM::say("\nInventory:");
int i = 1;
for (map<Item *, int>::iterator item = _inventory->begin(); item != _inventory->end(); ++item) {
switch (item->first->getItemType()) {
case ItemType::ARMOR: {
Armor *armor = (Armor *) item->first;
string extra = "";
switch (armor->getArmorType()) {
case ArmorType::LIGHT:
extra = " + Dex ";
break;
case ArmorType::MEDIUM:
extra = " + max 2 Dex ";
break;
case ArmorType::HEAVY:
break;
//.........这里部分代码省略.........