mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Merge pull request #1935 from rilian-la-te/fix-spell-display
Fix spell display
This commit is contained in:
@@ -63,7 +63,8 @@ int64_t CHeroWithMaybePickedArtifact::getTreeVersion() const
|
||||
|
||||
si32 CHeroWithMaybePickedArtifact::manaLimit() const
|
||||
{
|
||||
return hero->manaLimit();
|
||||
//TODO: reduplicate code with CGHeroInstance
|
||||
return si32(getPrimSkillLevel(PrimarySkill::KNOWLEDGE) * (valOfBonuses(Bonus::MANA_PER_KNOWLEDGE)));
|
||||
}
|
||||
|
||||
CHeroWithMaybePickedArtifact::CHeroWithMaybePickedArtifact(CWindowWithArtifacts * Cww, const CGHeroInstance * Hero)
|
||||
|
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
int64_t getTreeVersion() const override;
|
||||
|
||||
si32 manaLimit() const override;
|
||||
si32 manaLimit() const;
|
||||
};
|
||||
|
||||
class CHeroWindow : public CStatusbarWindow, public CGarrisonHolder, public CWindowWithArtifacts
|
||||
|
@@ -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;
|
||||
|
@@ -168,6 +168,11 @@ public:
|
||||
return owner;
|
||||
}
|
||||
|
||||
int32_t manaLimit() const override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void getCasterName(MetaString & text) const override
|
||||
{
|
||||
logGlobal->error("Unexpected call to ObstacleCasterProxy::getCasterName");
|
||||
|
Reference in New Issue
Block a user