mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fixed handling of SPELL_AFTER_ATTACK without addInfo field
This commit is contained in:
parent
d3a1cdb97a
commit
5565b55bb0
@ -788,7 +788,7 @@ Determines how many times per combat affected creature can cast its targeted spe
|
||||
- subtype - spell id, eg. spell.iceBolt
|
||||
- value - chance (percent)
|
||||
- additional info - \[X, Y, Z\]
|
||||
- X - spell level
|
||||
- X - spell mastery level (1 - Basic, 3 - Expert)
|
||||
- Y = 0 - all attacks, 1 - shot only, 2 - melee only
|
||||
- Z (optional) - layer for multiple SPELL_AFTER_ATTACK bonuses and multi-turn casting. Empty or value less than 0 = not participating in layering.
|
||||
When enabled - spells from specific layer will not be cast until target has all spells from previous layer on him. Spell from last layer is on repeat if none of spells on lower layers expired.
|
||||
@ -798,7 +798,7 @@ Determines how many times per combat affected creature can cast its targeted spe
|
||||
- subtype - spell id
|
||||
- value - chance %
|
||||
- additional info - \[X, Y, Z\]
|
||||
- X - spell level
|
||||
- X - spell mastery level (1 - Basic, 3 - Expert)
|
||||
- Y = 0 - all attacks, 1 - shot only, 2 - melee only
|
||||
- Z (optional) - layer for multiple SPELL_BEFORE_ATTACK bonuses and multi-turn casting. Empty or value less than 0 = not participating in layering.
|
||||
When enabled - spells from specific layer will not be cast until target has all spells from previous layer on him. Spell from last layer is on repeat if none of spells on lower layers expired.
|
||||
|
@ -1139,18 +1139,10 @@ void BattleActionProcessor::attackCasting(const CBattleInfoCallback & battle, bo
|
||||
for(const auto & sf : *spellsByType)
|
||||
{
|
||||
int meleeRanged;
|
||||
if(sf->additionalInfo.size() < 2)
|
||||
{
|
||||
// legacy format
|
||||
vstd::amax(spellLevel, sf->additionalInfo[0] % 1000);
|
||||
meleeRanged = sf->additionalInfo[0] / 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
vstd::amax(spellLevel, sf->additionalInfo[0]);
|
||||
meleeRanged = sf->additionalInfo[1];
|
||||
}
|
||||
if (meleeRanged == 0 || (meleeRanged == 1 && ranged) || (meleeRanged == 2 && !ranged))
|
||||
vstd::amax(spellLevel, sf->additionalInfo[0]);
|
||||
meleeRanged = sf->additionalInfo[1];
|
||||
|
||||
if (meleeRanged == CAddInfo::NONE || meleeRanged == 0 || (meleeRanged == 1 && ranged) || (meleeRanged == 2 && !ranged))
|
||||
castMe = true;
|
||||
}
|
||||
int chance = attacker->valOfBonuses((Selector::typeSubtype(attackMode, BonusSubtypeID(spellID))));
|
||||
|
Loading…
Reference in New Issue
Block a user