本文整理汇总了C++中Pet::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ Pet::GetType方法的具体用法?C++ Pet::GetType怎么用?C++ Pet::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pet
的用法示例。
在下文中一共展示了Pet::GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckRacialsProc
//Checks whether the Dragonkin racial should proc.
void PetHelper::CheckRacialsProc(PetStage *petStage, quint8 teamIndex)
{
Pet *currentPet = petStage->GetTeam(teamIndex)->GetActivePet();
//Check if active pet is Dragonkin type and has brought the other team's pet below 50%.
if (currentPet->GetType() == PetType::Dragonkin
&& petStage->GetTeam((teamIndex%2)+1)->GetActivePet()->GetHealthPercentage() < 0.50
&& !currentPet->RacialUsed())
{
currentPet->RacialUsed(true); //Racial now used.
currentPet->AddAura(245, 1, true); //Will replace persisting racial.
}
}
示例2: CheckDamage
//Checks the damage dealt.
void PetHelper::CheckDamage(PetStage *petStage, quint8 teamIndex, quint8 petIndex, quint16 damage, bool mainAttack, bool useLightning)
{
Pet *currentPet = petStage->GetTeam(teamIndex)->GetPet(petIndex);
quint16 totalDamage = damage;
quint16 currentHealth = currentPet->GetHealth();
//Special exception is the use of Lightning Storm weather effect.
if (useLightning && petStage->GetTeam(0)->GetPet(0)->GetNumAuras() > 0
&& petStage->GetTeam(0)->GetPet(0)->GetAura(1)->GetAuraId() == 203)
totalDamage += Round(2 + (float)petStage->GetTeam(0)->GetPet(0)->GetAura(1)->GetPower() * 0.10);
//Use Magic racial if applicable.
if (currentPet->GetType() == PetType::Magic && totalDamage > (int)(currentPet->GetMaxHealth() * 0.35))
//Check if health is greater than 35%.
if (currentPet->GetHealthPercentage() > 0.35)
currentPet->SetHealth(currentPet->GetHealth() - currentPet->GetMaxHealth() * 0.35);
else
{ //Set health to 0 and check racial procs for attacking team.
currentPet->SetHealth(0);
CheckRacials(currentPet);
}
else
{
//Check if the pet can sustain the hit.
if (currentPet->GetHealth() - totalDamage > 0)
currentPet->SetHealth(currentPet->GetHealth() - totalDamage);
else
{ //Pet can't sustain the hit, set health to 0 and check racials.
currentPet->SetHealth(0);
CheckRacials(currentPet);
}
}
//Special exception; pet is unkillable but health hits 0.
if (currentPet->HasStatus(Pet::Unkillable) && currentPet->IsDead())
currentPet->SetHealth(1);
//Check if this is the main attack.
if (mainAttack)
{ //Check to see if racials have proc'd and set attack to true.
CheckRacialsProc(petStage, (teamIndex%2)+1);
petStage->GetTeam((teamIndex%2)+1)->GetActivePet()->AttackedThisRound(true);
}
//Scan over the auras for the current pet.
for (quint8 i=1; i < currentPet->GetNumAuras()+1; i+=1)
//Plague Blood.
if (currentPet->GetAura(i)->GetAuraId() == 658)
{
quint16 normalHealing = Round(4 + (float)currentPet->GetAura(i)->GetPower() * 0.2);
if (mainAttack)
{
//Opponent's active pet is healed; check his healing modifiers.
quint16 healing = Round(normalHealing * petStage->GetTeam((teamIndex%2)+1)->GetActivePet()->GetHealingModifier());
CheckHealing(petStage, (teamIndex%2)+1, petStage->GetTeam((teamIndex%2)+1)->GetActivePetIndex(), healing, false);
}
else
{
//Originator of the aura is healed; check his healing modifiers.
quint16 healing = Round(normalHealing * petStage->GetTeam(currentPet->GetAura(i)->GetOriginTeam())->GetPet(currentPet->GetAura(i)->GetOriginPet())->GetHealingModifier());
CheckHealing(petStage, currentPet->GetAura(i)->GetOriginTeam(), currentPet->GetAura(i)->GetOriginPet(), normalHealing, false);
}
}
//Asleep.
else if (currentPet->GetAura(i)->GetAuraId() == 498 || currentPet->GetAura(i)->GetAuraId() == 926 || currentPet->GetAura(i)->GetAuraId() == 496)
{
currentPet->RemoveStatus(Pet::Asleep);
currentPet->RemoveAura(i);
i -= 1;
}
//Silk Cocoon.
else if (currentPet->GetAura(i)->GetAuraId() == 505)
{
currentPet->SetSpeed(currentPet->GetNormalSpeed());
currentPet->SetHealth(currentHealth);
currentPet->RemoveAura(i);
i -= 1;
}
}