1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Bonus type ARTIFACT_CHARGE

This commit is contained in:
SoundSSGood
2025-05-11 22:42:41 +02:00
parent 9bbebd62e9
commit a750adf705
6 changed files with 31 additions and 2 deletions

View File

@@ -28,6 +28,8 @@
"vcmi.adventureMap.movementPointsHeroInfo" : "(Movement points: %REMAINING / %POINTS)",
"vcmi.adventureMap.replayOpponentTurnNotImplemented" : "Sorry, replay opponent turn is not implemented yet!",
"vcmi.artifact.charges" : "Charges",
"vcmi.bonusSource.artifact" : "Artifact",
"vcmi.bonusSource.creature" : "Ability",
"vcmi.bonusSource.spell" : "Spell",

View File

@@ -271,7 +271,14 @@ void CArtifactsOfHeroBase::setSlotData(ArtPlacePtr artPlace, const ArtifactPosit
{
artPlace->lockSlot(slotInfo->locked);
artPlace->setArtifact(slotInfo->getArt()->getTypeId(), slotInfo->getArt()->getScrollSpellID());
if(slotInfo->locked || slotInfo->getArt()->isCombined())
if(slotInfo->locked)
return;
const auto curArt = slotInfo->getArt();
// If the artifact has charges, add charges information
artPlace->addChargesArtInfo(curArt->valOfBonuses(BonusType::ARTIFACT_CHARGE));
if(curArt->isCombined())
return;
// If the artifact is part of at least one combined artifact, add additional information

View File

@@ -263,6 +263,18 @@ void CArtPlace::addCombinedArtInfo(const std::map<const ArtifactID, std::vector<
}
}
void CArtPlace::addChargesArtInfo(const int charges)
{
if(charges > 0)
{
MetaString info;
info.appendTextID("vcmi.artifact.charges");
info.appendRawString(" %d");
info.replaceNumber(charges);
text += info.toString();
}
}
CSecSkillPlace::CSecSkillPlace(const Point & position, const ImageSize & imageSize, const SecondarySkill & newSkillId, const uint8_t level)
: CComponentHolder(Rect(position, Point()), Point())
{

View File

@@ -44,6 +44,7 @@ public:
void lockSlot(bool on);
bool isLocked() const;
void addCombinedArtInfo(const std::map<const ArtifactID, std::vector<ArtifactID>> & arts);
void addChargesArtInfo(const int charges);
private:
ArtifactID artId;

View File

@@ -1031,10 +1031,16 @@ Increases amount of information available in affected thieves guild (in town or
- val: additional number of 'levels' of information to grant access to
### LEVEL_COUNTER
### ARTIFACT_GROWING
Internal bonus, do not use
### ARTIFACT_CHARGE
Consumable bonus. Used to perform actions specified by a specific artifact.
- val: number of charges
### DISINTEGRATE
When a unit affected by this bonus dies, no corpse is left behind

View File

@@ -17,6 +17,7 @@ class JsonNode;
#define BONUS_LIST \
BONUS_NAME(NONE) \
BONUS_NAME(ARTIFACT_GROWING) \
BONUS_NAME(ARTIFACT_CHARGE) \
BONUS_NAME(MOVEMENT) /*Subtype is 1 - land, 0 - sea*/ \
BONUS_NAME(MORALE) \
BONUS_NAME(LUCK) \