mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Renamed new types for consistency with code style
This commit is contained in:
@@ -52,7 +52,7 @@ DamageRange DamageCalculator::getBaseDamageSingle() const
|
||||
{
|
||||
auto retrieveHeroPrimSkill = [&](PrimarySkill skill) -> int
|
||||
{
|
||||
std::shared_ptr<const Bonus> b = info.attacker->getBonus(Selector::sourceTypeSel(BonusSource::HERO_BASE_SKILL).And(Selector::typeSubtype(BonusType::PRIMARY_SKILL, TBonusSubtype(skill))));
|
||||
std::shared_ptr<const Bonus> b = info.attacker->getBonus(Selector::sourceTypeSel(BonusSource::HERO_BASE_SKILL).And(Selector::typeSubtype(BonusType::PRIMARY_SKILL, BonusSubtypeID(skill))));
|
||||
return b ? b->val : 0;
|
||||
};
|
||||
|
||||
@@ -144,7 +144,7 @@ int DamageCalculator::getActorAttackSlayer() const
|
||||
{
|
||||
SpellID spell(SpellID::SLAYER);
|
||||
int attackBonus = spell.toSpell()->getLevelPower(spLevel);
|
||||
if(info.attacker->hasBonusOfType(BonusType::SPECIAL_PECULIAR_ENCHANT, TBonusSubtype(spell)))
|
||||
if(info.attacker->hasBonusOfType(BonusType::SPECIAL_PECULIAR_ENCHANT, BonusSubtypeID(spell)))
|
||||
{
|
||||
ui8 attackerTier = info.attacker->unitType()->getLevel();
|
||||
ui8 specialtyBonus = std::max(5 - attackerTier, 0);
|
||||
@@ -206,11 +206,11 @@ double DamageCalculator::getAttackOffenseArcheryFactor() const
|
||||
if(info.shooting)
|
||||
{
|
||||
const std::string cachingStrArchery = "type_PERCENTAGE_DAMAGE_BOOSTs_1";
|
||||
static const auto selectorArchery = Selector::typeSubtype(BonusType::PERCENTAGE_DAMAGE_BOOST, BonusSubtypeID::damageTypeRanged);
|
||||
static const auto selectorArchery = Selector::typeSubtype(BonusType::PERCENTAGE_DAMAGE_BOOST, BonusCustomSubtype::damageTypeRanged);
|
||||
return info.attacker->valOfBonuses(selectorArchery, cachingStrArchery) / 100.0;
|
||||
}
|
||||
const std::string cachingStrOffence = "type_PERCENTAGE_DAMAGE_BOOSTs_0";
|
||||
static const auto selectorOffence = Selector::typeSubtype(BonusType::PERCENTAGE_DAMAGE_BOOST, BonusSubtypeID::damageTypeMelee);
|
||||
static const auto selectorOffence = Selector::typeSubtype(BonusType::PERCENTAGE_DAMAGE_BOOST, BonusCustomSubtype::damageTypeMelee);
|
||||
return info.attacker->valOfBonuses(selectorOffence, cachingStrOffence) / 100.0;
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ double DamageCalculator::getAttackDoubleDamageFactor() const
|
||||
{
|
||||
if(info.doubleDamage) {
|
||||
const auto cachingStr = "type_BONUS_DAMAGE_PERCENTAGEs_" + std::to_string(info.attacker->creatureIndex());
|
||||
const auto selector = Selector::typeSubtype(BonusType::BONUS_DAMAGE_PERCENTAGE, TBonusSubtype(info.attacker->creatureId()));
|
||||
const auto selector = Selector::typeSubtype(BonusType::BONUS_DAMAGE_PERCENTAGE, BonusSubtypeID(info.attacker->creatureId()));
|
||||
return info.attacker->valOfBonuses(selector, cachingStr) / 100.0;
|
||||
}
|
||||
return 0.0;
|
||||
@@ -260,7 +260,7 @@ double DamageCalculator::getAttackHateFactor() const
|
||||
|
||||
auto allHateEffects = info.attacker->getBonuses(selectorHate, cachingStrHate);
|
||||
|
||||
return allHateEffects->valOfBonuses(Selector::subtype()(TBonusSubtype(info.defender->creatureId()))) / 100.0;
|
||||
return allHateEffects->valOfBonuses(Selector::subtype()(BonusSubtypeID(info.defender->creatureId()))) / 100.0;
|
||||
}
|
||||
|
||||
double DamageCalculator::getDefenseSkillFactor() const
|
||||
@@ -282,7 +282,7 @@ double DamageCalculator::getDefenseSkillFactor() const
|
||||
double DamageCalculator::getDefenseArmorerFactor() const
|
||||
{
|
||||
const std::string cachingStrArmorer = "type_GENERAL_DAMAGE_REDUCTIONs_N1_NsrcSPELL_EFFECT";
|
||||
static const auto selectorArmorer = Selector::typeSubtype(BonusType::GENERAL_DAMAGE_REDUCTION, BonusSubtypeID::damageTypeAll).And(Selector::sourceTypeSel(BonusSource::SPELL_EFFECT).Not());
|
||||
static const auto selectorArmorer = Selector::typeSubtype(BonusType::GENERAL_DAMAGE_REDUCTION, BonusCustomSubtype::damageTypeAll).And(Selector::sourceTypeSel(BonusSource::SPELL_EFFECT).Not());
|
||||
return info.defender->valOfBonuses(selectorArmorer, cachingStrArmorer) / 100.0;
|
||||
|
||||
}
|
||||
@@ -290,10 +290,10 @@ double DamageCalculator::getDefenseArmorerFactor() const
|
||||
double DamageCalculator::getDefenseMagicShieldFactor() const
|
||||
{
|
||||
const std::string cachingStrMeleeReduction = "type_GENERAL_DAMAGE_REDUCTIONs_0";
|
||||
static const auto selectorMeleeReduction = Selector::typeSubtype(BonusType::GENERAL_DAMAGE_REDUCTION, BonusSubtypeID::damageTypeMelee);
|
||||
static const auto selectorMeleeReduction = Selector::typeSubtype(BonusType::GENERAL_DAMAGE_REDUCTION, BonusCustomSubtype::damageTypeMelee);
|
||||
|
||||
const std::string cachingStrRangedReduction = "type_GENERAL_DAMAGE_REDUCTIONs_1";
|
||||
static const auto selectorRangedReduction = Selector::typeSubtype(BonusType::GENERAL_DAMAGE_REDUCTION, BonusSubtypeID::damageTypeRanged);
|
||||
static const auto selectorRangedReduction = Selector::typeSubtype(BonusType::GENERAL_DAMAGE_REDUCTION, BonusCustomSubtype::damageTypeRanged);
|
||||
|
||||
//handling spell effects - shield and air shield
|
||||
if(info.shooting)
|
||||
@@ -313,7 +313,7 @@ double DamageCalculator::getDefenseRangePenaltiesFactor() const
|
||||
auto isAdvancedAirShield = [](const Bonus* bonus)
|
||||
{
|
||||
return bonus->source == BonusSource::SPELL_EFFECT
|
||||
&& bonus->sid == TBonusSourceID(SpellID(SpellID::AIR_SHIELD))
|
||||
&& bonus->sid == BonusSourceID(SpellID(SpellID::AIR_SHIELD))
|
||||
&& bonus->val >= MasteryLevel::ADVANCED;
|
||||
};
|
||||
|
||||
@@ -387,7 +387,7 @@ double DamageCalculator::getDefensePetrificationFactor() const
|
||||
{
|
||||
// Creatures that are petrified by a Basilisk's Petrifying attack or a Medusa's Stone gaze take 50% damage (R8 = 0.50) from ranged and melee attacks. Taking damage also deactivates the effect.
|
||||
const std::string cachingStrAllReduction = "type_GENERAL_DAMAGE_REDUCTIONs_N1_srcSPELL_EFFECT";
|
||||
static const auto selectorAllReduction = Selector::typeSubtype(BonusType::GENERAL_DAMAGE_REDUCTION, BonusSubtypeID::damageTypeAll).And(Selector::sourceTypeSel(BonusSource::SPELL_EFFECT));
|
||||
static const auto selectorAllReduction = Selector::typeSubtype(BonusType::GENERAL_DAMAGE_REDUCTION, BonusCustomSubtype::damageTypeAll).And(Selector::sourceTypeSel(BonusSource::SPELL_EFFECT));
|
||||
|
||||
return info.defender->valOfBonuses(selectorAllReduction, cachingStrAllReduction) / 100.0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user