mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
vcmi: manaLimit should be spellcaster property
This commit is contained in:
parent
40bea35a26
commit
4f3c826196
@ -65,6 +65,8 @@ public:
|
||||
virtual void getCastDescription(const Spell * spell, const std::vector<const battle::Unit *> & attacked, MetaString & text) const = 0;
|
||||
|
||||
virtual void spendMana(ServerCallback * server, const int32_t spellCost) const = 0;
|
||||
|
||||
virtual int32_t manaLimit() const = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -789,11 +789,6 @@ int IBonusBearer::getMaxDamage(bool ranged) const
|
||||
return valOfBonuses(selector, cachingStr);
|
||||
}
|
||||
|
||||
si32 IBonusBearer::manaLimit() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int IBonusBearer::getPrimSkillLevel(PrimarySkill::PrimarySkill id) const
|
||||
{
|
||||
static const CSelector selectorAllSkills = Selector::type()(Bonus::PRIMARY_SKILL);
|
||||
|
@ -752,7 +752,6 @@ public:
|
||||
virtual si32 magicResistance() const;
|
||||
ui32 Speed(int turn = 0, bool useBind = false) const; //get speed of creature with all modificators
|
||||
|
||||
virtual si32 manaLimit() const; //maximum mana value for this hero (basically 10*knowledge)
|
||||
int getPrimSkillLevel(PrimarySkill::PrimarySkill id) const;
|
||||
|
||||
virtual int64_t getTreeVersion() const = 0;
|
||||
|
@ -478,6 +478,11 @@ void CUnitState::getCastDescription(const spells::Spell * spell, const std::vect
|
||||
text.addReplacement(MetaString::SPELL_NAME, spell->getIndex());
|
||||
}
|
||||
|
||||
int32_t CUnitState::manaLimit() const
|
||||
{
|
||||
return 0; //TODO: creature casting with mana mode (for mods)
|
||||
}
|
||||
|
||||
bool CUnitState::ableToRetaliate() const
|
||||
{
|
||||
return alive()
|
||||
|
@ -194,6 +194,7 @@ public:
|
||||
PlayerColor getCasterOwner() const override;
|
||||
void getCasterName(MetaString & text) const override;
|
||||
void getCastDescription(const spells::Spell * spell, const std::vector<const Unit *> & attacked, MetaString & text) const override;
|
||||
int32_t manaLimit() const override;
|
||||
|
||||
bool ableToRetaliate() const override;
|
||||
bool alive() const override;
|
||||
|
@ -86,6 +86,14 @@ void ProxyCaster::spendMana(ServerCallback * server, const int32_t spellCost) co
|
||||
actualCaster->spendMana(server, spellCost);
|
||||
}
|
||||
|
||||
int32_t ProxyCaster::manaLimit() const
|
||||
{
|
||||
if(actualCaster)
|
||||
return actualCaster->manaLimit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
void getCasterName(MetaString & text) const override;
|
||||
void getCastDescription(const Spell * spell, const std::vector<const battle::Unit *> & attacked, MetaString & text) const override;
|
||||
void spendMana(ServerCallback * server, const int32_t spellCost) const override;
|
||||
int32_t manaLimit() const override;
|
||||
|
||||
private:
|
||||
const Caster * actualCaster;
|
||||
|
Loading…
Reference in New Issue
Block a user