aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/booleancondition.cpp
blob: f2d39fabb2ac9443fb0ba1e2a24e27459289fb33 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "booleancondition.h"


BooleanCondition::BooleanCondition()
{
}
bool BooleanCondition::isValid(Die* b) const
{
    switch(m_operator)
    {
    case Equal:
        return (b->getLastRolledValue()==m_value);
    case GreaterThan:
        return (b->getLastRolledValue()>m_value);
    case LesserThan:
        return (b->getLastRolledValue()<m_value);
    case GreaterOrEqual:
        return (b->getLastRolledValue()>=m_value);
    case LesserOrEqual:
        return (b->getLastRolledValue()<=m_value);


    }
    return false;
}

void BooleanCondition::setOperator(LogicOperator m)
{
    m_operator = m;
}

void BooleanCondition::setValue(qint64 v)
{
    m_value=v;
}