void NetwalkWindow::skillDropdownClick( DropdownList& list, DropListItem& item ) { if ( item.text() == L"Easy" ) { setSkill( 0 ); } else if ( item.text() == L"Normal" ) { setSkill( 1 ); } else if ( item.text() == L"Hard" ) { setSkill( 2 ); } newGame(); //newRandomMap(); }
DECLARE_EXPORT int ResourceSkill::setattro(const Attribute& attr, const PythonObject& field) { if (attr.isA(Tags::tag_resource)) { if (!field.check(Resource::metadata)) { PyErr_SetString(PythonDataException, "resourceskill resource must be of type resource"); return -1; } Resource* y = static_cast<Resource*>(static_cast<PyObject*>(field)); setResource(y); } else if (attr.isA(Tags::tag_skill)) { if (!field.check(Skill::metadata)) { PyErr_SetString(PythonDataException, "resourceskill skill must be of type skill"); return -1; } Skill* y = static_cast<Skill*>(static_cast<PyObject*>(field)); setSkill(y); } else if (attr.isA(Tags::tag_priority)) setPriority(field.getInt()); else if (attr.isA(Tags::tag_effective_end)) setEffectiveEnd(field.getDate()); else if (attr.isA(Tags::tag_effective_start)) setEffectiveStart(field.getDate()); else return -1; return 0; }
void BTPc::updateSkills() { BTJobList &jobList = BTGame::getGame()->getJobList(); for (int i = 0; i < jobList[job]->skill.size(); ++i) { int value = jobList[job]->skill[i]->value; if ((jobList[job]->skill[i]->modifier >= 0) && (stat[jobList[job]->skill[i]->modifier] > 14)) value += stat[jobList[job]->skill[i]->modifier] - 14; if (getSkill(jobList[job]->skill[i]->skill) == 0) { setSkill(jobList[job]->skill[i]->skill, value, value); if (jobList[job]->skill[i]->improve > 0) { for (int sk = 0; sk < skill.size(); ++sk) { if (skill[sk]->skill == jobList[job]->skill[i]->skill) { for (int k = 2; k <= level; ++k) { if ((k % jobList[job]->skill[i]->improveLevel) == 0) { unsigned int increase = BTDice(1, jobList[job]->skill[i]->improve).roll(); if ((jobList[job]->skill[i]->modifier >= 0) && (stat[jobList[job]->skill[i]->modifier] > 14)) increase += stat[jobList[job]->skill[i]->modifier] - 14; skill[sk]->value += increase; skill[sk]->history.push_back(increase); } } break; } } } } } }
Brain::Brain(int initValue) { setSkill(Prefs::EnumSkill::Beginner); stopped=false; active=false; currentLevel=0; // initialize the random number generator random.setSeed(initValue); }
bool PlayerCreateState::_skillToggle(unsigned int num) { auto player = Game::getInstance()->player(); if (player->skill(num)) { player->setSkill(num, 0); player->setSkillsPoints(player->skillsPoints() + 1); return true; } else { if (player->skillsPoints() > 0) { player->setSkill(num, 1); player->setSkillsPoints(player->skillsPoints() - 1); return true; } } return false; }
void CSong::init2(CScore * scoreWin, CSettings* settings) { CNote::setChannelHands(-2, -2); // -2 for not set -1 for none this->CConductor::init2(scoreWin, settings); setActiveHand(PB_PART_both); setPlayMode(PB_PLAY_MODE_followYou); setSpeed(1.0); setSkill(3); }
DECLARE_EXPORT ResourceSkill::ResourceSkill(Skill* s, Resource* r, int u) { setSkill(s); setResource(r); setPriority(u); initType(metadata); try { validate(ADD); } catch (...) { if (getSkill()) getSkill()->resources.erase(this); if (getResource()) getResource()->skills.erase(this); resetReferenceCount(); throw; } }
bool SkillItem::setSkill(string skillFile) { bool bRet = false; do { Skill* pSkill = SkillSystem::create(skillFile.c_str()); CC_BREAK_IF(!pSkill); setSkill(pSkill);//设定技能 bRet = true; } while (0); return bRet; }
DECLARE_EXPORT void ResourceSkill::endElement (XMLInput& pIn, const Attribute& pAttr, const DataElement& pElement) { if (pAttr.isA (Tags::tag_resource)) { Resource *r = dynamic_cast<Resource*>(pIn.getPreviousObject()); if (r) setResource(r); else throw LogicException("Incorrect object type during read operation"); } else if (pAttr.isA (Tags::tag_skill)) { Skill *s = dynamic_cast<Skill*>(pIn.getPreviousObject()); if (s) setSkill(s); else throw LogicException("Incorrect object type during read operation"); } else if (pAttr.isA(Tags::tag_priority)) setPriority(pElement.getInt()); else if (pAttr.isA(Tags::tag_effective_end)) setEffectiveEnd(pElement.getDate()); else if (pAttr.isA(Tags::tag_effective_start)) setEffectiveStart(pElement.getDate()); else if (pAttr.isA(Tags::tag_action)) { delete static_cast<Action*>(pIn.getUserArea()); pIn.setUserArea( new Action(MetaClass::decodeAction(pElement.getString().c_str())) ); } else if (pIn.isObjectEnd()) { // The resourceskill data is now all read in. See if it makes sense now... Action a = pIn.getUserArea() ? *static_cast<Action*>(pIn.getUserArea()) : ADD_CHANGE; delete static_cast<Action*>(pIn.getUserArea()); try { validate(a); } catch (...) { delete this; throw; } } }
void File::_initialize() { if (_initialized) return; Dat::Item::_initialize(); Dat::Item::setPosition(0); uint32(); // unknown 1 // primary stats for (unsigned i = (unsigned)STAT::STRENGTH; i <= (unsigned)STAT::LUCK; i++) { setStat((STAT)i, uint32()); } // secondary stats _hitPoints = uint32(); _actionPoints = uint32(); _armorClass = uint32(); uint32(); // unknown 2 _meleeDamage = uint32(); _carryWeight = uint32(); _sequence = uint32(); _healingRate = uint32(); _criticalChance = uint32(); _criticalHitModifier = uint32(); for (unsigned i = (unsigned)DAMAGE::NORMAL; i <= (unsigned)DAMAGE::EXPLOSIVE; i++) { setDamage((DAMAGE)i, uint32()); } for (unsigned i = (unsigned)DAMAGE::NORMAL; i <= (unsigned)DAMAGE::EXPLOSIVE; i++) { setResistance((DAMAGE)i, uint32()); } _radiationResistance = uint32(); _poisonResistance = uint32(); _age = uint32(); _gender = (GENDER)uint32(); // bonuses to primary stats for (unsigned i = (unsigned)STAT::STRENGTH; i <= (unsigned)STAT::LUCK; i++) { setStatBonus((STAT)i, uint32()); } // bonuses to secondary stats _hitPointsBonus = uint32(); _actionPointsBonus = uint32(); _armorClassBonus = uint32(); uint32(); // unknown 3 _meleeDamageBonus = uint32(); _carryWeightBonus = uint32(); _sequenceBonus = uint32(); _healingRateBonus = uint32(); _criticalChanceBonus = uint32(); _criticalHitModifierBonus = uint32(); for (unsigned i = (unsigned)DAMAGE::NORMAL; i <= (unsigned)DAMAGE::EXPLOSIVE; i++) { setDamageBonus((DAMAGE)i, uint32()); } for (unsigned i = (unsigned)DAMAGE::NORMAL; i <= (unsigned)DAMAGE::EXPLOSIVE; i++) { setResistanceBonus((DAMAGE)i, uint32()); } _radiationResistanceBonus = uint32(); _poisonResistanceBonus = uint32(); _ageBonus = uint32(); _genderBonus = uint32(); //skills for (unsigned i = (unsigned)SKILL::SMALL_GUNS; i <= (unsigned)SKILL::OUTDOORSMAN; i++) { setSkill((SKILL)i, uint32()); } // unknown uint32(); // unknown 4 uint32(); // unknown 5 uint32(); // unknown 6 uint32(); // unknown 7 // name char * name = new char[32](); this->readBytes(name, 32); setName(name); delete [] name; _firstTaggedSkill = (SKILL)int32(); _secondTaggedSkill = (SKILL)int32(); _thirdTaggedSkill = (SKILL)int32(); _fourthTaggedSkill = (SKILL)int32(); _firstTrait = (TRAIT)int32(); _secondTrait = (TRAIT)int32(); _characterPoints = uint32(); }
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags wf) : QMainWindow(parent, wf) { //setMinimumSize(geometry().size()); //setMaximumSize(geometry().size()); contrdirs[Cell::U] = Cell::D; contrdirs[Cell::R] = Cell::L; contrdirs[Cell::D] = Cell::U; contrdirs[Cell::L] = Cell::R; #ifndef QTOPIA_PHONE QString appdir = qApp->applicationDirPath(); soundpath = appdir + "/sounds/"; if(!QFile::exists(soundpath)) soundpath = appdir + "/../share/qnetwalk/sounds/"; winsound = new QSound(soundpath + "win.wav"); turnsound = new QSound(soundpath + "turn.wav"); clicksound = new QSound(soundpath + "click.wav"); startsound = new QSound(soundpath + "start.wav"); connectsound = new QSound(soundpath + "connect.wav"); #else QString appdir = qApp->applicationDirPath(); soundpath = ":sound/qnetwalk/"; winsound = new QSound(soundpath + "win"); turnsound = new QSound(soundpath + "turn"); clicksound = new QSound(soundpath + "click"); startsound = new QSound(soundpath + "start"); connectsound = new QSound(soundpath + "connect"); #endif QSettings settings("QNetEor", "QNetEor"); settings.beginGroup("QNetEor"); username = settings.value("Username", getenv("USER")).toString(); bool issound = settings.value("Sound", true).toBool(); highscores = settings.value("Highscores").toStringList(); if(highscores.count() != NumHighscores * 8) { highscores.clear(); for(int i = 1; i < 5; i++) { for(int scores = 20 * i; scores < 30 * i; scores += i) { highscores.append("..."); highscores.append(QString::number(scores)); } } } skill = settings.value("Skill", Novice).toInt(); if(skill != Novice && skill != Normal && skill != Expert) skill = Master; settings.endGroup(); for(int i = 1; i < qApp->argc(); i++) { QString argument = qApp->argv()[i]; if(argument == "-novice") skill = Novice; else if(argument == "-amateur") skill = Normal; else if(argument == "-expert") skill = Expert; else if(argument == "-master") skill = Master; else if(argument == "-nosound") issound = false; } setWindowTitle(tr("QNeoroid")); setWindowIcon(QPixmap(":/computer2.png")); #ifdef QTOPIA_PHONE QMenu *m = QSoftMenuBar::menuFor(this); #else QMenu *m = menuBar()->addMenu(tr("Options")); #endif soundaction = new QAction(tr("&Sound"), this); soundaction->setCheckable(true); soundaction->setChecked(issound); gamemenu = m->addMenu(tr("&Game")); gamemenu->addAction(QPixmap(":/newgame.png"), tr("&New"), this, SLOT(newGame())); gamemenu->addAction(QPixmap(":/highscores.png"), tr("&Highscores"), this, SLOT(showHighscores())); gamemenu->addAction(soundaction); #ifndef QTOPIA_PHONE gamemenu->addSeparator(); gamemenu->addAction(QPixmap(":/quit.png"), tr("&Quit"), qApp, SLOT(closeAllWindows())); #endif skillmenu = m->addMenu(tr("&Skill")); skillActionGroup = new QActionGroup(this); QAction* action; action = skillActionGroup->addAction(tr("&Novice")); action->setCheckable(true); if(skill == Novice) action->setChecked(true); connect(action, SIGNAL(triggered()), this, SLOT(setSkillNovice())); action = skillActionGroup->addAction(tr("&Amateur")); action->setCheckable(true); if(skill == Normal) action->setChecked(true); connect(action, SIGNAL(triggered()), this, SLOT(setSkillNormal())); action = skillActionGroup->addAction(tr("&Expert")); action->setCheckable(true); if(skill == Expert) action->setChecked(true); connect(action, SIGNAL(triggered()), this, SLOT(setSkillExpert())); action = skillActionGroup->addAction(tr("&Master")); action->setCheckable(true); if(skill == Master) action->setChecked(true); connect(action, SIGNAL(triggered()), this, SLOT(setSkillMaster())); skillmenu->addActions(skillActionGroup->actions()); QMenu* helpmenu = m->addMenu(tr("&Help")); helpmenu->addAction(tr("&Rules of Play"), this, SLOT(help())); helpmenu->addAction(QPixmap(":/homepage.png"), tr("&Homepage"), this, SLOT(openHomepage())); helpmenu->addSeparator(); helpmenu->addAction(QPixmap(":/qnetwalk.png"), tr("&About QNeoroid"), this, SLOT(about())); helpmenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); QToolBar* toolbar = new QToolBar(this); toolbar->setFloatable(false); toolbar->setMovable(false); toolbar->addAction(QPixmap(":/newgame.png"), tr("New Game"), this, SLOT(newGame())); toolbar->addAction(QPixmap(":/highscores.png"), tr("Show Highscores"), this, SLOT(showHighscores())); //toolbar->addWidget(new QLabel(tr("Moves"),this)); lcd = new QLCDNumber(toolbar); lcd->setFrameStyle(QFrame::Plain); toolbar->addWidget(lcd); //toolbar->addWidget(new QLabel(tr("Left:"),this)); cellsLcd = new QLCDNumber(toolbar); cellsLcd->setFrameStyle(QFrame::Plain); toolbar->addWidget(cellsLcd); addToolBar(toolbar); Cell::initPixmaps(); srand(time(0)); setSkill(skill); installEventFilter(this); resize(240,320); }
/* ============== SpawnEntities Creates a server's entity / program execution context by parsing textual entity definitions out of an ent file. ============== */ void Level::SpawnEntities( const char *themapname, const char *entities, int levelTime ) { int inhibit,count=0; const char *value; SpawnArgs args; char *spawnpos; // Init the level variables Init(); spawnpos = const_cast<char*>(strchr( themapname, '$' )); if ( spawnpos ) { mapname = str( themapname, 0, spawnpos - themapname ); spawnpoint = spawnpos + 1; } else { mapname = themapname; spawnpoint = ""; } // set up time so functions still have valid times setTime( levelTime, 1000 / 20 ); if ( !LoadingServer ) { // Get rid of anything left over from the last level //CleanUp( false ); // Set up for a new map thePathManager.Init( mapname ); } setSkill( skill->integer ); // reset out count of the number of game traces sv_numtraces = 0; // parse world entities = args.Parse( entities ); spawn_entnum = ENTITYNUM_WORLD; args.Spawn(); if ( !world ) Com_Error( ERR_FATAL, "No world\n" ); if ( g_gametype->integer == GT_MULTIPLAYER || g_gametype->integer == GT_BOT_SINGLE_PLAYER ) { multiplayerManager.initMultiplayerGame(); } // parse ents inhibit = 0; for( entities = args.Parse( entities ); entities != NULL; entities = args.Parse( entities ) ) { // remove things (except the world) from different skill levels or deathmatch spawnflags = 0; value = args.getArg( "spawnflags" ); if ( value ) { spawnflags = atoi( value ); if ( inhibitEntity( spawnflags ) ) { inhibit++; continue; } } args.Spawn(); count++; gi.ProcessLoadingScreen( "$$SpawningEntities$$" ); } gi.DPrintf( "%i entities spawned\n", count ); gi.DPrintf( "%i entities inhibited\n", inhibit ); // Process the spawn events L_ProcessPendingEvents(); if ( multiplayerManager.inMultiplayer() ) { multiplayerManager.initItems(); } // Setup bots if ( gi.Cvar_VariableIntegerValue( "bot_enable" ) && multiplayerManager.inMultiplayer() ) { BotAIShutdown( 0 ); BotAISetup( 0 ); BotAILoadMap( 0 ); G_InitBots( 0 ); } if ( !LoadingServer || game.autosaved ) { Start(); } postLoad(); //------------------------------------------------------------------------------- // // Deletion Note: // Since hNodeController is an Entity, it is deleted // when all the other entities are deleted in the clean up function // specifically the line // // // if ( active_edicts.next->entity ) // { // delete active_edicts.next->entity; // } // // // Since it is already being deleted like this // We do not need to explcitily delete the controller... In fact // you will error out if you try to. //-------------------------------------------------------------------------------- hNodeController = new HelperNodeController; if ( hNodeController ) hNodeController->SetTargetName( "HelperNodeController" ); // // if this is a single player game, spawn the single player in now // this allows us to read persistant data into the player before the client // is completely ready // if ( game.maxclients == 1 ) { spawn_entnum = 0; new Player; } }
Brotherhood::Brotherhood() { faction = "Brotherhood"; name = faction; S = 8; P = 9; E = 8; C = 3; I = 6; A = 1; L = 2; health = 100 + E*20; actualHealth = health; actionPoints = 65 + A*2; actualActionPoints = actionPoints; carryWeight = 150 + S*10; level = 1; damageResistance = 1; inventory.clear(); caps = 0; inventory.push_back(new GatlingLaser); inventory.push_back(new BrassKnuckles); inventory.push_back(new Armor("Power Armor", 15)); inventory.push_back(new PreWarFood); inventory.push_back(new PostWarFood); inventory.push_back(new ElectronChargePack); /* for (int i = 0; i<50; i++) { inventory.push_back(new ElectronChargePack); //cout<<"generating ammo\n"; } */ caps = 21; Barter = setSkill(C, level); EnergyWeapons = setNPCSkill(P, level, TAG); Explosives = setSkill(P, level); Guns = setSkill(A, level); Lockpick = setSkill(P, level); Medicine = setSkill(I, level); MeleeWeapons = setSkill(S, level); Repair = setSkill(I, level); Science = setSkill(I, level); Sneak = setSkill(A, level); Speech = setSkill(C, level); Survival = setSkill(E, level); Unarmed = setSkill(E, level); }
void GcdFileType::_initialize() { if (_initialized) return; DatFileItem::_initialize(); DatFileItem::setPosition(0); unsigned int uint32; // unknown 1 *this >> _unknown1; // primary stats for (unsigned int i = STATS_STRENGTH; i <= STATS_LUCK; i++) { *this >> uint32; setStat(i, uint32); } // secondary stats *this >> _hitPoints >> _actionPoints >> _armorClass; // unknown 2 *this >> _unknown2; *this >> _meleeDamage >> _carryWeight >> _sequence >> _healingRate >> _criticalChance >> _criticalHitModifier; for (unsigned int i = DAMAGE_NORMAL; i <= DAMAGE_EXPLOSIVE; i++) { *this >> uint32; setDamage(i, uint32); } for (unsigned int i = DAMAGE_NORMAL; i <= DAMAGE_EXPLOSIVE; i++) { *this >> uint32; setResistance(i, uint32); } *this >> _radiationResistance >> _poisonResistance >> _age >> _gender; // bonuses to primary stats for (unsigned int i = STATS_STRENGTH; i <= STATS_LUCK; i++) { *this >> uint32; setStatBonus(i, uint32); } // bonuses to secondary stats *this >> _hitPointsBonus >> _actionPointsBonus >> _armorClassBonus; // unknown 3 *this >> _unknown3; *this >> _meleeDamageBonus >> _carryWeightBonus >> _sequenceBonus >> _healingRateBonus >> _criticalChanceBonus >> _criticalHitModifierBonus; for (unsigned int i = DAMAGE_NORMAL; i <= DAMAGE_EXPLOSIVE; i++) { *this >> uint32; setDamageBonus(i, uint32); } for (unsigned int i = DAMAGE_NORMAL; i <= DAMAGE_EXPLOSIVE; i++) { *this >> uint32; setResistanceBonus(i, uint32); } *this >> _radiationResistanceBonus >> _poisonResistanceBonus >> _ageBonus >> _genderBonus; //skills for (unsigned int i = SKILLS_1; i <= SKILLS_18; i++) { *this >> uint32; setSkill(i, uint32); } // unknown *this >> _unknown4 >> _unknown5 >> _unknown6 >> _unknown7; // name char * name = new char[32](); this->readBytes(name, 32); setName(name); delete [] name; *this >> _firstTaggedSkill >> _secondTaggedSkill >> _thirdTaggedSkill >> _fourthTaggedSkill >> _firstTrait >> _secondTrait >> _characterPoints; }