File indexing completed on 2024-05-12 05:39:28
0001 /************************************************************************* 0002 * Copyright (C) 2009 by Renaud Guezennec * 0003 * * 0004 * https://rolisteam.org/ * 0005 * * 0006 * rolisteam is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published * 0008 * by the Free Software Foundation; either version 2 of the License, * 0009 * or (at your option) any later version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, * 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0014 * GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License * 0017 * along with this program; if not, write to the * 0018 * Free Software Foundation, Inc., * 0019 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0020 *************************************************************************/ 0021 #ifndef LISTSETROLLNODE_H 0022 #define LISTSETROLLNODE_H 0023 0024 #include <QStringList> 0025 0026 #include "executionnode.h" 0027 #include "range.h" 0028 #include "result/diceresult.h" 0029 #include "result/stringresult.h" 0030 /** 0031 * @brief The ListSetRollNode class is dedicated to pick up item from list. 0032 */ 0033 class ListSetRollNode : public ExecutionNode 0034 { 0035 public: 0036 ListSetRollNode(); 0037 virtual ~ListSetRollNode(); 0038 virtual void run(ExecutionNode* previous= nullptr); 0039 virtual QString toString(bool) const; 0040 virtual qint64 getPriority() const; 0041 QStringList getList() const; 0042 0043 void setListValue(QStringList); 0044 void setUnique(bool); 0045 void setNoComma(bool); 0046 void setRangeList(QList<Range>&); 0047 virtual ExecutionNode* getCopy() const; 0048 0049 private: 0050 void getValueFromDie(Die* die, QStringList& rollResult); 0051 void computeFacesNumber(Die* die); 0052 0053 private: 0054 QStringList m_values; 0055 DiceResult* m_diceResult; 0056 StringResult* m_stringResult; 0057 std::vector<int> m_rangeIndexResult; 0058 bool m_unique; 0059 QList<Range> m_rangeList; 0060 }; 0061 0062 #endif // LISTSETROLLNODE_H