コード例 #1
0
ファイル: main.cpp プロジェクト: CBrooks12/260CppLab4
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;
	}
}
コード例 #2
0
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;
}
コード例 #3
0
//----------------------------------------------------------------------------
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();
}
コード例 #4
0
ファイル: SkillManager.cpp プロジェクト: Marott1/Core3
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;
}
コード例 #5
0
//*********************************************************
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);
  }
}
コード例 #6
0
ファイル: OF_INN.cpp プロジェクト: MicroVirus/7kaa
//--------- 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);
}
コード例 #7
0
ファイル: UnitData.cpp プロジェクト: jotak/shahnarman
// -----------------------------------------------------------------
// 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);
    }
}
コード例 #8
0
ファイル: Test_Skill.cpp プロジェクト: kdeorg/bestalloc
void Test_Skill::setId()
{
    Skill testSkill;

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

    QVERIFY(testSkill.getId() == id);
}
コード例 #9
0
ファイル: Test_Skill.cpp プロジェクト: kdeorg/bestalloc
void Test_Skill::setName()
{
    Skill testSkill;

    string name = "SkillName";
    testSkill.setName(name);

    QVERIFY(testSkill.getName() == name);
}
コード例 #10
0
  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;
  }
コード例 #11
0
ファイル: battle.cpp プロジェクト: BeyondCloud/RPG
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;
}
コード例 #12
0
ファイル: WorldServer.cpp プロジェクト: DerBasti/DreamROSE
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;
}
コード例 #13
0
ファイル: Skill.cpp プロジェクト: ccmehk/magicalgirlrevamp
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;
	}
}
コード例 #14
0
ファイル: Skill.cpp プロジェクト: whumr/ld_new
Skill* Skill::createSkill(SkillType skillType)
{
    Skill* skill = new Skill();
	if(skill && skill->init(skillType))
    {
        skill->autorelease();
        return skill;
    }
    CC_SAFE_DELETE(skill);
    return NULL;
}
コード例 #15
0
ファイル: AirGameActor.cpp プロジェクト: ingeyu/airengine
		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);
		}
コード例 #16
0
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 );
}
コード例 #17
0
ファイル: resourceskill.cpp プロジェクト: albertca/frePPLe
DECLARE_EXPORT void ResourceSkill::validate(Action action)
{
  // Catch null operation and resource pointers
  Skill *skill = getSkill();
  Resource *res = getResource();
  if (!skill || !res)
  {
    // Invalid load model
    if (!skill && !res)
      throw DataException("Missing resource and kill on a resourceskill");
    else if (!skill)
      throw DataException("Missing skill on a resourceskill on resource '"
          + res->getName() + "'");
    else if (!res)
      throw DataException("Missing resource on a resourceskill on skill '"
          + skill->getName() + "'");
  }

  // Check if a resourceskill with 1) identical resource, 2) identical skill and
  // 3) overlapping effectivity dates already exists
  Skill::resourcelist::const_iterator i = skill->getResources().begin();
  for (; i != skill->getResources().end(); ++i)
    if (i->getResource() == res
        && i->getEffective().overlap(getEffective())
        && &*i != this)
      break;

  // Apply the appropriate action
  switch (action)
  {
    case ADD:
      if (i != skill->getResources().end())
      {
        throw DataException("Resourceskill of '" + res->getName() + "' and '"
            + skill->getName() + "' already exists");
      }
      break;
    case CHANGE:
      throw DataException("Can't update a resourceskill");
    case ADD_CHANGE:
      // ADD is handled in the code after the switch statement
      if (i == skill->getResources().end()) break;
      throw DataException("Can't update a resourceskill");
    case REMOVE:
      // This resourceskill was only used temporarily during the reading process
      delete this;
      if (i == skill->getResources().end())
        // Nothing to delete
        throw DataException("Can't remove nonexistent resourceskill of '"
            + res->getName() + "' and '" + skill->getName() + "'");
      delete &*i;
      return;
  }
}
コード例 #18
0
ファイル: MusicManager.cpp プロジェクト: KiRiN/VOXCHRONICLE
void MusicManager::preloadAllTracks(CharacterManager* manager, Level* level) {
  CCArray* characters = manager->getCharacters();
  CCObject* obj0 = NULL;
  CCARRAY_FOREACH(characters, obj0) {
    Character* chara = (Character*)obj0;
    CCArray* skills = level->getAllSkills(chara);
    CCObject* obj1 = NULL;
    CCARRAY_FOREACH(skills, obj1) {
      Skill* skill = (Skill*)obj1;
      int repeat = skill->getMaxRepeat();
      for (int i = 0; i < repeat; ++i) {
        string file = buildTrackName(skill->getIdentifier().c_str(), skill, i, chara);
        BufferCache::sharedCache()->addBuffer(this->getTrackFileName(file.c_str()).c_str());
      }
    }
コード例 #19
0
ファイル: SkillManager.cpp プロジェクト: Marott1/Core3
void SkillManager::updateXpLimits(PlayerObject* ghost) {
	if (ghost == NULL || !ghost->isPlayerObject()) {
		return;
	}

	VectorMap<String, int>* xpTypeCapList = ghost->getXpTypeCapList();

	//Clear all xp limits to the default limits.
	for (int i = 0; i < defaultXpLimits.size(); ++i) {
		String xpType = defaultXpLimits.elementAt(i).getKey();
		int xpLimit = defaultXpLimits.elementAt(i).getValue();

		if (xpTypeCapList->contains(xpType)) {
			xpTypeCapList->get(xpType) = xpLimit;
		} else {
			xpTypeCapList->put(xpType, xpLimit);
		}
	}

	//Iterate over the player skills and update xp limits accordingly.
	ManagedReference<CreatureObject*> player = cast<CreatureObject*>(ghost->getParentRecursively(SceneObjectType::PLAYERCREATURE).get().get());

	if(player == NULL)
		return;

	SkillList* playerSkillBoxList = player->getSkillList();

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

		if (skillBox == NULL)
			continue;

		if (xpTypeCapList->contains(skillBox->getXpType()) && (xpTypeCapList->get(skillBox->getXpType()) < skillBox->getXpCap())) {
			xpTypeCapList->get(skillBox->getXpType()) = skillBox->getXpCap();
		}
	}

	//Iterate over the player xp types and cap all xp types to the limits.
	DeltaVectorMap<String, int>* experienceList = ghost->getExperienceList();

	for (int i = 0; i < experienceList->size(); ++i) {
		String xpType = experienceList->getKeyAt(i);
		if (experienceList->get(xpType) > xpTypeCapList->get(xpType)) {
			ghost->addExperience(xpType, xpTypeCapList->get(xpType) - experienceList->get(xpType), true);
		}
	}
}
コード例 #20
0
ファイル: ScriptFactory.cpp プロジェクト: noam-c/EDEn
std::shared_ptr<UsableScript> ScriptFactory::getSkillScript(lua_State* luaVM, const Skill& skill)
{
   std::ostringstream skillIdBuffer;
   skillIdBuffer << skill.getId();

   return std::make_shared<UsableScript>(luaVM, ScriptFactory::getPath(skillIdBuffer.str(), ScriptType::SKILL_SCRIPT), skill);
}
コード例 #21
0
ファイル: skill.cpp プロジェクト: KrazyTheFox/Cataclysm-DDA
void Skill::load_skill( JsonObject &jsobj )
{
    skill_id ident = skill_id( jsobj.get_string( "ident" ) );
    skills.erase( std::remove_if( begin( skills ), end( skills ), [&]( const Skill & s ) {
        return s._ident == ident;
    } ), end( skills ) );

    const Skill sk( ident, _( jsobj.get_string( "name" ) ), _( jsobj.get_string( "description" ) ),
                    jsobj.get_tags( "tags" ) );

    if( sk.is_contextual_skill() ) {
        contextual_skills[sk.ident()] = sk;
    } else {
        skills.push_back( sk );
    }
}
コード例 #22
0
bool SkillHandler::PollAction(Client* pClient, GLib::Input* pInput, XMFLOAT3 start, XMFLOAT3 end)
{
	if(end.x == numeric_limits<float>::infinity())
		return false;

	for(auto iter = mSkillMap.begin(); iter != mSkillMap.end(); iter++) {
		Skill* skill = (*iter).second;
		char key = skill->GetAttributes().hotkey[0];
		if(pInput->KeyPressed(key) && skill->IsReady())
		{
			// Send a skill casted event to the server.
			RakNet::BitStream bitstream;

			bitstream.Write((unsigned char)NMSG_SKILL_CAST);
			bitstream.Write((unsigned char)skill->GetName());
			bitstream.Write(pClient->GetLocalPlayer()->GetId());
			bitstream.Write(skill->GetName());
			bitstream.Write(skill->GetLevel());
			bitstream.Write(start);
			bitstream.Write(end);

			pClient->SendServerMessage(bitstream);

			skill->ResetCooldown();

			return true;
		}
	}

	return false;
}
コード例 #23
0
void loadSkillList(SkillList& l)
{
    std::ifstream file("rc/data/skilllist.csv");
    std::string line;
    std::string value;
    std::string* listValue;
    int index = 0;

    while(std::getline(file, line))
    {
        Skill skill;
        listValue = new std::string[6];
        std::stringstream lineStream(line);

        while(std::getline(lineStream, value, ','))
        {
            listValue[index] = value;
            index++;
        }

        skill.setName(listValue[0]);
        skill.setBasePower(atoi(listValue[1].c_str()));
        skill.setTargetNeeded((atoi(listValue[2].c_str()) == 1) ? true : false);
        skill.setTargetType(static_cast<TargetType>(atoi(listValue[3].c_str())));
        skill.setCooldown(atoi(listValue[4].c_str()));
        skill.setDescription(listValue[5]);

        l.push_back(skill);

        index = 0;
        delete [] listValue;
    }
}
コード例 #24
0
void ConfigsObjNewSkillDialog::populaComboHabilidades() {
    GameData *gameData = GameData::getInstance();

    std::vector<Skill*> *skillList = gameData->skillList;

    ui->comboBoxSkill->clear();

    ui->comboBoxSkill->insertItem(ui->comboBoxSkill->count() + 1, QString(tr("-- Escolha a habilidade --")), QVariant::fromValue((void*) NULL));

    for(std::vector<Skill*>::iterator it = skillList->begin(); it != skillList->end(); ++it) {
        Skill *skill = *it;

        if(skill->containsObjectType(gameObject->type)) {
            ui->comboBoxSkill->insertItem(ui->comboBoxSkill->count() + 1, QString(skill->name.c_str()), QVariant::fromValue((void*) skill));
        }

    }
}
コード例 #25
0
ファイル: AirGameActor.cpp プロジェクト: ingeyu/airengine
		void Actor::Update( const FrameTime& frameTime )
		{
			float fDot =	acos(m_vFaceDir.Dot(Float3(0,0,1)));
			//Float3 vAxis	=	Float3(0,0,1).Cross(vDir).Normalize();

			if(m_vFaceDir.x < 0){
				fDot*=-1;
			}
			m_pNode->SetQuat(Float4(Float3(0,1,0),fDot));
				
			if(m_uiLowBodyBoneIndex!=0xffffffff){
				if(m_vMoveDir.Length()	<	0.5){
					m_pModel->DisableBoneExtraRotate(m_uiLowBodyBoneIndex);
				}else{

					Float3 vNewMoveDir	=	m_vMoveDir;

					float fRun	=	vNewMoveDir.Dot(m_vFaceDir);
					if(fRun	<0){
						vNewMoveDir*=-1;//m_pModel->EnableBoneExtraRotate(uiIndex,Float4(Float3(0,0,-1),fFootDot));
					}

					float	fFootAngle	=	acos(vNewMoveDir.Dot(m_vFaceDir));
					if(fFootAngle	< 0.00001f){
						m_pModel->EnableBoneExtraRotate(m_uiLowBodyBoneIndex,Float4(Float3(0,0,1),0));
					}else{
						Float3 vAxis		=	m_vFaceDir.Cross(vNewMoveDir).Normalize();
						m_pModel->EnableBoneExtraRotate(m_uiLowBodyBoneIndex,Float4(Float3(0,0,vAxis.y),-fFootAngle));
					}

				}
			}

			//UpdateSkill
			U32 uiSkillCount	=	m_vecSkill.size();
			for(U32 i=0;i<uiSkillCount;i++){
				Skill* pSkill	=	m_vecSkill[i];
				if(pSkill!=NULL){
					pSkill->Update(frameTime,this);
				}
			}
			Move(frameTime.fTimeDelta);
		}
コード例 #26
0
void SkillInventory::AddItem(HudItem* pItem)
{
	// Any free slots?
	if(!HasFreeSlots())
		return;

	Skill* skill = mPlayer->AddSkill(pItem->GetName());
	
	// Pass on the attributes.
	// [NOTE] REALLY UGLY [HACK][WARNING].
	skill->SetAttributes(pItem->GetAttributes());
	skill->SetDescription(pItem->GetDescription());
	skill->SetCost(pItem->GetCost());
	skill->SetLevel(pItem->GetLevel());

	// Send message to server.
	SendItemAdded(mPlayer->GetPlayer()->GetId(), pItem->GetName(), pItem->GetLevel());

	UpdateItems();
}
コード例 #27
0
ファイル: SkillManager.cpp プロジェクト: Marott1/Core3
bool SkillManager::fullfillsSkillPrerequisitesAndXp(const String& skillName, CreatureObject* creature) {
	if (!fullfillsSkillPrerequisites(skillName, creature)) {
		return false;
	}

	Skill* skill = skillMap.get(skillName.hashCode());

	if (skill == NULL) {
		return false;
	}

	ManagedReference<PlayerObject* > ghost = creature->getPlayerObject();
	if (ghost != NULL) {
		//Check if player has enough xp to learn the skill.
		if (skill->getXpCost() > 0 && ghost->getExperience(skill->getXpType()) < skill->getXpCost()) {
			return false;
		}
	}

	return true;
}
コード例 #28
0
bool ComponentSkill::skillIsUsable( int skillNumber )
{
	Skill *skill = skills[skillNumber - 1];

	GraphicsEngine* graphicsEngine = GameManager::getInstance()->getGraphicsEngine();

	if(down)
	{
		return false;
	}

	if(skill->getRequiredLevel() > level)
	{
		//Avisar GUI para que muestre mensaje al jugador
		//El jugador no tiene nivel suficiente
		graphicsEngine->setWarningMessage(GameConstants::SKILL_UNAVAILABLE_MESSAGE);

		return false;
	}

	if(skill->isOnCooldown())
	{
		//Avisar GUI para que muestre mensaje al jugador
		//La skill se esta recargando todavia
		GameManager::getInstance()->getGraphicsEngine()->setWarningMessage(GameConstants::COOLDOWN_MESSAGE);
		return false;
	}

	if(skill->getCost() > jade)
	{
		//Avisar GUI para que muestre mensaje al jugador
		//El jugador no tiene jade suficiente
		GameManager::getInstance()->getGraphicsEngine()->setWarningMessage(GameConstants::INSUFFICIENT_JADE_MESSAGE);

		return false;
	}
	return true;
}
コード例 #29
0
ファイル: SkillManager.cpp プロジェクト: Marott1/Core3
void SkillManager::loadSkill(LuaObject* luaSkill) {
	Reference<Skill*> skill = new Skill();
	skill->parseLuaObject(luaSkill);
	Skill* parent = skillMap.get(skill->getParentName().hashCode());

	if(parent == NULL) {
		parent = rootNode;
	}

	parent->addChild(skill);
	skillMap.put(skill->getSkillName().hashCode(), skill);

	Vector<String> commands = skill->commands;

	for(int i = 0; i < commands.size(); ++i) {
		String command = commands.get(i);

		if(!abilityMap.containsKey(command)) {
			abilityMap.put(command, new Ability(command));
		}
	}

}
コード例 #30
0
ファイル: SkillManager.cpp プロジェクト: Marott1/Core3
bool SkillManager::canLearnSkill(const String& skillName, CreatureObject* creature, bool noXpRequired) {
	Skill* skill = skillMap.get(skillName.hashCode());

	if (skill == NULL) {
		return false;
	}

	//If they already have the skill, then return false.
	if (creature->hasSkill(skillName)) {
		return false;
	}

	if (!fullfillsSkillPrerequisites(skillName, creature)) {
		return false;
	}

	ManagedReference<PlayerObject* > ghost = creature->getPlayerObject();
	if (ghost != NULL) {
		//Check if player has enough xp to learn the skill.
		if (!noXpRequired) {
			if (ghost->getExperience(skill->getXpType()) < skill->getXpCost()) {
				return false;
			}
		}

		//Check if player has enough skill points to learn the skill.
		if (ghost->getSkillPoints() < skill->getSkillPointsRequired()) {
			return false;
		}
	} else {
		//Could not retrieve player object.
		return false;
	}


	return true;
}