コード例 #1
0
ファイル: Enemy.cpp プロジェクト: hackon/MakingGamesWithBen
int Enemy::attack()
{
	static default_random_engine engine(time(NULL));
	uniform_int_distribution<int> attackRoll(0, _attack);

	return attackRoll(engine);
}
コード例 #2
0
/***********************************************************************************************
* Function: attack()
* Description: This function lets this creature attack another one
* Parameters: none
* Pre-Conditions: an object of this class must be created
* Post-Conditions: none
* Return: the attack points directed towards the opposing creature
*************************************************************************************************/
int Medusa::attack(){
    int damage = attackRoll();
    if (damage == 12){  // SPECIAL ABLITY
        cout << "Medusa rolled a 12! Opponent has looked in Medusa's eyes and turned to stone!" << endl;
        damage = 999;
    }else if(damage != 12){
        cout << "Medusa attacks! Medusa generated " << damage << " damage points to opponent..." << endl;
    }
    return damage;
}
コード例 #3
0
/***********************************************************************************************
* Function: attack()
* Description: This function lets this creature attack another one
* Parameters: none
* Pre-Conditions: an object of this class must be created
* Post-Conditions: none
* Return: the attack points directed towards the opposing creature
*************************************************************************************************/
int Vampire::attack(){
    int damage = attackRoll();
    cout << "Vampire attacks! Vampire generated " << damage << " damage points to opponent..." << endl;
    return damage;
}
コード例 #4
0
ファイル: Enemy.cpp プロジェクト: HealingQuickly/ASCII_Rouge
int Enemy::attack(){
	static mt19937 randomEngine(time(0));
	uniform_int_distribution<int> attackRoll(0, _attack);

	return attackRoll(randomEngine);
}
コード例 #5
0
/***********************************************************************************************
* Function: attack()
* Description: This function lets this creature attack another one
* Parameters: none
* Pre-Conditions: an object of this class must be created
* Post-Conditions: none
* Return: the attack points directed towards the opposing creature
*************************************************************************************************/
int BlueMen::attack(){
    int damage = attackRoll();
    cout << "Blue Men attack! Blue Men generated " << damage << " damage points to opponent..." << endl;
    return damage;
}