Пример #1
0
void CTurtle::Update(float fElapsedTime)
{
	m_vAnimations[m_nCurrAnimation].Update(fElapsedTime);
	if(GetExperience() >= (100 * GetLevel()))
	{
		CBattleMap::GetInstance()->PlaySFX(CAssets::GetInstance()->aBMcowabungaSnd);
		SetExperience(0/*GetExperience()-(100* GetLevel())*/);
		SetLevel(GetLevel() + 1);
		SetHealthMax((int)((float)GetMaxHealth() * 1.25f));
		SetHealth((int)((float)GetMaxHealth()));
		SetBaseAP(GetBaseAP()+2);
		SetStrength( (int)( (float)GetStrength() * 1.2f ) );
		SetDefense( (int) ( (float)GetDefense() * 1.2f ) );
		SetAccuracy( (int) ( (float)GetAccuracy() * 1.2f ) );
		SetSpeed( (int) ( (float)GetSpeed() * 1.2f ) );
	}
	if( GetHealth() <= 0)
	{
		if(GetAlive() == true)
		{
			CBattleMap::GetInstance()->DecrementNumChars();
			CBattleMap::GetInstance()->DecrementNumTurtles();
			CBattleMap::GetInstance()->SetTurtleDead();
			SetAlive(false);
			if(GetCurrAnimNum() != 9)
				SetCurrAnim(9);
			SetPosZ(0.9f);
		}
	}
}
Пример #2
0
bool Player::LevelUp()
{
	if (GetXP() < GetXPToLevelUp(level + 1))
		return false;

	level++;

	unsigned int statIncreases[3] = { 0, 0, 0 };
	float statMultipliers[3] = { 0, 0, 0 };
	statMultipliers[0] = 13.0f;
	statMultipliers[1] = className == "Fighter" ? 8.0f : 6.0f;
	statMultipliers[2] = className == "Rogue" ? 8.0f : 6.0f;

	for (int i = 0; i < 3; i++)
	{
		float base = std::tanh(level / 30.0) * ((level % 2) + 1);
		statIncreases[i] += static_cast<int>(1 + statMultipliers[i] * base);
	}

	SetHP(GetHP() + statIncreases[0]);
	SetMaxHP(GetMaxHP() + statIncreases[0]);
	SetStrength(GetStrength() + statIncreases[1]);
	SetAgility(GetAgility() + statIncreases[2]);

	std::cout << GetName() << " grew to level " << level << "!\n";
	std::cout << "Health   +" << statIncreases[0] << " -> " << GetMaxHP() << std::endl;
	std::cout << "Strength +" << statIncreases[1] << " -> " << GetStrength() << std::endl;
	std::cout << "Agility  +" << statIncreases[2] << " -> " << GetAgility() << std::endl;
	std::cout << "----------------\n";

	return true;
}
Пример #3
0
Character::Character(std::string fromString) {
    std::vector<std::string> tokens = utils::Tokenfy(fromString, '|');
    if (tokens[0] == "PLAYER_OBJECT") {
        SetName(tokens[57]);
        SetLastname(tokens[58]);
        SetRace(tokens[59]);
        SetGender(tokens[60]);
        SetFace(tokens[61]);
        SetSkin(tokens[62]);
        SetZone(tokens[63]);
        SetLevel(std::stoi(tokens[64]));
        SetHp(std::stoi(tokens[65]));
        SetMaxHp(std::stoi(tokens[66]));
        SetBp(std::stoi(tokens[67]));
        SetMaxBp(std::stoi(tokens[68]));
        SetMp(std::stoi(tokens[69]));
        SetMaxMp(std::stoi(tokens[70]));
        SetEp(std::stoi(tokens[71]));
        SetMaxEp(std::stoi(tokens[72]));
        SetStrength(std::stoi(tokens[73]));
        SetConstitution(std::stoi(tokens[74]));
        SetIntelligence(std::stoi(tokens[75]));
        SetDexterity(std::stoi(tokens[76]));
        SetX(std::stof(tokens[77]));
        SetY(std::stof(tokens[78]));
        SetZ(std::stof(tokens[79]));
        SetPitch(std::stof(tokens[80]));
        SetYaw(std::stof(tokens[81]));
    }
    // if (tokens[0] == "NPC_OBJECT") {
    //    
    // }
}
Пример #4
0
void CTurtle::SetAttributes(int ap,int hp,int strength,int defense,int accuracy,int speed,int level, int experience,int range)
{
	SetBaseAP(ap);
	SetCurrAP(ap);
	SetHealthMax(hp);
	SetHealth(hp);
	SetStrength(strength);
	SetDefense(defense);
	SetAccuracy(accuracy);
	SetSpeed(speed);
	SetLevel(level);
	SetExperience(experience);
	SetRange(range);
}
Пример #5
0
Raider::Raider(Player * player) : Monster(player)
{
	this->player = player; //passes player to raider
	textFont = TTF_OpenFont("MavenPro-Regular.ttf", 24); //init font

	raiderText = new Label();
	raiderText->textToTexture("Raider",textFont); //sets up label

	SetHealth(12); //inital stats
	SetStrength(7);
	SetSpeed(12);
	SetID(3);
	SetMoneyDrop(100);
	SetDropPercentage(40);

}
Пример #6
0
std::shared_ptr<ChoppingTool> ChoppingTool::Deserialize(picojson::value serializedValue)
{
   auto result = std::shared_ptr<ChoppingTool>(new ChoppingTool());

   if (!serializedValue.is<picojson::object>()) {
      throw;
   }

   auto data = serializedValue.get<picojson::object>();
   for (auto item : data) {

      if (item.first == "strength") {
         if (!item.second.is<double>()) {
            throw;
         }

         auto value = item.second.get<double>();
         if (value != (unsigned int)value) {
            throw;
         }

         result->SetStrength((int)value);
         continue;
      }

      if (item.first == "fatigue") {
         if (!item.second.is<double>()) {
            throw;
         }

         auto value = item.second.get<double>();

         if (value != (unsigned int)value) {
            throw;
         }

         result->SetFatigue((int)value);
         continue;
      }

      throw;
   }

   return result;
}
Пример #7
0
Character::Character(std::string name, std::string lastname, std::string race, std::string gender, 
                     std::string face, std::string skin, std::string zone, int level, int hp, 
                     int maxHp, int bp, int maxBp, int mp, int maxMp, int ep, int maxEp, 
                     int strength, int constitution, int intelligence, int dexterity, float x, 
                     float y, float z, float pitch, float yaw) {
    SetName(name);
    SetLastname(lastname);
    SetRace(race);
    SetGender(gender);
    SetFace(face);
    SetSkin(skin);
    SetZone(zone);
    SetHead("head");
    SetChest("chest");
    SetArms("arms");
    SetHands("hands");
    SetLegs("legs");
    SetFeet("feet");
    SetCloak("cloak");
    SetNecklace("necklace");
    SetRingOne("ringOne");
    SetRingTwo("ringTwo");
    SetRightHand("rightHand");
    SetLeftHand("leftHand");
    SetLevel(level);
    SetHp(hp);
    SetMaxHp(maxHp);
    SetBp(bp);
    SetMaxBp(maxBp);
    SetMp(mp);
    SetMaxMp(maxMp);
    SetEp(ep);
    SetMaxEp(maxEp);
    SetStrength(strength);
    SetConstitution(constitution);
    SetIntelligence(intelligence);
    SetDexterity(dexterity);
    SetX(x);
    SetY(y);
    SetZ(z);
    SetPitch(pitch);
    SetYaw(yaw);
}