示例#1
0
TEST (Monster, Attack_HitAndDamageRolls)
{
    Monster m = (Monster&) Monster ("m", 50)
        .Weaponed(Weapon("Sword", Range(1,6)))
        .WithStat(Statistics()
            .SetHitPoint(5)
            .SetAccuracy(12)
            .SetArmor(5));
    
    Player p1 = (Player&) Player ("P1")
        .WithStat(Statistics()
            .SetHitPoint(10)
            .SetArmor(5)
            .SetAccuracy(10));
    
    int hitRoll = 0;
    int damageRoll = 0;
    
    m.Attack (p1);

    //cout << "HIT ROLL " << hitRoll << endl;
    //cout << "DAMAGE ROLL " << damageRoll << endl;
    //cout << "PLAYER HP " << p1.GetStatistics().HitPoint () << endl;
        
    EXPECT_GE (20, m.GetLastHitRoll());
    EXPECT_LE (1, m.GetLastHitRoll());

    EXPECT_GE (6, m.GetLastDamageRoll());
    EXPECT_LE (0, m.GetLastDamageRoll());
}