File indexing completed on 2024-05-12 05:39:28

0001 #ifndef REROLLDICENODE_H
0002 #define REROLLDICENODE_H
0003 
0004 #include "executionnode.h"
0005 #include "result/diceresult.h"
0006 
0007 class ValidatorList;
0008 /**
0009  * @brief The RerollDiceNode class reroll dice given a condition and replace(or add) the result.
0010  */
0011 class RerollDiceNode : public ExecutionNode
0012 {
0013 public:
0014     /**
0015      * @brief The ReRollMode enum
0016      */
0017     enum ReRollMode
0018     {
0019         EQUAL,
0020         LESSER,
0021         GREATER
0022     };
0023     /**
0024      * @brief RerollDiceNode
0025      * @param reroll If true reroll the dice only once, otherwise until the condition is false
0026      */
0027     RerollDiceNode(bool reroll, bool addingMode);
0028 
0029     /**
0030      * @brief ~RerollDiceNode
0031      */
0032     virtual ~RerollDiceNode();
0033     /**
0034      * @brief run
0035      * @param previous
0036      */
0037     virtual void run(ExecutionNode* previous);
0038 
0039     /**
0040      * @brief setValidator
0041      */
0042     virtual void setValidatorList(ValidatorList*);
0043     /**
0044      * @brief toString
0045      * @return
0046      */
0047     virtual QString toString(bool) const;
0048     /**
0049      * @brief getPriority
0050      * @return
0051      */
0052     virtual qint64 getPriority() const;
0053 
0054     /**
0055      * @brief getCopy
0056      * @return
0057      */
0058     virtual ExecutionNode* getCopy() const;
0059 
0060     ExecutionNode* getInstruction() const;
0061     void setInstruction(ExecutionNode* instruction);
0062 
0063 private:
0064     DiceResult* m_diceResult= nullptr;
0065     ValidatorList* m_validatorList= nullptr;
0066     ExecutionNode* m_instruction= nullptr;
0067 
0068     const bool m_reroll;
0069     const bool m_adding;
0070 };
0071 
0072 #endif // REROLLDICENODE_H