本文整理汇总了C++中Arena::Roll方法的典型用法代码示例。如果您正苦于以下问题:C++ Arena::Roll方法的具体用法?C++ Arena::Roll怎么用?C++ Arena::Roll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arena
的用法示例。
在下文中一共展示了Arena::Roll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defense
/*********************************************************************************
*Description - Defense fn
*fn that send number of die and faces to Arena class and assesses the amount of
*damage received
*Parameters - Passes the amount of damage received to the the Armor fn, using
polymorphism
*********************************************************************************/
void Reptile::defense() {
int defend, damage, impact;
battle3.setNumFaces(R_DEFEND_FACE);
battle3.setNumDice(R_DEFEND_DIE);
defend = battle3.Roll();
battle3.setDefendRoll(defend);
damage = battle3.deathBlow();
if(damage == 0)
{
cout << "No damage!!" << endl;
}
else if(damage > R_ARMOR)
{
impact = damage - R_ARMOR;
cout << "The Reptile People were injured! Because of armor, it only had an impact of: -"<< impact << endl;
}
else if((damage > 0) && (damage <= R_ARMOR))
{
cout << "The Reptile People were hit, but were saved by their armor!!" << endl;
}
Character *chr = &rep;
chr->armor(damage);
chr->strength();
}
示例2: attack
/*********************************************************************************
*Description - Attack fn Fn that passes number of die and die faces to Arena fn
*Parameters - CONST for number of die and die faces
*********************************************************************************/
void Reptile::attack() {
int attack;
battle3.setNumFaces(R_ATTACK_FACE);
battle3.setNumDice(R_ATTACK_DIE);
attack = battle3.Roll();
cout << "The Reptile People delivered a heavy blow to the opponent with a force of: " << attack << endl;
battle3.setAttackRoll(attack);
}