2023-03-19 02:44:10 +02:00
|
|
|
/*
|
|
|
|
* ObstacleCasterProxy.cpp, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-04-07 10:50:33 +02:00
|
|
|
#include "StdInc.h"
|
2023-03-19 02:44:10 +02:00
|
|
|
#include "ObstacleCasterProxy.h"
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
namespace spells
|
|
|
|
{
|
|
|
|
|
2023-03-20 13:02:09 +02:00
|
|
|
ObstacleCasterProxy::ObstacleCasterProxy(PlayerColor owner_, const Caster * hero_, const SpellCreatedObstacle & obs_):
|
|
|
|
SilentCaster(owner_, hero_),
|
|
|
|
obs(obs_)
|
2023-03-19 02:44:10 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t ObstacleCasterProxy::getSpellSchoolLevel(const Spell * spell, int32_t * outSelectedSchool) const
|
|
|
|
{
|
|
|
|
return obs.spellLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t ObstacleCasterProxy::getEffectLevel(const Spell * spell) const
|
|
|
|
{
|
|
|
|
return obs.spellLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
int64_t ObstacleCasterProxy::getSpellBonus(const Spell * spell, int64_t base, const battle::Unit * affectedStack) const
|
|
|
|
{
|
|
|
|
if(actualCaster)
|
|
|
|
return std::max<int64_t>(actualCaster->getSpellBonus(spell, base, affectedStack), obs.minimalDamage);
|
|
|
|
|
2023-03-20 13:02:09 +02:00
|
|
|
return std::max<int64_t>(base, obs.minimalDamage);
|
2023-03-19 02:44:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int32_t ObstacleCasterProxy::getEffectPower(const Spell * spell) const
|
|
|
|
{
|
|
|
|
return obs.casterSpellPower;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t ObstacleCasterProxy::getEnchantPower(const Spell * spell) const
|
|
|
|
{
|
|
|
|
return obs.casterSpellPower;
|
|
|
|
}
|
|
|
|
|
|
|
|
int64_t ObstacleCasterProxy::getEffectValue(const Spell * spell) const
|
|
|
|
{
|
|
|
|
if(actualCaster)
|
|
|
|
return std::max(static_cast<int64_t>(obs.minimalDamage), actualCaster->getEffectValue(spell));
|
|
|
|
else
|
|
|
|
return obs.minimalDamage;
|
|
|
|
}
|
|
|
|
|
2023-04-11 18:37:35 +02:00
|
|
|
int32_t SilentCaster::manaLimit() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-03-20 13:02:09 +02:00
|
|
|
SilentCaster::SilentCaster(PlayerColor owner_, const Caster * hero_):
|
|
|
|
ProxyCaster(hero_),
|
|
|
|
owner(std::move(owner_))
|
2023-03-19 02:44:10 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-03-20 13:02:09 +02:00
|
|
|
void SilentCaster::getCasterName(MetaString & text) const
|
2023-03-19 02:44:10 +02:00
|
|
|
{
|
2023-03-20 13:02:09 +02:00
|
|
|
logGlobal->error("Unexpected call to SilentCaster::getCasterName");
|
2023-03-19 02:44:10 +02:00
|
|
|
}
|
|
|
|
|
2023-03-20 13:02:09 +02:00
|
|
|
void SilentCaster::getCastDescription(const Spell * spell, const std::vector<const battle::Unit *> & attacked, MetaString & text) const
|
2023-03-19 02:44:10 +02:00
|
|
|
{
|
|
|
|
//do nothing
|
|
|
|
}
|
|
|
|
|
2023-03-20 13:02:09 +02:00
|
|
|
void SilentCaster::spendMana(ServerCallback * server, const int spellCost) const
|
2023-03-19 02:44:10 +02:00
|
|
|
{
|
|
|
|
//do nothing
|
|
|
|
}
|
|
|
|
|
2023-03-20 13:02:09 +02:00
|
|
|
PlayerColor SilentCaster::getCasterOwner() const
|
|
|
|
{
|
|
|
|
if(actualCaster)
|
|
|
|
return actualCaster->getCasterOwner();
|
|
|
|
|
|
|
|
return owner;
|
|
|
|
}
|
|
|
|
|
2023-03-19 02:44:10 +02:00
|
|
|
}
|
2023-04-11 18:37:35 +02:00
|
|
|
VCMI_LIB_NAMESPACE_END
|