当前位置: 首页>>代码示例>>C++>>正文


C++ Skill类代码示例

本文整理汇总了C++中Skill的典型用法代码示例。如果您正苦于以下问题:C++ Skill类的具体用法?C++ Skill怎么用?C++ Skill使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Skill类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TestSkillTree

void TestSkillTree()
{
	// Student skills 

	SkillTree student("Student");
	student.Display(cout);

	student.AddSkill("Alphabet","Mastery of letters and sounds",0);
	student.Display(cout);

	student.AddSkill("Reading","The ability to read all manner of written material",1,"Alphabet");
	student.AddSkill("Writing","The ability to put your thoughts on paper",1,"Alphabet");
	student.Display(cout);

	student.AddSkill("Speed Reading Level 1","Read any text twice as fast as normal",5,"Reading");
	student.AddSkill("Speed Reading Level 2","Read any text four times as fast as normal",10,"Speed Reading Level 1");
	student.AddSkill("Memorization","Memorize average sized texts",10,"Reading");
	student.AddSkill("Massive Memorization","Memorize large sized texts",20,"Memorization");
	student.AddSkill("Spell Writing","The ability to write spells",5,"Writing");
	student.AddSkill("History","The ability to write (and rewrite) history",10,"Writing");
	student.AddSkill("Written Creation","The ability to write things into reality",20,"History");
	student.Display(cout);

	// Warrior skills
	SkillTree warrior("Warrior");
	warrior.AddSkill("Basic Training","Basic training and conditioning",0);
	warrior.AddSkill("Hand To Hand","The fundamentals of hand to hand combat",3,"Basic Training");
	warrior.AddSkill("Grappling","Learn the most common wrestingling moves and holds",10,"Hand To Hand");
	warrior.AddSkill("Marial Arts","Learn devestating hand to hand techniques based on ancient eastern arts",10,"Hand To Hand");
	warrior.AddSkill("Weapons","The beginning skill for all weapons",5,"Basic Training");
	warrior.AddSkill("Sword","Fundamentals of sharp metal things",10,"Weapons");
	warrior.AddSkill("Staff","Fundamentals of hard wooden sticks",10,"Weapons");
	warrior.AddSkill("Bow","Fundamentals of using a bow and arrow",10,"Weapons");
	warrior.Display(cout);

	// Now try adding stuff that doesn't belong

	student.AddSkill("Spitballs","The clever art of making and projecting spitballs",20,"Bully");
	student.Display(cout);

	// Now try adding a new root

	warrior.AddSkill("Physical Conditioning","Training in strength, flexibility, agility, and balance",0);
	warrior.Display(cout);

	// Now try adding too many children
	warrior.AddSkill("Energy Weapons","The use of energy weapons such as lasers.",20,"Weapons");
	warrior.Display(cout);

	// Finally, looks up some skills
	Skill* sk;
	sk = student.FindSkill("Reading");
	if (sk != NULL) {
		cout << "Found the skill" << endl;
		sk->Display(cout);
		cout << endl;
	} else {
		cout << "Not found" << endl;
	}
}
开发者ID:CBrooks12,项目名称:260CppLab4,代码行数:60,代码来源:main.cpp

示例2: if

bool Ghost::DoMouseClick(BaseSceneObject* obj, float duration, BaseSceneObject* target, vec3f pos)
{
	auto ghost = reinterpret_cast<Ghost*>(obj);

	if (!target) return false;

	if (target->Is<Door>()) {
		auto door = reinterpret_cast<Door*>(target);
		door->Interact();
	}
	else if (target->Is<Lamp>()) {
		auto lamp = reinterpret_cast<Lamp*>(target);
		lamp->Interact();
	}
	else {
		//Spawn X or transmogrify
		Skill* activeSkill = ghost->mSkills[ghost->mActiveSkill];

		if (ghost->mMana >= activeSkill->mCost) 
		{
			if (activeSkill->UseSkill(target, pos)) 
			{
				ghost->mMana -= activeSkill->mCost;
			}
		} else {
			TRACE_LOG("No mana for skill");
		}
	}

	return true;
}
开发者ID:igm-capstone,项目名称:capstone-game-cpp,代码行数:31,代码来源:Ghost.cpp

示例3: threeManDefense

//----------------------------------------------------------------------------
void Aggressor::threeManDefense(RobotIndex ID,
                             BasePlay* play,
                             const VisionData& field,
                             RobocupStrategyData* sd)
{
  //-------------------
  //Display message
  //-------------------
  sd->setMessage(ID, "AGGRESSOR Three Man Defense");

  //-------------------
  //get a handle on skillset for this robot
  //-------------------
SkillSet* skills = sd->getStrategyModule().getSkillSet(ID);

  //-------------------
  //get a handle on Agressor Recover Ball skill
  //-------------------
//  Skill* skillHandle = skills->getSkill(AcquirePossessionSkill::skillNum);
  Skill* skillHandle = skills->getSkill(SupplementThreeManSkill::skillNum);
  //-------------------
  //initialize skill if it is not initialized
  //-------------------
  if(!skillHandle->isInitialized())
	  skillHandle->initialize();

  //-------------------
  //run skill
  //-------------------
  skillHandle->run();
}
开发者ID:lordhippo,项目名称:cornell-robocup,代码行数:32,代码来源:A_Three_Man_Defense.cpp

示例4: knightPrereqsMet

bool SkillManager::knightPrereqsMet(CreatureObject* creature, const String& skillNameBeingDropped) {
	SkillList* skillList = creature->getSkillList();

	int fullTrees = 0;
	int totalJediPoints = 0;

	for(int i = 0; i < skillList->size(); ++i) {
		Skill* skill = skillList->get(i);

		String skillName = skill->getSkillName();
		if(skillName.contains("force_discipline_") &&
			(skillName.indexOf("0") != -1 || skillName.contains("novice") || skillName.contains("master") )) {
			totalJediPoints += skill->getSkillPointsRequired();

			if(skillName.indexOf("4") != -1) {
				fullTrees++;
			}
		}
	}

	if(!skillNameBeingDropped.isEmpty()) {
		Skill* skillBeingDropped = skillMap.get(skillNameBeingDropped.hashCode());

		if(skillNameBeingDropped.indexOf("4") != -1) {
			fullTrees--;
		}

		totalJediPoints -= skillBeingDropped->getSkillPointsRequired();
	}

	return fullTrees >= 2 && totalJediPoints >= 206;
}
开发者ID:Marott1,项目名称:Core3,代码行数:32,代码来源:SkillManager.cpp

示例5: setPlay

//*********************************************************
void PenaltyShotUsPivot2002Transition::executePlayTransition(VisionData& field, 
                                                     RobocupStrategyData* rsd,
                                                     BasePlay* currentPlay)
{
  if(currentPlay->readTimer() >= TIMEOUT)
  {
  		setPlay(JamAndShoot::playNum, rsd);
  }

  //when aggressor is finished, go to upfield defense.
  RobotIndex AggressorID = rsd->getRobotByPosition(AGGRESSOR);
  if(AggressorID != NO_ROBOT)
  {
      SkillSet* skills = rsd->getStrategyModule().getSkillSet(AggressorID);
      Skill* skill = skills->getSkill(PenaltyShotUsAimAndShootSkill::skillNum);
      if(skill->isFinished())
      {
		    setPlay(UpfieldDefense::playNum, rsd);   
      }
  }
  else
  {
    setPlay(UpfieldDefense::playNum, rsd);
  }
}
开发者ID:lordhippo,项目名称:cornell-robocup,代码行数:26,代码来源:penaltyShotUsPivot2002Transition.cpp

示例6: disp_unit_info

//--------- Begin of function FirmInn::disp_unit_info ---------//
//
// Display the skill information of the people in the town.
//
// <int> 			 dispY1		 - the top y coordination of the info area
// <InnUnit*> hireInfoPtr - pointer to a HireInfo structure
// <int>    		 refreshFlag - refresh flag
//
void FirmInn::disp_unit_info(int dispY1, InnUnit* hireInfoPtr, int refreshFlag)
{
	Skill* skillPtr = &(hireInfoPtr->skill);

	//---------------- paint the panel --------------//

	if( refreshFlag == INFO_REPAINT )
	{
		vga_util.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+54 );
	}

	//------ display population composition of this resident town -----//

	int x=INFO_X1+4, y=dispY1+4, x1=x+100;
	String str;

	font_san.field( x, y, _("Combat"), x1, skillPtr->combat_level, 1, INFO_X2-10, refreshFlag );

	if( refreshFlag == INFO_REPAINT )
	{
		font_san.field( x, y+16, skillPtr->skill_des(), x1, skillPtr->skill_level , 1, INFO_X2-10, refreshFlag );
	}
	else
	{
		font_san.use_max_height();
		font_san.put( x+2, y+18, skillPtr->skill_des(), 1, x1-2 );
		font_san.use_std_height();

		font_san.update_field( x1, y+16, skillPtr->skill_level, 1, INFO_X2-10);
	}

	font_san.field( x, y+32, _("Hiring Cost"), x1, hireInfoPtr->hire_cost, 2, INFO_X2-10, refreshFlag);
}
开发者ID:MicroVirus,项目名称:7kaa,代码行数:41,代码来源:OF_INN.cpp

示例7: while

// -----------------------------------------------------------------
// Name : serialize
// -----------------------------------------------------------------
void UnitData::serialize(Serializer * pSerializer)
{
    pSerializer->writeString(m_sEdition);
    pSerializer->writeString(m_sObjectId);
    pSerializer->writeString(m_sEthnicityId);
    pSerializer->writeString(m_sTextureFilename);
    // hashmap values
    pSerializer->writeLong((long) m_lValues.size());
    long_hash::iterator it;
    for (it = m_lValues.begin(); it != m_lValues.end(); ++it)
    {
        pSerializer->writeString(it->first.c_str());
        pSerializer->writeLong((long) it->second);
    }
    // skills ref
    pSerializer->writeLong((long) m_pSkills->size);
    Skill * pSkill = (Skill*) m_pSkills->getFirst(0);
    while (pSkill != NULL)
    {
        pSerializer->writeString(pSkill->getObjectEdition());
        pSerializer->writeString(pSkill->getObjectName());
        pSerializer->writeString(pSkill->getParameters());
        pSkill = (Skill*) m_pSkills->getNext(0);
    }
}
开发者ID:jotak,项目名称:shahnarman,代码行数:28,代码来源:UnitData.cpp

示例8: QVERIFY

void Test_Skill::setId()
{
    Skill testSkill;

    int id = 5;
    testSkill.setId(id);

    QVERIFY(testSkill.getId() == id);
}
开发者ID:kdeorg,项目名称:bestalloc,代码行数:9,代码来源:Test_Skill.cpp

示例9: computeCommand

  Status ClassicTaskPostureController::
  computeCommand(Model const & model,
		 Skill & skill,
		 Vector & gamma)
  {
    Status st(skill.update(model));
    if ( ! st) {
      return st;
    }
    
    Skill::task_table_t const * tasks(skill.getTaskTable());
    if ( ! tasks) {
      st.ok = false;
      st.errstr = "null task table";
      return st;
    }
    if (2 != tasks->size()) {
      st.ok = false;
      st.errstr = "task table must have exactly 2 entries";
      return st;
    }
    
    Task const * task((*tasks)[0]);
    Task const * posture((*tasks)[1]);
    
    Matrix ainv;
    if ( ! model.getInverseMassInertia(ainv)) {
      st.ok = false;
      st.errstr = "failed to retrieve inverse mass inertia";
      return st;
    }
    Vector grav;
    if ( ! model.getGravity(grav)) {
      st.ok = false;
      st.errstr = "failed to retrieve gravity torques";
      return st;
    }
    
    size_t const ndof(model.getNDOF());
    Matrix const & jac(task->getJacobian());
    
    jspace::pseudoInverse(jac * ainv * jac.transpose(),
		  task->getSigmaThreshold(),
		  lambda_,
		  0);
    fstar_ = lambda_ * task->getCommand();
    jbar_ = ainv * jac.transpose() * lambda_;
    nullspace_ = Matrix::Identity(ndof, ndof) - jac.transpose() * jbar_.transpose();
    
    gamma_ = jac.transpose() * fstar_ + nullspace_ * posture->getCommand() + grav;
    gamma = gamma_;
    
    jpos_ = model.getState().position_;
    jvel_ = model.getState().velocity_;
    
    return st;
  }
开发者ID:huangxliang,项目名称:uta-wbc-dreamer,代码行数:57,代码来源:ClassicTaskPostureController.cpp

示例10: switch

int Battle::hKeyZ(){
    if(processStat == BattleMenu){
        switch(battleMenuCurrentPos){
            case 0://Attack
                processStat = MonsterMenu;
                break;
            case 1:
                engine->engineCall(loadStack(svc::loadSkillMenu, 1, _currentChara));
                engine->engineCall(loadStack(svc::setStat, Stats::inSkillMenu));
                if(varMap["SkillMenuCurPos"].get<unsigned int>() != 0xffffffff){
                    Skill tmp = (*team)[team->getNameList()[_currentChara]].getSkillList()[varMap["SkillMenuCurPos"].get<unsigned int>()];
                    if(tmp.geteTarget() != 0){
                        processStat = PlayerSkill;
                    }else{
                        processStat = skillMonsterMenu;
                    }
                }
                break;
            case 2:
                engine->engineCall(loadStack(svc::loadInvMenu, 0));
                engine->engineCall(loadStack(svc::setStat, Stats::inInvMenu));
                processStat = process::PostPlayer;
                break;
            case 3:
                int p = rand() % 100;
                if(p - _chance < 0){
                    engine->engineCall(loadStack(svc::loadPrompt, UTF8_to_WChar("You Successfully Escaped!"), UTF8_to_WChar("System")));
                    engine->engineCall(loadStack(svc::restoreStat));
                }else{
                    engine->engineCall(loadStack(svc::loadPrompt, UTF8_to_WChar("You Failed to Escape!"), UTF8_to_WChar("System")));
                    processStat = process::PostPlayer;
                }
                break;
        }
    }else if(processStat == MonsterMenu){
        int atk = (*team)[team->getNameList()[_currentChara]].getAttack();
        float rng = (rand() % 6) / 10 + 0.75;
        int dmg = (-1) * (rng) * (atk + charaAttackBuff[_currentChara]) + _monsters[MonsterMenuCurrentPos].getDefense();

        _monsters[MonsterMenuCurrentPos].varHP(dmg);
        char kk[100];
        if(_monsters[MonsterMenuCurrentPos].isDead()){
            sprintf(kk, "%s is Dead!", _monsters[MonsterMenuCurrentPos].getName().c_str());
            _monsters.erase(_monsters.begin() + MonsterMenuCurrentPos);
        }else{
            sprintf(kk, "%s received %d point of damage!", _monsters[MonsterMenuCurrentPos].getName().c_str(), (-1)*dmg);
        }
        engine->engineCall(loadStack(svc::loadPrompt, UTF8_to_WChar(kk), UTF8_to_WChar("System")));

        processStat = PostPlayer;
    }else if(processStat == skillMonsterMenu){
        processStat = PlayerSkill;
    }

    return 0;
}
开发者ID:BeyondCloud,项目名称:RPG,代码行数:56,代码来源:battle.cpp

示例11: getSkill

Skill* WorldServer::getSkill(const word_t skillIdBasic, const byte_t level) {
	word_t totalId = (skillIdBasic + level);
	if (skillIdBasic > 0x00 && totalId < this->skillFile->getRowCount()) {
		Skill* skill = &this->skillFile->getRow(skillIdBasic);
		if (skill->getLevel() == 0x00)
			return skill;
		return this->getSkill(skillIdBasic + level - 1);
	}
	return nullptr;
}
开发者ID:DerBasti,项目名称:DreamROSE,代码行数:10,代码来源:WorldServer.cpp

示例12: Skill

Skill* Skill::create(Hero* h){
	Skill* skill = new Skill();
	if(skill && skill->init(h)){
		skill->autorelease();
		return skill;
	}else{
		CC_SAFE_DELETE(skill);
		return nullptr;
	}
}
开发者ID:ccmehk,项目名称:magicalgirlrevamp,代码行数:10,代码来源:Skill.cpp

示例13: Skill

Skill* Skill::createSkill(SkillType skillType)
{
    Skill* skill = new Skill();
	if(skill && skill->init(skillType))
    {
        skill->autorelease();
        return skill;
    }
    CC_SAFE_DELETE(skill);
    return NULL;
}
开发者ID:whumr,项目名称:ld_new,代码行数:11,代码来源:Skill.cpp

示例14: StopCastSkill

		void Actor::StopCastSkill( U32 uiIndex )
		{
			if(uiIndex	>=	m_vecSkill.size())
				return;
			Skill* pSkill	=	m_vecSkill[uiIndex];
			if(pSkill==NULL)
				return;
			//技能没有冷却
			if(pSkill->GetLeftCoolDownTime()>0){
				return;
			}
			pSkill->StopCast(this);
		}
开发者ID:ingeyu,项目名称:airengine,代码行数:13,代码来源:AirGameActor.cpp

示例15: TEXT

Void CastAuraAnimation::OnStart( AnimationInstance * pInstance )
{
    // Animation state
    _AnimationState * pState = (_AnimationState*)( pInstance->GetAnimationState() );

    // Create CastAura entity
    GChar strTmp[64];
    StringFn->Format( strTmp, TEXT("CastAura_%s"), pInstance->GetSource()->GetName() );

    Vertex3 vPosition = pInstance->GetSource()->GetEntity()->GetPosition();
    Skill * pSkill = Skill::GetInstance( pInstance->GetSource()->GetCastingSkill() );

    pState->pCastAura = EntityFn->CreateCastAura( strTmp, pSkill->GetCastingTime(), vPosition );
}
开发者ID:Shikifuyin,项目名称:Scarab-Engine,代码行数:14,代码来源:CastAuraAnimation.cpp


注:本文中的Skill类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。