mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
hide bonus
This commit is contained in:
@@ -936,7 +936,7 @@ void CStackWindow::initBonusesList()
|
||||
bonusInfo.bonusSource = b->source;
|
||||
|
||||
//if it's possible to give any description or image for this kind of bonus
|
||||
if(!bonusInfo.description.empty())
|
||||
if(!bonusInfo.description.empty() && !b->hidden)
|
||||
activeBonuses.push_back(bonusInfo);
|
||||
}
|
||||
}
|
||||
|
@@ -252,6 +252,10 @@
|
||||
{ "type" : "number" }
|
||||
],
|
||||
"description" : "description"
|
||||
},
|
||||
"hidden" : {
|
||||
"type" : "boolean",
|
||||
"description" : "Optional, hide bonus in creature window"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -72,6 +72,9 @@ All parameters but type are optional.
|
||||
// Optional, path to custom icon that will be visible in creature window
|
||||
"icon" : "",
|
||||
|
||||
// Optional, hide bonus in creature window
|
||||
"hidden" : true,
|
||||
|
||||
// Stacking string allows to block stacking of bonuses from different entities
|
||||
// For example, devils and archdevils (different entities) both have battle-wide debuff to luck
|
||||
// Normally, having both such units in combat would result in bonus stacking, providing -2 debuff to luck in total
|
||||
|
@@ -203,6 +203,7 @@ JsonNode Bonus::toJsonNode() const
|
||||
root["updater"] = updater->toJsonNode();
|
||||
if(propagator)
|
||||
root["propagator"].String() = vstd::findKey(bonusPropagatorMap, propagator);
|
||||
root["hidden"].Bool() = hidden;
|
||||
return root;
|
||||
}
|
||||
|
||||
|
@@ -75,6 +75,8 @@ struct DLL_LINKAGE Bonus : public std::enable_shared_from_this<Bonus>, public Se
|
||||
MetaString description;
|
||||
PlayerColor bonusOwner = PlayerColor::CANNOT_DETERMINE;
|
||||
|
||||
bool hidden;
|
||||
|
||||
Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID sourceID);
|
||||
Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID sourceID, BonusSubtypeID subtype);
|
||||
Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID sourceID, BonusSubtypeID subtype, BonusValueType ValType);
|
||||
@@ -92,6 +94,8 @@ struct DLL_LINKAGE Bonus : public std::enable_shared_from_this<Bonus>, public Se
|
||||
h & description;
|
||||
if (h.hasFeature(Handler::Version::CUSTOM_BONUS_ICONS))
|
||||
h & customIconPath;
|
||||
if (h.hasFeature(Handler::Version::BONUS_HIDDEN))
|
||||
h & hidden;
|
||||
h & additionalInfo;
|
||||
h & turnsRemain;
|
||||
h & valType;
|
||||
|
@@ -723,6 +723,8 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b, const TextIdentifi
|
||||
if(!ability["icon"].isNull())
|
||||
b->customIconPath = ImagePath::fromJson(ability["icon"]);
|
||||
|
||||
b->hidden = !ability["hidden"].isNull() && ability["hidden"].Bool();
|
||||
|
||||
value = &ability["effectRange"];
|
||||
if (!value->isNull())
|
||||
b->effectRange = static_cast<BonusLimitEffect>(parseByMapN(bonusLimitEffect, value, "effect range "));
|
||||
|
@@ -47,8 +47,9 @@ enum class ESerializationVersion : int32_t
|
||||
OPPOSITE_SIDE_LIMITER_OWNER, // opposite side limiter no longer stores owner in itself
|
||||
UNIVERSITY_CONFIG, // town university is configurable
|
||||
CAMPAIGN_BONUSES, // new format for scenario bonuses in campaigns
|
||||
BONUS_HIDDEN, // hidden bonus
|
||||
|
||||
CURRENT = CAMPAIGN_BONUSES,
|
||||
CURRENT = BONUS_HIDDEN,
|
||||
};
|
||||
|
||||
static_assert(ESerializationVersion::MINIMAL <= ESerializationVersion::CURRENT, "Invalid serialization version definition!");
|
||||
|
Reference in New Issue
Block a user