1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

vcmi: rename IFactionMember and ICreature

This commit is contained in:
Konstantin 2023-04-30 18:21:02 +03:00
parent 1d34c73c2d
commit b6eb2dc060
11 changed files with 31 additions and 31 deletions

View File

@ -372,7 +372,7 @@ CTownTooltip::CTownTooltip(Point pos, const CGTownInstance * town)
init(InfoAboutTown(town, true));
}
void MoraleLuckBox::set(const IFactionMember * node)
void MoraleLuckBox::set(const AFactionMember * node)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);

View File

@ -16,7 +16,7 @@ VCMI_LIB_NAMESPACE_BEGIN
class CGGarrison;
struct InfoAboutArmy;
class CArmedInstance;
class IFactionMember;
class AFactionMember;
VCMI_LIB_NAMESPACE_END
@ -170,7 +170,7 @@ public:
bool morale; //true if morale, false if luck
bool small;
void set(const IFactionMember *node);
void set(const AFactionMember *node);
MoraleLuckBox(bool Morale, const Rect &r, bool Small=false);
};

View File

@ -47,7 +47,7 @@ public:
};
//helper class for calculating values of hero bonuses without bonuses from picked up artifact
class CHeroWithMaybePickedArtifact : public IBonusBearer, public IFactionMember
class CHeroWithMaybePickedArtifact : public IBonusBearer, public AFactionMember
{
public:
const CGHeroInstance * hero;

View File

@ -19,7 +19,7 @@ class ResourceSet;
enum class EGameResID : int8_t;
/// Base class for creatures and battle stacks
class DLL_LINKAGE ICreature: public IFactionMember
class DLL_LINKAGE ACreature: public AFactionMember
{
public:
bool isLiving() const; //non-undead, non-non living or alive
@ -28,7 +28,7 @@ public:
};
template <typename IdType>
class DLL_LINKAGE CreatureEntity : public EntityT<IdType>, public ICreature
class DLL_LINKAGE CreatureEntity : public EntityT<IdType>, public ACreature
{
};

View File

@ -21,7 +21,7 @@ namespace PrimarySkill
enum PrimarySkill : int8_t;
}
class DLL_LINKAGE IFactionMember: public IConstBonusProvider, public INativeTerrainProvider
class DLL_LINKAGE AFactionMember: public IConstBonusProvider, public INativeTerrainProvider
{
public:
/**

View File

@ -27,7 +27,7 @@ bool INativeTerrainProvider::isNativeTerrain(TerrainId terrain) const
return native == terrain || native == ETerrainId::ANY_TERRAIN;
}
TerrainId IFactionMember::getNativeTerrain() const
TerrainId AFactionMember::getNativeTerrain() const
{
constexpr auto any = TerrainId(ETerrainId::ANY_TERRAIN);
const std::string cachingStringNoTerrainPenalty = "type_NO_TERRAIN_PENALTY_sANY";
@ -39,14 +39,14 @@ TerrainId IFactionMember::getNativeTerrain() const
? any : VLC->factions()->getById(getFaction())->getNativeTerrain();
}
int32_t IFactionMember::magicResistance() const
int32_t AFactionMember::magicResistance() const
{
si32 val = getBonusBearer()->valOfBonuses(Selector::type()(Bonus::MAGIC_RESISTANCE));
vstd::amin (val, 100);
return val;
}
int IFactionMember::getAttack(bool ranged) const
int AFactionMember::getAttack(bool ranged) const
{
const std::string cachingStr = "type_PRIMARY_SKILLs_ATTACK";
@ -55,7 +55,7 @@ int IFactionMember::getAttack(bool ranged) const
return getBonusBearer()->valOfBonuses(selector, cachingStr);
}
int IFactionMember::getDefense(bool ranged) const
int AFactionMember::getDefense(bool ranged) const
{
const std::string cachingStr = "type_PRIMARY_SKILLs_DEFENSE";
@ -64,21 +64,21 @@ int IFactionMember::getDefense(bool ranged) const
return getBonusBearer()->valOfBonuses(selector, cachingStr);
}
int IFactionMember::getMinDamage(bool ranged) const
int AFactionMember::getMinDamage(bool ranged) const
{
const std::string cachingStr = "type_CREATURE_DAMAGEs_0Otype_CREATURE_DAMAGEs_1";
static const auto selector = Selector::typeSubtype(Bonus::CREATURE_DAMAGE, 0).Or(Selector::typeSubtype(Bonus::CREATURE_DAMAGE, 1));
return getBonusBearer()->valOfBonuses(selector, cachingStr);
}
int IFactionMember::getMaxDamage(bool ranged) const
int AFactionMember::getMaxDamage(bool ranged) const
{
const std::string cachingStr = "type_CREATURE_DAMAGEs_0Otype_CREATURE_DAMAGEs_2";
static const auto selector = Selector::typeSubtype(Bonus::CREATURE_DAMAGE, 0).Or(Selector::typeSubtype(Bonus::CREATURE_DAMAGE, 2));
return getBonusBearer()->valOfBonuses(selector, cachingStr);
}
int IFactionMember::getPrimSkillLevel(PrimarySkill::PrimarySkill id) const
int AFactionMember::getPrimSkillLevel(PrimarySkill::PrimarySkill id) const
{
static const CSelector selectorAllSkills = Selector::type()(Bonus::PRIMARY_SKILL);
static const std::string keyAllSkills = "type_PRIMARY_SKILL";
@ -88,12 +88,12 @@ int IFactionMember::getPrimSkillLevel(PrimarySkill::PrimarySkill id) const
return std::max(ret, minSkillValue); //otherwise, some artifacts may cause negative skill value effect, sp=0 works in old saves
}
int IFactionMember::MoraleValAndBonusList(TConstBonusListPtr & bonusList) const
int AFactionMember::MoraleValAndBonusList(TConstBonusListPtr & bonusList) const
{
static const auto unaffectedByMoraleSelector = Selector::type()(Bonus::NON_LIVING).Or(Selector::type()(Bonus::UNDEAD))
.Or(Selector::type()(Bonus::SIEGE_WEAPON)).Or(Selector::type()(Bonus::NO_MORALE));
static const std::string cachingStrUn = "IFactionMember::unaffectedByMoraleSelector";
static const std::string cachingStrUn = "AFactionMember::unaffectedByMoraleSelector";
auto unaffected = getBonusBearer()->hasBonus(unaffectedByMoraleSelector, cachingStrUn);
if(unaffected)
{
@ -109,7 +109,7 @@ int IFactionMember::MoraleValAndBonusList(TConstBonusListPtr & bonusList) const
return std::clamp(bonusList->totalValue(), -3, +3);
}
int IFactionMember::LuckValAndBonusList(TConstBonusListPtr & bonusList) const
int AFactionMember::LuckValAndBonusList(TConstBonusListPtr & bonusList) const
{
if(getBonusBearer()->hasBonusOfType(Bonus::NO_LUCK))
{
@ -125,19 +125,19 @@ int IFactionMember::LuckValAndBonusList(TConstBonusListPtr & bonusList) const
return std::clamp(bonusList->totalValue(), -3, +3);
}
int IFactionMember::MoraleVal() const
int AFactionMember::MoraleVal() const
{
TConstBonusListPtr tmp = nullptr;
return MoraleValAndBonusList(tmp);
}
int IFactionMember::LuckVal() const
int AFactionMember::LuckVal() const
{
TConstBonusListPtr tmp = nullptr;
return LuckValAndBonusList(tmp);
}
ui32 ICreature::MaxHealth() const
ui32 ACreature::MaxHealth() const
{
const std::string cachingStr = "type_STACK_HEALTH";
static const auto selector = Selector::type()(Bonus::STACK_HEALTH);
@ -145,7 +145,7 @@ ui32 ICreature::MaxHealth() const
return std::max(1, value); //never 0
}
ui32 ICreature::Speed(int turn, bool useBind) const
ui32 ACreature::Speed(int turn, bool useBind) const
{
//war machines cannot move
if(getBonusBearer()->hasBonus(Selector::type()(Bonus::SIEGE_WEAPON).And(Selector::turns(turn))))
@ -161,9 +161,9 @@ ui32 ICreature::Speed(int turn, bool useBind) const
return getBonusBearer()->valOfBonuses(Selector::type()(Bonus::STACKS_SPEED).And(Selector::turns(turn)));
}
bool ICreature::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
bool ACreature::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
{
static const std::string cachingStr = "ICreature::isLiving";
static const std::string cachingStr = "ACreature::isLiving";
static const CSelector selector = Selector::type()(Bonus::UNDEAD)
.Or(Selector::type()(Bonus::NON_LIVING))
.Or(Selector::type()(Bonus::GARGOYLE))

View File

@ -64,7 +64,7 @@ public:
void serializeJson(JsonSerializeFormat & handler);
};
class DLL_LINKAGE CStackInstance : public CBonusSystemNode, public CStackBasicDescriptor, public CArtifactSet, public ICreature
class DLL_LINKAGE CStackInstance : public CBonusSystemNode, public CStackBasicDescriptor, public CArtifactSet, public ACreature
{
protected:
const CArmedInstance *_armyObj; //stack must be part of some army, army must be part of some object

View File

@ -89,7 +89,7 @@ ui32 CStack::level() const
si32 CStack::magicResistance() const
{
auto magicResistance = IFactionMember::magicResistance();
auto magicResistance = AFactionMember::magicResistance();
si32 auraBonus = 0;

View File

@ -41,7 +41,7 @@ namespace BattlePhases
class CUnitState;
class DLL_LINKAGE Unit : public IUnitInfo, public spells::Caster, public virtual IBonusBearer, public ICreature
class DLL_LINKAGE Unit : public IUnitInfo, public spells::Caster, public virtual IBonusBearer, public ACreature
{
public:
virtual ~Unit();

View File

@ -41,7 +41,7 @@ public:
};
class DLL_LINKAGE CGHeroInstance : public CArmedInstance, public IBoatGenerator, public CArtifactSet, public spells::Caster, public IFactionMember
class DLL_LINKAGE CGHeroInstance : public CArmedInstance, public IBoatGenerator, public CArtifactSet, public spells::Caster, public AFactionMember
{
// We serialize heroes into JSON for crossover
friend class CCampaignState;

View File

@ -29,10 +29,10 @@ VCMI_REGISTER_SCRIPT_API(UnitProxy, "battle.Unit")
const std::vector<UnitProxy::CustomRegType> UnitProxy::REGISTER_CUSTOM =
{
{"getMinDamage", LuaMethodWrapper<Unit, decltype(&ICreature::getMinDamage), &ICreature::getMinDamage>::invoke, false},
{"getMaxDamage", LuaMethodWrapper<Unit, decltype(&ICreature::getMaxDamage), &ICreature::getMaxDamage>::invoke, false},
{"getAttack", LuaMethodWrapper<Unit, decltype(&ICreature::getAttack), &ICreature::getAttack>::invoke, false},
{"getDefense", LuaMethodWrapper<Unit, decltype(&ICreature::getDefense), &ICreature::getDefense>::invoke, false},
{"getMinDamage", LuaMethodWrapper<Unit, decltype(&ACreature::getMinDamage), &ACreature::getMinDamage>::invoke, false},
{"getMaxDamage", LuaMethodWrapper<Unit, decltype(&ACreature::getMaxDamage), &ACreature::getMaxDamage>::invoke, false},
{"getAttack", LuaMethodWrapper<Unit, decltype(&ACreature::getAttack), &ACreature::getAttack>::invoke, false},
{"getDefense", LuaMethodWrapper<Unit, decltype(&ACreature::getDefense), &ACreature::getDefense>::invoke, false},
{"isAlive", LuaMethodWrapper<Unit, decltype(&Unit::alive), &Unit::alive>::invoke, false},
{"unitId", LuaMethodWrapper<Unit, decltype(&IUnitInfo::unitId), &IUnitInfo::unitId>::invoke, false},
};