aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/rerolldicenode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/rerolldicenode.cpp')
-rw-r--r--node/rerolldicenode.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/node/rerolldicenode.cpp b/node/rerolldicenode.cpp
index f7df0fa..21e0dbf 100644
--- a/node/rerolldicenode.cpp
+++ b/node/rerolldicenode.cpp
@@ -41,12 +41,32 @@ void RerollDiceNode::run(ExecutionNode* previous)
for(int i = 0; i < list.size() ; ++i)
{
auto die = list.at(i);
- while(m_validator->hasValid(die,false))
+ bool finished = false;
+ while(m_validator->hasValid(die,false) && !finished)
{
- die->roll(m_adding);
+ qDebug() << "reroll"<< die->getValue() << m_instruction;
+ if(m_instruction != nullptr)
+ {
+ m_instruction->run(this);
+ auto lastNode = ParsingToolBox::getLatestNode(m_instruction);
+ if(lastNode != nullptr)
+ {
+ auto lastResult = dynamic_cast<DiceResult*>(lastNode->getResult());
+ if(lastResult != nullptr)
+ {
+ toRemove.append(die);
+ list.append(lastResult->getResultList());
+ }
+ lastResult->clear();
+ }
+ }
+ else
+ {
+ die->roll(m_adding);
+ }
if(m_reroll)
{
- break;
+ finished = true;
}
}
}