mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Use absoluteLimit
* all "old" limits are now absolute
This commit is contained in:
parent
3209114393
commit
950ca1156a
@ -362,7 +362,7 @@
|
|||||||
"offensive": true,
|
"offensive": true,
|
||||||
"negative": true
|
"negative": true
|
||||||
},
|
},
|
||||||
"limit" : {
|
"absoluteLimit" : {
|
||||||
"UNDEAD": true
|
"UNDEAD": true
|
||||||
},
|
},
|
||||||
"immunity" : {
|
"immunity" : {
|
||||||
|
@ -241,7 +241,7 @@
|
|||||||
"rising": true,
|
"rising": true,
|
||||||
"positive": true
|
"positive": true
|
||||||
},
|
},
|
||||||
"limit" : {
|
"absoluteLimit" : {
|
||||||
"UNDEAD": true
|
"UNDEAD": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -781,7 +781,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"limit" : {
|
"absoluteLimit" : {
|
||||||
"SHOOTER": true
|
"SHOOTER": true
|
||||||
},
|
},
|
||||||
"flags" : {
|
"flags" : {
|
||||||
@ -1846,7 +1846,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"limit" : {
|
"absoluteLimit" : {
|
||||||
"SHOOTER": true
|
"SHOOTER": true
|
||||||
},
|
},
|
||||||
"immunity" : {
|
"immunity" : {
|
||||||
|
@ -413,15 +413,14 @@ void CSpell::getEffects(std::vector<Bonus>& lst, const int level) const
|
|||||||
bool CSpell::isImmuneBy(const IBonusBearer* obj) const
|
bool CSpell::isImmuneBy(const IBonusBearer* obj) const
|
||||||
{
|
{
|
||||||
//todo: use new bonus API
|
//todo: use new bonus API
|
||||||
//1. Check limiters
|
//1. Check absolute limiters
|
||||||
for(auto b : limiters)
|
for(auto b : absoluteLimiters)
|
||||||
{
|
{
|
||||||
if (!obj->hasBonusOfType(b))
|
if (!obj->hasBonusOfType(b))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//2. Check absolute immunities
|
//2. Check absolute immunities
|
||||||
//todo: check config: some creatures are unaffected always, for example undead to resurrection.
|
|
||||||
for(auto b : absoluteImmunities)
|
for(auto b : absoluteImmunities)
|
||||||
{
|
{
|
||||||
if (obj->hasBonusOfType(b))
|
if (obj->hasBonusOfType(b))
|
||||||
@ -429,10 +428,19 @@ bool CSpell::isImmuneBy(const IBonusBearer* obj) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//3. Check negation
|
//3. Check negation
|
||||||
|
//FIXME: Orb of vulnerability mechanics is not such trivial
|
||||||
if(obj->hasBonusOfType(Bonus::NEGATE_ALL_NATURAL_IMMUNITIES)) //Orb of vulnerability
|
if(obj->hasBonusOfType(Bonus::NEGATE_ALL_NATURAL_IMMUNITIES)) //Orb of vulnerability
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//4. Check negatable immunities
|
//4. Check negatable limit
|
||||||
|
for(auto b : limiters)
|
||||||
|
{
|
||||||
|
if (!obj->hasBonusOfType(b))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//5. Check negatable immunities
|
||||||
for(auto b : immunities)
|
for(auto b : immunities)
|
||||||
{
|
{
|
||||||
if (obj->hasBonusOfType(b))
|
if (obj->hasBonusOfType(b))
|
||||||
@ -451,7 +459,7 @@ bool CSpell::isImmuneBy(const IBonusBearer* obj) const
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
//4. Check elemental immunities
|
//6. Check elemental immunities
|
||||||
if(fire)
|
if(fire)
|
||||||
{
|
{
|
||||||
if(battleTestElementalImmunity(Bonus::FIRE_IMMUNITY))
|
if(battleTestElementalImmunity(Bonus::FIRE_IMMUNITY))
|
||||||
@ -786,10 +794,9 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
|||||||
};
|
};
|
||||||
|
|
||||||
readBonusStruct("immunity", spell->immunities);
|
readBonusStruct("immunity", spell->immunities);
|
||||||
|
|
||||||
readBonusStruct("absoluteImmunity", spell->absoluteImmunities);
|
readBonusStruct("absoluteImmunity", spell->absoluteImmunities);
|
||||||
|
|
||||||
readBonusStruct("limit", spell->limiters);
|
readBonusStruct("limit", spell->limiters);
|
||||||
|
readBonusStruct("absoluteLimit", spell->absoluteLimiters);
|
||||||
|
|
||||||
|
|
||||||
const JsonNode & graphicsNode = json["graphics"];
|
const JsonNode & graphicsNode = json["graphics"];
|
||||||
|
@ -138,9 +138,9 @@ public:
|
|||||||
& probabilities & attributes & combatSpell & creatureAbility & positiveness & counteredSpells & mainEffectAnim;
|
& probabilities & attributes & combatSpell & creatureAbility & positiveness & counteredSpells & mainEffectAnim;
|
||||||
h & isRising & isDamage & isOffensive;
|
h & isRising & isDamage & isOffensive;
|
||||||
h & targetType;
|
h & targetType;
|
||||||
h & immunities & limiters;
|
h & immunities & limiters & absoluteImmunities & absoluteLimiters;
|
||||||
h & iconImmune;
|
h & iconImmune;
|
||||||
h & absoluteImmunities & defaultProbability;
|
h & defaultProbability;
|
||||||
|
|
||||||
h & isSpecial;
|
h & isSpecial;
|
||||||
|
|
||||||
@ -171,6 +171,7 @@ private:
|
|||||||
std::vector<Bonus::BonusType> immunities; //any of these grants immunity
|
std::vector<Bonus::BonusType> immunities; //any of these grants immunity
|
||||||
std::vector<Bonus::BonusType> absoluteImmunities; //any of these grants immunity, can't be negated
|
std::vector<Bonus::BonusType> absoluteImmunities; //any of these grants immunity, can't be negated
|
||||||
std::vector<Bonus::BonusType> limiters; //all of them are required to be affected
|
std::vector<Bonus::BonusType> limiters; //all of them are required to be affected
|
||||||
|
std::vector<Bonus::BonusType> absoluteLimiters; //all of them are required to be affected, can't be negated
|
||||||
|
|
||||||
///graphics related stuff
|
///graphics related stuff
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "mapping/CCampaignHandler.h" //for CCampaignState
|
#include "mapping/CCampaignHandler.h" //for CCampaignState
|
||||||
#include "rmg/CMapGenerator.h" // for CMapGenOptions
|
#include "rmg/CMapGenerator.h" // for CMapGenOptions
|
||||||
|
|
||||||
const ui32 version = 748;
|
const ui32 version = 749;
|
||||||
const ui32 minSupportedVersion = version;
|
const ui32 minSupportedVersion = version;
|
||||||
|
|
||||||
class CConnection;
|
class CConnection;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user