mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
* KING1 / KING2 / KING3 support
* ability 78 support
This commit is contained in:
parent
a96b21d06d
commit
c4ae0c4cf2
@ -2630,6 +2630,7 @@ void CBattleInterface::spellCast(SpellCast * sc)
|
||||
case 37: //cure
|
||||
case 38: //resurrection
|
||||
case 39: //animate dead
|
||||
case 78: //dispel helpful spells
|
||||
for(std::set<ui32>::const_iterator it = sc->affectedCres.begin(); it != sc->affectedCres.end(); ++it)
|
||||
{
|
||||
displayEffect(spell.mainEffectAnim, curInt->cb->battleGetStackByID(*it, false)->position);
|
||||
|
@ -78,7 +78,7 @@
|
||||
75 -1 -1 0 0 0 0
|
||||
76 -1 -1 0 0 0 0
|
||||
77 -1 38 0 0 0 0
|
||||
78 -1 -1 0 0 0 0
|
||||
78 -1 41 0 0 0 0
|
||||
79 -1 -1 0 0 0 0
|
||||
80 -1 -1 0 0 0 0
|
||||
-1
|
@ -2410,45 +2410,22 @@ std::pair<ui32, ui32> BattleInfo::calculateDmgRange(const CStack* attacker, cons
|
||||
if(attacker->getEffect(55)) //slayer handling
|
||||
{
|
||||
std::vector<int> affectedIds;
|
||||
switch(attacker->getEffect(55)->level)
|
||||
int spLevel = attacker->getEffect(55)->level;
|
||||
|
||||
for(int g = 0; g < VLC->creh->creatures.size(); ++g)
|
||||
{
|
||||
case 3: //expert
|
||||
for (int d=0; d<VLC->creh->creatures[g].abilities.size(); ++d)
|
||||
{
|
||||
affectedIds.push_back(40); //giant
|
||||
affectedIds.push_back(41); //titan
|
||||
affectedIds.push_back(152); //lord of thunder
|
||||
} //continue adding ...
|
||||
case 2: //advanced
|
||||
{
|
||||
affectedIds.push_back(12); //angel
|
||||
affectedIds.push_back(13); //archangel
|
||||
affectedIds.push_back(54); //devil
|
||||
affectedIds.push_back(55); //arch devil
|
||||
affectedIds.push_back(150); //supreme archangel
|
||||
affectedIds.push_back(153); //antichrist
|
||||
} //continue adding ...
|
||||
case 0: case 1: //none and basic
|
||||
{
|
||||
affectedIds.push_back(26); //green dragon
|
||||
affectedIds.push_back(27); //gold dragon
|
||||
affectedIds.push_back(82); //red dragon
|
||||
affectedIds.push_back(83); //black dragon
|
||||
affectedIds.push_back(96); //behemot
|
||||
affectedIds.push_back(97); //ancient behemot
|
||||
affectedIds.push_back(110); //hydra
|
||||
affectedIds.push_back(111); //chaos hydra
|
||||
affectedIds.push_back(132); //azure dragon
|
||||
affectedIds.push_back(133); //crystal dragon
|
||||
affectedIds.push_back(134); //faerie dragon
|
||||
affectedIds.push_back(135); //rust dragon
|
||||
affectedIds.push_back(151); //diamond dragon
|
||||
affectedIds.push_back(154); //blood dragon
|
||||
affectedIds.push_back(155); //darkness dragon
|
||||
affectedIds.push_back(156); //ghost behemoth
|
||||
affectedIds.push_back(157); //hell hydra
|
||||
break;
|
||||
if ( (VLC->creh->creatures[g].abilities[d].type == StackFeature::KING3 && spLevel >= 3) || //expert
|
||||
(VLC->creh->creatures[g].abilities[d].type == StackFeature::KING2 && spLevel >= 2) || //adv +
|
||||
(VLC->creh->creatures[g].abilities[d].type == StackFeature::KING1 && spLevel >= 0) ) //none or basic +
|
||||
{
|
||||
affectedIds.push_back(g);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int g=0; g<affectedIds.size(); ++g)
|
||||
{
|
||||
if(defender->creature->idNumber == affectedIds[g])
|
||||
@ -2703,7 +2680,7 @@ std::set<CStack*> BattleInfo::getAttackedCreatures( const CSpell * s, int skillL
|
||||
int BattleInfo::calculateSpellDuration(const CSpell * spell, const CGHeroInstance * caster)
|
||||
{
|
||||
if(!caster) //TODO: something better
|
||||
return 1;
|
||||
return 5;
|
||||
switch(spell->id)
|
||||
{
|
||||
case 56: //frenzy
|
||||
|
@ -844,20 +844,32 @@ DLL_EXPORT void SpellCast::applyGs( CGameState *gs )
|
||||
}
|
||||
|
||||
|
||||
if(gs->curB && id == 35) //dispel
|
||||
if(gs->curB && (id == 35 || id == 78)) //dispel and dispel helpful spells
|
||||
{
|
||||
bool onlyHelpful = id == 78;
|
||||
for(std::set<ui32>::const_iterator it = affectedCres.begin(); it != affectedCres.end(); ++it)
|
||||
{
|
||||
CStack *s = gs->curB->getStack(*it);
|
||||
if(s && !vstd::contains(resisted, s->ID)) //if stack exists and it didn't resist
|
||||
{
|
||||
std::vector<CStack::StackEffect> remainingEff;
|
||||
for(int g=0; g< s->effects.size(); ++g)
|
||||
{
|
||||
if (onlyHelpful && VLC->spellh->spells[ s->effects[g].id ].positiveness != 1)
|
||||
{
|
||||
remainingEff.push_back(s->effects[g]);
|
||||
}
|
||||
|
||||
}
|
||||
s->effects.clear(); //removing all effects
|
||||
s->effects = remainingEff; //assigning effects that should remain
|
||||
|
||||
//removing all features from spells
|
||||
std::vector<StackFeature> tmpFeatures = s->features;
|
||||
s->features.clear();
|
||||
for(int i=0; i < tmpFeatures.size(); i++)
|
||||
{
|
||||
if(tmpFeatures[i].source != StackFeature::SPELL_EFFECT)
|
||||
if(tmpFeatures[i].source != StackFeature::SPELL_EFFECT || tmpFeatures[i].positiveness != 1)
|
||||
{
|
||||
s->features.push_back(tmpFeatures[i]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user