mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Added separate bonus for native terrain check
This commit is contained in:
parent
ab7caa0777
commit
1459006916
@ -62,6 +62,10 @@ Eliminates terrain penalty on certain terrain types for affected heroes (Nomads
|
||||
|
||||
- subtype: type of terrain
|
||||
|
||||
### TERRAIN_NATIVE
|
||||
|
||||
Affected units will view any terrain as native
|
||||
|
||||
### PRIMARY_SKILL
|
||||
|
||||
Changes selected primary skill for affected heroes and units
|
||||
|
@ -33,14 +33,13 @@ bool INativeTerrainProvider::isNativeTerrain(TerrainId terrain) const
|
||||
|
||||
TerrainId AFactionMember::getNativeTerrain() const
|
||||
{
|
||||
constexpr auto any = TerrainId(ETerrainId::ANY_TERRAIN);
|
||||
const std::string cachingStringNoTerrainPenalty = "type_NO_TERRAIN_PENALTY_sANY";
|
||||
static const auto selectorNoTerrainPenalty = Selector::typeSubtype(BonusType::NO_TERRAIN_PENALTY, BonusSubtypeID(any));
|
||||
const std::string cachingStringNoTerrainPenalty = "type_TERRAIN_NATIVE_NONE";
|
||||
static const auto selectorNoTerrainPenalty = Selector::typeSubtype(BonusType::TERRAIN_NATIVE, BonusSubtypeID());
|
||||
|
||||
//this code is used in the CreatureTerrainLimiter::limit to setup battle bonuses
|
||||
//and in the CGHeroInstance::getNativeTerrain() to setup movement bonuses or/and penalties.
|
||||
return getBonusBearer()->hasBonus(selectorNoTerrainPenalty, cachingStringNoTerrainPenalty)
|
||||
? any : VLC->factions()->getById(getFaction())->getNativeTerrain();
|
||||
? TerrainId::ANY_TERRAIN : VLC->factions()->getById(getFaction())->getNativeTerrain();
|
||||
}
|
||||
|
||||
int32_t AFactionMember::magicResistance() const
|
||||
|
@ -169,6 +169,7 @@ class JsonNode;
|
||||
BONUS_NAME(MAX_LEARNABLE_SPELL_LEVEL) /*This can work as wisdom before. val = max learnable spell level*/\
|
||||
BONUS_NAME(SPELL_SCHOOL_IMMUNITY) /*This bonus will work as spell school immunity for all spells, subtype - spell school: 0 - air, 1 - fire, 2 - water, 3 - earth. Any is not handled for reducing overlap from LEVEL_SPELL_IMMUNITY*/\
|
||||
BONUS_NAME(NEGATIVE_EFFECTS_IMMUNITY) /*This bonus will work as spell school immunity for negative effects from spells of school, subtype - spell school: -1 - any, 0 - air, 1 - fire, 2 - water, 3 - earth*/\
|
||||
BONUS_NAME(TERRAIN_NATIVE)
|
||||
/* end of list */
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user