mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
* [previous commit adds support for golden bow too]
* support for ammo cart * partially written support for orb of vulnerability
This commit is contained in:
@@ -770,8 +770,25 @@ DLL_EXPORT void BattleAttack::applyGs( CGameState *gs )
|
|||||||
CStack *attacker = gs->curB->getStack(stackAttacking);
|
CStack *attacker = gs->curB->getStack(stackAttacking);
|
||||||
if(counter())
|
if(counter())
|
||||||
attacker->counterAttacks--;
|
attacker->counterAttacks--;
|
||||||
|
|
||||||
if(shot())
|
if(shot())
|
||||||
|
{
|
||||||
|
//don't remove ammo if we have a working ammo cart
|
||||||
|
bool hasAmmoCart = false;
|
||||||
|
BOOST_FOREACH(const CStack * st, gs->curB->stacks)
|
||||||
|
{
|
||||||
|
if(st->owner == attacker->owner && st->type->idNumber == 148 && st->alive())
|
||||||
|
{
|
||||||
|
hasAmmoCart = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasAmmoCart)
|
||||||
|
{
|
||||||
attacker->shots--;
|
attacker->shots--;
|
||||||
|
}
|
||||||
|
}
|
||||||
BOOST_FOREACH(BattleStackAttacked stackAttacked, bsa)
|
BOOST_FOREACH(BattleStackAttacked stackAttacked, bsa)
|
||||||
stackAttacked.applyGs(gs);
|
stackAttacked.applyGs(gs);
|
||||||
|
|
||||||
|
@@ -3585,6 +3585,24 @@ static std::vector<ui32> calculateResistedStacks(const CSpell * sp, const CGHero
|
|||||||
{
|
{
|
||||||
std::vector<ui32> ret;
|
std::vector<ui32> ret;
|
||||||
for(std::set<CStack*>::const_iterator it = affectedCreatures.begin(); it != affectedCreatures.end(); ++it)
|
for(std::set<CStack*>::const_iterator it = affectedCreatures.begin(); it != affectedCreatures.end(); ++it)
|
||||||
|
{
|
||||||
|
if (caster->hasBonusOfType(Bonus::NEGATE_ALL_NATURAL_IMMUNITIES) ||
|
||||||
|
hero2->hasBonusOfType(Bonus::NEGATE_ALL_NATURAL_IMMUNITIES))
|
||||||
|
{
|
||||||
|
//Here we need "source different than" selector
|
||||||
|
// BonusList bl = (*it)->getBonuses(Selector::sourceNotType(Bonus::CREATURE_ABILITY));
|
||||||
|
//
|
||||||
|
// BOOST_FOREACH(Bonus bb, bl)
|
||||||
|
// {
|
||||||
|
// if(bb.type == Bonus::SPELL_IMMUNITY && bb.subtype == sp->id || //100% sure spell immunity
|
||||||
|
// bb.type == Bonus::LEVEL_SPELL_IMMUNITY && bb.val >= sp->level) //some creature abilities have level 0
|
||||||
|
// {
|
||||||
|
// ret.push_back((*it)->ID);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if ((*it)->hasBonusOfType(Bonus::SPELL_IMMUNITY, sp->id) //100% sure spell immunity
|
if ((*it)->hasBonusOfType(Bonus::SPELL_IMMUNITY, sp->id) //100% sure spell immunity
|
||||||
|| ( (*it)->hasBonusOfType(Bonus::LEVEL_SPELL_IMMUNITY) &&
|
|| ( (*it)->hasBonusOfType(Bonus::LEVEL_SPELL_IMMUNITY) &&
|
||||||
@@ -3593,6 +3611,8 @@ static std::vector<ui32> calculateResistedStacks(const CSpell * sp, const CGHero
|
|||||||
ret.push_back((*it)->ID);
|
ret.push_back((*it)->ID);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//non-negative spells on friendly stacks should always succeed, unless immune
|
//non-negative spells on friendly stacks should always succeed, unless immune
|
||||||
if(sp->positiveness >= 0 && (*it)->owner == caster->tempOwner)
|
if(sp->positiveness >= 0 && (*it)->owner == caster->tempOwner)
|
||||||
|
Reference in New Issue
Block a user