1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

support setting spell master level in OPENING_BATTLE_SPELLS

This commit is contained in:
kdmcser
2025-08-11 02:13:36 +08:00
parent 25ba05cdab
commit 594ae27cb5
3 changed files with 4 additions and 1 deletions

View File

@@ -403,6 +403,7 @@ In battle, army affected by this bonus will cast spell at the very start of the
- subtype: spell identifier
- val: duration of the spell, in rounds
- addInfo - spell mastery level (1 - Basic, 3 - Expert)
### FREE_SHIP_BOARDING

View File

@@ -225,6 +225,7 @@ static void loadBonusAddInfo(CAddInfo & var, BonusType type, const JsonNode & va
case BonusType::DARKNESS:
case BonusType::FULL_MAP_SCOUTING:
case BonusType::FULL_MAP_DARKNESS:
case BonusType::OPENING_BATTLE_SPELL:
// 1 number
var = getFirstValue(value).Integer();
break;

View File

@@ -206,7 +206,8 @@ void BattleFlowProcessor::castOpeningSpells(const CBattleInfoCallback & battle)
const CSpell * spell = b->subtype.as<SpellID>().toSpell();
spells::BattleCast parameters(&battle, &caster, spells::Mode::PASSIVE, spell);
parameters.setSpellLevel(3);
int32_t spellLevel = b->additionalInfo != CAddInfo::NONE ? b->additionalInfo[0] : 3;
parameters.setSpellLevel(spellLevel);
parameters.setEffectDuration(b->val);
parameters.massive = true;
parameters.castIfPossible(gameHandler->spellcastEnvironment(), spells::Target());