weapon::weapon (string name, CHARACTER_WEAPON type, SIZE_CATEGORY size, int damage, int dice, int range, double value, double weight, bool reach, int enhancementBonus, DAMAGE_TYPE one, DAMAGE_TYPE two, DAMAGE_TYPE three, WEAPON_CATEGORY cat, WEAPON_SUBCATEGORY subcat, int critChance, int critValue, MATERIAL substance ) { setItemName(name); setDamageDie(damage); setNumDMGDice(dice); setWeaponType(type); setRangeIncrement(range); setWeight(weight); setBaseValue(value); setHardness(subcat, substance, enhancementBonus); setDurability(subcat, substance, enhancementBonus, size); setSize(size); setReach(reach); setDamageType1( one ); setDamageType2( two ); setDamageType3( three ); setCritChance(critChance); setCritValue(critValue); setWeaponCategory( cat ); setWeaponSubCategory ( subcat ); setEnhancementBonus (enhancementBonus); }
/** * Set the value of the algorithm property from a Json value * @param value A reference * @return An empty string if the value is valid, otherwise the string will * contain the error */ std::string AlgorithmProperty::setValueFromJson(const Json::Value &value) { try { return setBaseValue(Algorithm::fromJson(value)); } catch (std::exception &exc) { return exc.what(); } }
/** * Set value of the algorithm * Attempts to create an Algorithm object * @param value :: The string format for an algorithm, @see Algorithm::toString * @return An empty string if the value is valid, otherwise the string will * contain the error */ std::string AlgorithmProperty::setValue(const std::string &value) { try { return setBaseValue(Algorithm::fromString(value)); } catch (std::exception &exc) { return exc.what(); } }
void CurrDisplay::set(const double newValue, const int newId, const QDate& newDate, const bool isBase) { bool emitId = false; bool emitDate = false; if (newId != id()) { emitId = true; _localId = newId; } if (newDate != _effective) { emitDate = true; _effective = newDate; } if (isBase) setBaseValue(newValue); else setLocalValue(newValue); if (emitId) emit idChanged(newId); if (emitDate) emit effectiveChanged(newDate); }
void Building::setAttributes(int type) { BuildingBaseStatus* baseStatus = field->getBaseStatus()->getBuildingBaseStatus(type); setBaseValue(baseStatus->getBaseValue()); setAttackRate(baseStatus->getAttackRate()); setAttack(baseStatus->getAttack()); setRangeOfEffect(baseStatus->getRangeOfEffect()); }
void TMyPaintBrushStyle::loadData(TInputStreamInterface &is) { std::string path; is >> path; is >> m_color; loadBrush(TFilePath(path)); int baseSettingsCount = 0; is >> baseSettingsCount; for(int i = 0; i < baseSettingsCount; ++i) { std::string key; double value = 0.0; int inputsCount = 0; is >> key; is >> value; const mypaint::Setting *setting = mypaint::Setting::findByKey(key); if (setting) setBaseValue(setting->id, value); } }
weapon::weapon ( CHARACTER_WEAPON type ) { setWeaponsArray(); char*** myWeapons = getWeaponsArray(); int row; switch (type) { case 0: row = 0; break; case 1: row = 1; break; case 2: row = 2; break; case 3: row = 3; break; default: row = 1; break; } setItemName((string)(myWeapons[row][0])); setDamageDie(atoi(myWeapons[row][2])); setNumDMGDice(atoi(myWeapons[row][3])); setWeaponType((CHARACTER_WEAPON)atoi(myWeapons[row][1])); setRangeIncrement(atoi(myWeapons[row][5])); setWeight(atoi(myWeapons[row][6])); setBaseValue(atoi(myWeapons[row][7])); setHardness((WEAPON_SUBCATEGORY)atoi(myWeapons[row][8]), (MATERIAL)atoi(myWeapons[row][9]), atoi(myWeapons[row][10])); setDurability((WEAPON_SUBCATEGORY)atoi(myWeapons[row][8]), (MATERIAL)atoi(myWeapons[row][9]), atoi(myWeapons[row][10]), size); setSize(size); setReach((bool)atoi(myWeapons[row][11])); setDamageType1( (DAMAGE_TYPE)atoi(myWeapons[row][12]) ); setDamageType2( (DAMAGE_TYPE)atoi(myWeapons[row][12]) ); setDamageType3( (DAMAGE_TYPE)atoi(myWeapons[row][12]) ); setCritChance(atoi(myWeapons[row][13])); setCritValue(atoi(myWeapons[row][14])); setWeaponCategory( (WEAPON_CATEGORY)atoi(myWeapons[row][15]) ); setWeaponSubCategory ( (WEAPON_SUBCATEGORY)atoi(myWeapons[row][8]) ); setEnhancementBonus (atoi(myWeapons[row][10])); }
weapon::weapon () { setDamageDie(8); setNumDMGDice(1); setWeaponType(myEnums::LONGSWORD); setItemName("longsword"); setRangeIncrement(0); setWeight(4.0); setBaseValue(15.0); setHardness(ONE_HANDED_MELEE, METAL, 0); setDurability( ONE_HANDED_MELEE, METAL, 0, MEDIUM); setSize(MEDIUM); setReach(false); setDamageType1( SLASHING ); setDamageType2( SLASHING ); setDamageType3( SLASHING ); setCritChance(19); setCritValue(2); setWeaponCategory( MARTIAL ); setWeaponSubCategory ( ONE_HANDED_MELEE ); setEnhancementBonus (0); }
void TMyPaintBrushStyle::loadBrush(const TFilePath &path) { m_path = path; m_fullpath = decodePath(path); m_brushOriginal.fromDefaults(); Tifstream is(m_fullpath); if (is) { std::string str; str.assign( std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>() ); m_brushOriginal.fromString(str); } m_brushModified = m_brushOriginal; std::map<MyPaintBrushSetting, float> baseValuesCopy; baseValuesCopy.swap(m_baseValues); for(std::map<MyPaintBrushSetting, float>::const_iterator i = baseValuesCopy.begin(); i != baseValuesCopy.end(); ++i) setBaseValue(i->first, i->second); TFilePath preview_path = m_fullpath.getParentDir() + (m_fullpath.getWideName() + L"_prev.png"); TImageReader::load(preview_path, m_preview); invalidateIcon(); }
weapon::weapon ( SIZE_CATEGORY size) { switch ( size ) { case 0: this->size = FINE; setDamageDie(2); setNumDMGDice(1); break; case 1: this->size = DIMINUTIVE; setDamageDie(3); setNumDMGDice(1); break; case 2: this->size = TINY; setDamageDie(4); setNumDMGDice(1); break; case 3: this->size = SMALL; setDamageDie(6); setNumDMGDice(1); break; case 4: this->size = MEDIUM; setDamageDie(8); setNumDMGDice(1); break; case 5: this->size = LARGE; setDamageDie(6); setNumDMGDice(2); break; case 6: this->size = myEnums::HUGE; setDamageDie(6); setNumDMGDice(3); break; case 7: this->size = GARGANTUAN; setDamageDie(6); setNumDMGDice(4); break; case 8: this->size = COLOSSAL; setDamageDie(6); setNumDMGDice(6); break; case 9: this->size = COLOSSAL_P; setDamageDie(6); setNumDMGDice(7); break; case 10: this->size = COLOSSAL_PP; setDamageDie(6); setNumDMGDice(8); break; default: this->size = MEDIUM; setDamageDie(8); setNumDMGDice(1); break; } setWeaponType(myEnums::LONGSWORD); setItemName("longsword"); setRangeIncrement(0); setWeight(4.0); setBaseValue(15.0); setHardness(ONE_HANDED_MELEE, METAL, 0); setDurability(ONE_HANDED_MELEE, METAL, 0, MEDIUM); setReach(false); setDamageType1( SLASHING ); setDamageType2( SLASHING ); setDamageType3( SLASHING ); setCritChance(19); setCritValue(2); setWeaponCategory( MARTIAL ); setWeaponSubCategory ( ONE_HANDED_MELEE ); setEnhancementBonus (0); }
void TMyPaintBrushStyle::setParamValue(int index, double value) { setBaseValue((MyPaintBrushSetting)index, value); }