mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Code cleanup, fixes to discovered regressions
This commit is contained in:
@@ -335,7 +335,7 @@ CUnitState::CUnitState():
|
||||
shots(this),
|
||||
stackSpeedPerTurn(this, Selector::type()(BonusType::STACKS_SPEED), BonusCacheMode::VALUE),
|
||||
immobilizedPerTurn(this, Selector::type()(BonusType::SIEGE_WEAPON).Or(Selector::type()(BonusType::BIND_EFFECT)), BonusCacheMode::PRESENCE),
|
||||
bonusCache(this, generateBonusSelectors()),
|
||||
bonusCache(this),
|
||||
cloneID(-1)
|
||||
{
|
||||
|
||||
@@ -933,38 +933,6 @@ void CUnitState::onRemoved()
|
||||
ghost = true;
|
||||
}
|
||||
|
||||
const UnitBonusValuesProxy::SelectorsArray * CUnitState::generateBonusSelectors()
|
||||
{
|
||||
static const CSelector additionalAttack = Selector::type()(BonusType::ADDITIONAL_ATTACK);
|
||||
static const CSelector selectorMelee = Selector::effectRange()(BonusLimitEffect::NO_LIMIT).Or(Selector::effectRange()(BonusLimitEffect::ONLY_MELEE_FIGHT));
|
||||
static const CSelector selectorRanged = Selector::effectRange()(BonusLimitEffect::NO_LIMIT).Or(Selector::effectRange()(BonusLimitEffect::ONLY_DISTANCE_FIGHT));
|
||||
static const CSelector minDamage = Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageBoth).Or(Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageMin));
|
||||
static const CSelector maxDamage = Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageBoth).Or(Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageMax));
|
||||
static const CSelector attack = Selector::typeSubtype(BonusType::PRIMARY_SKILL, BonusSubtypeID(PrimarySkill::ATTACK));
|
||||
static const CSelector defence = Selector::typeSubtype(BonusType::PRIMARY_SKILL, BonusSubtypeID(PrimarySkill::DEFENSE));
|
||||
|
||||
static const UnitBonusValuesProxy::SelectorsArray selectors = {
|
||||
additionalAttack.And(selectorMelee), //TOTAL_ATTACKS_MELEE,
|
||||
additionalAttack.And(selectorRanged), //TOTAL_ATTACKS_RANGED,
|
||||
minDamage.And(selectorMelee), //MIN_DAMAGE_MELEE,
|
||||
minDamage.And(selectorRanged), //MIN_DAMAGE_RANGED,
|
||||
maxDamage.And(selectorMelee), //MAX_DAMAGE_MELEE,
|
||||
maxDamage.And(selectorRanged), //MAX_DAMAGE_RANGED,
|
||||
attack.And(selectorRanged),//ATTACK_MELEE,
|
||||
attack.And(selectorRanged),//ATTACK_RANGED,
|
||||
defence.And(selectorRanged),//DEFENCE_MELEE,
|
||||
defence.And(selectorRanged),//DEFENCE_RANGED,
|
||||
Selector::type()(BonusType::IN_FRENZY),//IN_FRENZY,
|
||||
Selector::type()(BonusType::FORGETFULL),//FORGETFULL,
|
||||
Selector::type()(BonusType::HYPNOTIZED),//HYPNOTIZED,
|
||||
Selector::type()(BonusType::FREE_SHOOTING).Or(Selector::type()(BonusType::SIEGE_WEAPON)),//HAS_FREE_SHOOTING,
|
||||
Selector::type()(BonusType::STACK_HEALTH),//STACK_HEALTH,
|
||||
Selector::type()(BonusType::NONE).And(Selector::source(BonusSource::SPELL_EFFECT, BonusSourceID(SpellID(SpellID::CLONE))))
|
||||
};
|
||||
|
||||
return &selectors;
|
||||
}
|
||||
|
||||
CUnitStateDetached::CUnitStateDetached(const IUnitInfo * unit_, const IBonusBearer * bonus_):
|
||||
unit(unit_),
|
||||
bonus(bonus_)
|
||||
|
||||
Reference in New Issue
Block a user