本文整理汇总了C++中SetStat函数的典型用法代码示例。如果您正苦于以下问题:C++ SetStat函数的具体用法?C++ SetStat怎么用?C++ SetStat使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetStat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTotalStatValue
bool Pet::UpdateStats(Stats stat)
{
if(stat > STAT_SPIRIT || stat < STAT_STRENGTH )
return false;
// value = ((create_value + base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
SetStat(stat, int32(value));
switch(stat)
{
case STAT_STRENGTH:
UpdateAttackPowerAndDamage();
break;
case STAT_AGILITY:
UpdateAttackPowerAndDamage(true);
UpdateArmor();
break;
case STAT_STAMINA:
UpdateMaxHealth();
break;
case STAT_INTELLECT:
UpdateMaxPower(POWER_MANA);
break;
case STAT_SPIRIT:
default:
break;
}
return true;
}
示例2: GetTotalStatValue
bool Guardian::UpdateStats(Stats stat)
{
if (stat >= MAX_STATS)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
SetStat(stat, int32(value));
switch (stat)
{
case STAT_STRENGTH:
UpdateAttackPowerAndDamage();
break;
case STAT_AGILITY:
UpdateArmor();
UpdateMeleeCritChance();
break;
case STAT_STAMINA:
UpdateMaxHealth();
break;
case STAT_INTELLECT:
UpdateMaxPower(POWER_MANA);
UpdateSpellCritChance();
break;
case STAT_SPIRIT:
default:
break;
}
return true;
}
示例3: GetTotalStatValue
bool Player::UpdateAllStats()
{
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
float value = GetTotalStatValue(Stats(i));
SetStat(Stats(i), (int32)value);
}
UpdateArmor();
// calls UpdateAttackPowerAndDamage() in UpdateArmor for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
UpdateAttackPowerAndDamage(true);
UpdateMaxHealth();
for (uint32 i = POWER_MANA; i < MAX_POWERS; ++i)
UpdateMaxPower(Powers(i));
UpdateAllRatings();
UpdateAllCritPercentages();
UpdateAllSpellCritChances();
UpdateBlockPercentage();
UpdateParryPercentage();
UpdateShieldBlockDamageValue();
UpdateDodgePercentage();
UpdateArmorPenetration();
UpdateSpellDamageAndHealingBonus();
UpdateManaRegen();
UpdateExpertise(BASE_ATTACK);
UpdateExpertise(OFF_ATTACK);
for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
UpdateResistances(i);
return true;
}
示例4: GetTotalStatValue
bool Player::UpdateAllStats()
{
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
float value = GetTotalStatValue(Stats(i));
SetStat(Stats(i), (int32)value);
}
UpdateAttackPowerAndDamage();
UpdateAttackPowerAndDamage(true);
UpdateArmor();
UpdateMaxHealth();
for(int i = POWER_MANA; i < MAX_POWERS; ++i)
UpdateMaxPower(Powers(i));
UpdateAllCritPercentages();
UpdateAllSpellCritChances();
UpdateDefenseBonusesMod();
UpdateShieldBlockValue();
UpdateSpellDamageAndHealingBonus();
UpdateManaRegen();
UpdateExpertise(BASE_ATTACK);
UpdateExpertise(OFF_ATTACK);
for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
UpdateResistances(i);
return true;
}
示例5: GetTotalStatValue
bool Player::UpdateAllStats()
{
for (int8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
float value = GetTotalStatValue(Stats(i));
SetStat(Stats(i), int32(value));
}
UpdateArmor();
// calls UpdateAttackPowerAndDamage() in UpdateArmor for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
UpdateAttackPowerAndDamage(true);
UpdateMaxHealth();
for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i)
UpdateMaxPower(Powers(i));
UpdateAllRatings();
UpdateAllCritPercentages();
UpdateAllSpellCritChances();
UpdateBlockPercentage();
UpdateParryPercentage();
UpdateDodgePercentage();
UpdateSpellDamageAndHealingBonus();
UpdateManaRegen();
UpdateExpertise(BASE_ATTACK);
UpdateExpertise(OFF_ATTACK);
RecalculateRating(CR_ARMOR_PENETRATION);
UpdateAllResistances();
//npcbot - Player::UpdateAllStats() is called on level change - update bots
SetBotsShouldUpdateStats();
//end npcbot
return true;
}
示例6: GetTotalStatValue
bool Guardian::UpdateStats(Stats stat)
{
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
ApplyStatBuffMod(stat, m_statFromOwner[stat], false);
float ownersBonus = 0.0f;
Unit* owner = GetOwner();
// Handle Death Knight Glyphs and Talents
float mod = 0.75f;
if (IsPetGhoul() && (stat == STAT_STAMINA || stat == STAT_STRENGTH))
{
if (stat == STAT_STAMINA)
mod = 0.3f; // Default Owner's Stamina scale
else
mod = 0.7f; // Default Owner's Strength scale
ownersBonus = float(owner->GetStat(stat)) * mod;
value += ownersBonus;
}
else if (stat == STAT_STAMINA)
{
ownersBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 30);
value += ownersBonus;
}
//warlock's and mage's pets gain 30% of owner's intellect
else if (stat == STAT_INTELLECT)
{
if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
{
ownersBonus = CalculatePct(owner->GetStat(stat), 30);
value += ownersBonus;
}
}
/*
else if (stat == STAT_STRENGTH)
{
if (IsPetGhoul())
value += float(owner->GetStat(stat)) * 0.3f;
}
*/
SetStat(stat, int32(value));
m_statFromOwner[stat] = ownersBonus;
ApplyStatBuffMod(stat, m_statFromOwner[stat], true);
switch (stat)
{
case STAT_STRENGTH: UpdateAttackPowerAndDamage(); break;
case STAT_AGILITY: UpdateArmor(); break;
case STAT_STAMINA: UpdateMaxHealth(); break;
case STAT_INTELLECT: UpdateMaxPower(POWER_MANA); break;
default:
break;
}
return true;
}
示例7: SetStat
void CClientPlayer::Reset ( void )
{
// stats
for ( unsigned short us = 0 ; us <= NUM_PLAYER_STATS ; us++ )
{
if ( us == MAX_HEALTH )
{
SetStat ( us, 569.0f );
}
else
{
SetStat ( us, 0.0f );
}
}
// model
SetModel ( 0 );
// clothes
GetClothes ()->DefaultClothes ( false );
// jetpack
SetHasJetPack ( false );
// fight-style
SetFightingStyle ( STYLE_GRAB_KICK );
// rebuild
RebuildModel ();
// Nametag
SetNametagText ( m_strNick );
m_bNametagShowing = true;
// Otherwize default to white
m_ucNametagColorR = 255;
m_ucNametagColorG = 255;
m_ucNametagColorB = 255;
m_bNametagColorOverridden = false;
SetAlpha ( 255 );
}
示例8: GetTotalStatValue
bool Pet::UpdateStats(Stats stat)
{
if (stat > STAT_SPIRIT)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
Unit* owner = GetOwner();
// chained, use original owner instead
if (owner && owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->GetEntry() == GetEntry())
{
if (Unit* creator = GetCreator())
owner = creator;
}
if (stat == STAT_STAMINA)
{
if(owner && owner->GetTypeId() == TYPEID_PLAYER && owner->getClass() == CLASS_WARLOCK)
value += float(owner->GetStat(stat)) * 0.75f;
else if (owner)
value += float(owner->GetStat(stat)) * 0.3f;
}
// warlock's and mage's pets gain 30% of owner's intellect
else if (stat == STAT_INTELLECT && getPetType() == SUMMON_PET)
{
if (owner && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))
value += float(owner->GetStat(stat)) * 0.3f;
}
// deathknight's ghoul gain 100% of owner's strength
else if (stat == STAT_STRENGTH && getPetType() == SUMMON_PET)
{
if (owner && (owner->getClass() == CLASS_DEATH_KNIGHT))
{
value += float(owner->GetStat(stat)) * 1.0f;
}
}
SetStat(stat, int32(value));
switch (stat)
{
case STAT_STRENGTH: UpdateAttackPowerAndDamage(); break;
case STAT_AGILITY: UpdateArmor(); break;
case STAT_STAMINA: UpdateMaxHealth(); break;
case STAT_INTELLECT: UpdateMaxPower(POWER_MANA); break;
case STAT_SPIRIT:
default:
break;
}
return true;
}
示例9: GetTotalStatValue
bool Guardian::UpdateStats(Stats stat)
{
if (stat >= MAX_STATS)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
ApplyStatBuffMod(stat, m_statFromOwner[stat], false);
float ownersBonus = 0.0f;
Unit *owner = GetOwner();
if (stat == STAT_STAMINA)
{
if (owner->getClass() == CLASS_WARLOCK && isPet() || isHunterPet())
{
// TOTAL_PCT should be applied after ownersBonus
UnitMods unitMod = UnitMods(UNIT_MOD_STAT_START + stat);
value *= (1.0f / m_auraModifiersGroup[unitMod][TOTAL_PCT]) ;
ownersBonus = CalculatePct(owner->GetStat(stat), 30);
value += ownersBonus;
value *= m_auraModifiersGroup[unitMod][TOTAL_PCT];
}
}
else if (stat == STAT_INTELLECT)
{
// Warlock and Mage pets gain 30% of owners intellect
if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
{
// TOTAL_PCT should be applied after ownersBonus
UnitMods unitMod = UnitMods(UNIT_MOD_STAT_START + stat);
value *= (1.0f / m_auraModifiersGroup[unitMod][TOTAL_PCT]) ;
ownersBonus = CalculatePct(owner->GetStat(stat), 30);
value += ownersBonus;
value *= m_auraModifiersGroup[unitMod][TOTAL_PCT];
}
}
SetStat(stat, int32(value));
m_statFromOwner[stat] = ownersBonus;
ApplyStatBuffMod(stat, m_statFromOwner[stat], true);
switch (stat)
{
case STAT_STRENGTH: UpdateAttackPowerAndDamage(); break;
case STAT_AGILITY: UpdateArmor(); break;
case STAT_STAMINA: UpdateMaxHealth(); break;
case STAT_INTELLECT: UpdateMaxPower(POWER_MANA); break;
case STAT_SPIRIT:
default:
break;
}
return true;
}
示例10: GetTotalStatValue
bool Player::UpdateStats(Stats stat)
{
if (stat > STAT_SPIRIT)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
SetStat(stat, int32(value));
if (stat == STAT_STAMINA || stat == STAT_INTELLECT)
{
Pet* pet = GetPet();
if (pet)
pet->UpdateStats(stat);
}
switch (stat)
{
case STAT_STRENGTH:
UpdateAttackPowerAndDamage();
UpdateShieldBlockValue();
break;
case STAT_AGILITY:
UpdateArmor();
UpdateAttackPowerAndDamage(true);
if (getClass() == CLASS_ROGUE || getClass() == CLASS_HUNTER || (getClass() == CLASS_DRUID && m_form == FORM_CAT))
UpdateAttackPowerAndDamage();
UpdateAllCritPercentages();
UpdateDodgePercentage();
break;
case STAT_STAMINA:
UpdateMaxHealth();
break;
case STAT_INTELLECT:
UpdateMaxPower(POWER_MANA);
UpdateAllSpellCritChances();
UpdateAttackPowerAndDamage(true); //SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT, only intellect currently
UpdateArmor(); //SPELL_AURA_MOD_RESISTANCE_OF_INTELLECT_PERCENT, only armor currently
break;
case STAT_SPIRIT:
break;
default:
break;
}
UpdateSpellDamageAndHealingBonus();
UpdateManaRegen();
return true;
}
示例11: GetTotalStatValue
bool Player::UpdateStats(Stats stat)
{
if (stat > STAT_SPIRIT)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
SetStat(stat, int32(value));
if (stat == STAT_STAMINA || stat == STAT_INTELLECT)
{
Pet* pet = GetPet();
if (pet)
pet->UpdateStats(stat);
}
switch (stat)
{
case STAT_STRENGTH:
UpdateShieldBlockValue();
break;
case STAT_AGILITY:
UpdateArmor();
UpdateAllCritPercentages();
UpdateDodgePercentage();
break;
case STAT_STAMINA:
UpdateMaxHealth();
break;
case STAT_INTELLECT:
UpdateMaxPower(POWER_MANA);
UpdateAllSpellCritChances();
UpdateArmor(); // SPELL_AURA_MOD_RESISTANCE_OF_INTELLECT_PERCENT, only armor currently
break;
case STAT_SPIRIT:
break;
default:
break;
}
// Need update (exist AP from stat auras)
UpdateAttackPowerAndDamage();
UpdateAttackPowerAndDamage(true);
UpdateSpellDamageAndHealingBonus();
UpdateManaRegen();
return true;
}
示例12: SetStat
void Player::AddStat()
{
if (heroClass_ == EHeroClass::WARRIOR)
{
SetStat(EStatConst::STRENGTH, GetStatValue(EStatConst::STRENGTH) + 2);
SetStat(EStatConst::INTELLIGENCE, GetStatValue(EStatConst::INTELLIGENCE) + 1);
SetStat(EStatConst::DEXTERITY, GetStatValue(EStatConst::DEXTERITY) + 1);
}
if (heroClass_ == EHeroClass::ROGUE)
{
SetStat(EStatConst::STRENGTH, GetStatValue(EStatConst::STRENGTH) + 1);
SetStat(EStatConst::INTELLIGENCE, GetStatValue(EStatConst::INTELLIGENCE) + 2);
SetStat(EStatConst::DEXTERITY, GetStatValue(EStatConst::DEXTERITY) + 1);
}
if (heroClass_ == EHeroClass::MAGE)
{
SetStat(EStatConst::STRENGTH, GetStatValue(EStatConst::STRENGTH) + 1);
SetStat(EStatConst::INTELLIGENCE, GetStatValue(EStatConst::INTELLIGENCE) + 1);
SetStat(EStatConst::DEXTERITY, GetStatValue(EStatConst::DEXTERITY) + 2);
}
}
示例13: GetTotalStatValue
bool Pet::UpdateStats(Stats stat)
{
if(stat > STAT_SPIRIT)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
Unit *owner = GetOwner();
if ( stat == STAT_STAMINA )
{
if(owner)
{
float scale_coeff = 0.3f;
switch (owner->getClass())
{
case CLASS_HUNTER:
scale_coeff = 0.45f;
break;
case CLASS_WARLOCK:
scale_coeff = 0.75f;
break;
}
value += float(owner->GetStat(stat)) * scale_coeff;
}
}
//warlock's and mage's pets gain 30% of owner's intellect
else if ( stat == STAT_INTELLECT && getPetType() == SUMMON_PET )
{
if(owner && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE) )
value += float(owner->GetStat(stat)) * 0.3f;
}
SetStat(stat, int32(value));
switch(stat)
{
case STAT_STRENGTH: UpdateAttackPowerAndDamage(); break;
case STAT_AGILITY: UpdateArmor(); break;
case STAT_STAMINA: UpdateMaxHealth(); break;
case STAT_INTELLECT: UpdateMaxPower(POWER_MANA); break;
case STAT_SPIRIT:
default:
break;
}
return true;
}
示例14: SetStat
void Player::AddStat()
{
if (class_ == warrior)
{
SetStat(EStatConst::STRENGTH, GetStatValue(EStatConst::STRENGTH) + 2);
SetStat(EStatConst::INTELLIGENCE, GetStatValue(EStatConst::INTELLIGENCE) + 1);
SetStat(EStatConst::DEXTERITY, GetStatValue(EStatConst::DEXTERITY) + 1);
}
if (class_ == rouge)
{
SetStat(EStatConst::STRENGTH, GetStatValue(EStatConst::STRENGTH) + 1);
SetStat(EStatConst::INTELLIGENCE, GetStatValue(EStatConst::INTELLIGENCE) + 2);
SetStat(EStatConst::DEXTERITY, GetStatValue(EStatConst::DEXTERITY) + 1);
}
if (class_ == mage)
{
SetStat(EStatConst::STRENGTH, GetStatValue(EStatConst::STRENGTH) + 1);
SetStat(EStatConst::INTELLIGENCE, GetStatValue(EStatConst::INTELLIGENCE) + 1);
SetStat(EStatConst::DEXTERITY, GetStatValue(EStatConst::DEXTERITY) + 2);
}
}
示例15: GetTotalStatValue
bool Pet::UpdateStats(Stats stat)
{
if(stat > STAT_SPIRIT)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
Unit *owner = GetOwner();
if (owner)
{
switch(stat)
{
case STAT_STAMINA:
// warlock's pets gain 75% of owner's stamina
if (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)
value += owner->GetStat(stat) * 0.75f;
else
{
if (getPetType() == SUMMON_PET || getPetType() == HUNTER_PET || owner->getClass() == CLASS_DEATH_KNIGHT)
value += owner->GetStat(stat) * 0.3f;
}
break;
case STAT_INTELLECT:
// warlock's and mage's pets gain 30% of owner's intellect
if (getPetType() == SUMMON_PET && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))
value += owner->GetStat(stat) * 0.3f;
break;
};
}
SetStat(stat, int32(value));
switch(stat)
{
case STAT_STRENGTH: UpdateAttackPowerAndDamage(); break;
case STAT_AGILITY: UpdateArmor(); break;
case STAT_STAMINA: UpdateMaxHealth(); break;
case STAT_INTELLECT: UpdateMaxPower(POWER_MANA); break;
case STAT_SPIRIT:
default:
break;
}
return true;
}