mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
* added spells: shield, air shield, bless, curse, bloodlust, weakness, stone skin, prayer
This commit is contained in:
parent
00899402cc
commit
05e25ed3ea
@ -1135,6 +1135,7 @@ void CBattleInterface::newRound(int number)
|
||||
void CBattleInterface::giveCommand(ui8 action, ui16 tile, ui32 stack, si32 additional)
|
||||
{
|
||||
BattleAction * ba = new BattleAction(); //is deleted in CPlayerInterface::activeStack()
|
||||
ba->side = defendingHeroInstance ? (LOCPLINT->playerID == defendingHeroInstance->tempOwner) : false;
|
||||
ba->actionType = action;
|
||||
ba->destinationTile = tile;
|
||||
ba->stackNumber = stack;
|
||||
@ -1395,6 +1396,46 @@ void CBattleInterface::spellCasted(SpellCasted * sc)
|
||||
displayEffect(10, sc->tile);
|
||||
break;
|
||||
}
|
||||
case 27: //shield
|
||||
{
|
||||
displayEffect(27, sc->tile);
|
||||
break;
|
||||
}
|
||||
case 28: //air shield
|
||||
{
|
||||
displayEffect(2, sc->tile);
|
||||
break;
|
||||
}
|
||||
case 41: //bless
|
||||
{
|
||||
displayEffect(36, sc->tile);
|
||||
break;
|
||||
}
|
||||
case 42: //curse
|
||||
{
|
||||
displayEffect(40, sc->tile);
|
||||
break;
|
||||
}
|
||||
case 43: //bloodlust
|
||||
{
|
||||
displayEffect(4, sc->tile); //TODO: give better animation for this spell
|
||||
break;
|
||||
}
|
||||
case 45: //weakness
|
||||
{
|
||||
displayEffect(56, sc->tile); //TODO: give better animation for this spell
|
||||
break;
|
||||
}
|
||||
case 46: //stone skin
|
||||
{
|
||||
displayEffect(54, sc->tile);
|
||||
break;
|
||||
}
|
||||
case 48: //prayer
|
||||
{
|
||||
displayEffect(0, sc->tile);
|
||||
break;
|
||||
}
|
||||
case 53: //haste
|
||||
{
|
||||
displayEffect(31, sc->tile);
|
||||
@ -1453,7 +1494,7 @@ void CBattleInterface::displayEffect(ui32 effect, int destTile)
|
||||
be.x = 22 * ( ((destTile/BFIELD_WIDTH) + 1)%2 ) + 44 * (destTile % BFIELD_WIDTH) + 45;
|
||||
be.y = 105 + 42 * (destTile/BFIELD_WIDTH);
|
||||
|
||||
if(effect != 1)
|
||||
if(effect != 1 && effect != 0)
|
||||
{
|
||||
be.x -= be.anim->ourImages[0].bitmap->w/2;
|
||||
be.y -= be.anim->ourImages[0].bitmap->h/2;
|
||||
@ -1463,6 +1504,11 @@ void CBattleInterface::displayEffect(ui32 effect, int destTile)
|
||||
be.x -= be.anim->ourImages[0].bitmap->w;
|
||||
be.y -= be.anim->ourImages[0].bitmap->h;
|
||||
}
|
||||
else if (effect == 0)
|
||||
{
|
||||
be.x -= be.anim->ourImages[0].bitmap->w/2;
|
||||
be.y -= be.anim->ourImages[0].bitmap->h;
|
||||
}
|
||||
|
||||
battleEffects.push_back(be);
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ ui32 CStack::speed() const
|
||||
//prayer effect check
|
||||
effect = getEffect(48);
|
||||
if(effect)
|
||||
premy -= VLC->spellh->spells[effect->id].powers[effect->level];
|
||||
premy += VLC->spellh->spells[effect->id].powers[effect->level];
|
||||
//bind effect check
|
||||
effect = getEffect(72);
|
||||
if(effect)
|
||||
@ -1499,8 +1499,59 @@ void CGameState::loadTownDInfos()
|
||||
int BattleInfo::calculateDmg(const CStack* attacker, const CStack* defender, const CGHeroInstance * attackerHero, const CGHeroInstance * defendingHero, bool shooting)
|
||||
{
|
||||
int attackDefenseBonus = attacker->creature->attack + (attackerHero ? attackerHero->getPrimSkillLevel(0) : 0) - (defender->creature->defence + (defendingHero ? defendingHero->getPrimSkillLevel(1) : 0));
|
||||
if(defender->getEffect(48)) //defender's prayer handling
|
||||
{
|
||||
if(defender->getEffect(48)->level<=1) //none or basic
|
||||
attackDefenseBonus -= 2;
|
||||
else //adv or expert
|
||||
attackDefenseBonus -= 4;
|
||||
}
|
||||
if(attacker->getEffect(48)) //attacker's prayer handling
|
||||
{
|
||||
if(attacker->getEffect(48)->level<=1) //none or basic
|
||||
attackDefenseBonus += 2;
|
||||
else //adv or expert
|
||||
attackDefenseBonus += 4;
|
||||
}
|
||||
if(defender->getEffect(46)) //stone skin handling
|
||||
{
|
||||
if(defender->getEffect(46)->level<=1) //none or basic
|
||||
attackDefenseBonus -= 3;
|
||||
else //adv or expert
|
||||
attackDefenseBonus -= 6;
|
||||
}
|
||||
if(attacker->getEffect(45)) //weakness handling
|
||||
{
|
||||
if(attacker->getEffect(45)->level<=1) //none or basic
|
||||
attackDefenseBonus -= 3;
|
||||
else //adv or expert
|
||||
attackDefenseBonus -= 6;
|
||||
}
|
||||
if(!shooting && attacker->getEffect(43)) //bloodlust handling
|
||||
{
|
||||
if(attacker->getEffect(43)->level<=1) //none or basic
|
||||
attackDefenseBonus += 3;
|
||||
else //adv or expert
|
||||
attackDefenseBonus += 6;
|
||||
}
|
||||
int damageBase = 0;
|
||||
if(attacker->creature->damageMax == attacker->creature->damageMin) //constant damage
|
||||
if(attacker->getEffect(42)) //curse handling (partial, the rest is below)
|
||||
{
|
||||
damageBase = attacker->creature->damageMin;
|
||||
if(attacker->getEffect(42)->level >= 2) //adv or expert
|
||||
{
|
||||
damageBase -= 1;
|
||||
}
|
||||
}
|
||||
else if(attacker->getEffect(41)) //bless handling
|
||||
{
|
||||
damageBase = attacker->creature->damageMax;
|
||||
if(attacker->getEffect(41)->level >= 2) //adv or expert
|
||||
{
|
||||
damageBase += 1;
|
||||
}
|
||||
}
|
||||
else if(attacker->creature->damageMax == attacker->creature->damageMin) //constant damage
|
||||
{
|
||||
damageBase = attacker->creature->damageMin;
|
||||
}
|
||||
@ -1581,6 +1632,26 @@ int BattleInfo::calculateDmg(const CStack* attacker, const CStack* defender, con
|
||||
break;
|
||||
}
|
||||
}
|
||||
//handling spell effects
|
||||
if(!shooting && defender->getEffect(27)) //shield
|
||||
{
|
||||
if(defender->getEffect(27)->level<=1) //none or basic
|
||||
dmgBonusMultiplier *= 0.85f;
|
||||
else //adv or expert
|
||||
dmgBonusMultiplier *= 0.7f;
|
||||
}
|
||||
if(shooting && defender->getEffect(28)) //air shield
|
||||
{
|
||||
if(defender->getEffect(28)->level<=1) //none or basic
|
||||
dmgBonusMultiplier *= 0.75f;
|
||||
else //adv or expert
|
||||
dmgBonusMultiplier *= 0.5f;
|
||||
}
|
||||
if(attacker->getEffect(42)) //curse, second part of handling
|
||||
{
|
||||
if(attacker->getEffect(42)->level>=2) //adv or expert
|
||||
dmgBonusMultiplier *= 0.8f;
|
||||
}
|
||||
|
||||
return (float)damageBase * (float)attacker->amount * dmgBonusMultiplier;
|
||||
}
|
||||
|
@ -1300,6 +1300,86 @@ upgend:
|
||||
sendAndApply(&bsa);
|
||||
break;
|
||||
}
|
||||
case 27: //shield
|
||||
{
|
||||
SetStackEffect sse;
|
||||
sse.stack = gs->curB->getStackT(ba.destinationTile)->ID;
|
||||
sse.effect.id = 27;
|
||||
sse.effect.level = getSchoolLevel(h,s);
|
||||
sse.effect.turnsRemain = h->getPrimSkillLevel(2);
|
||||
sendAndApply(&sse);
|
||||
break;
|
||||
}
|
||||
case 28: //air shield
|
||||
{
|
||||
SetStackEffect sse;
|
||||
sse.stack = gs->curB->getStackT(ba.destinationTile)->ID;
|
||||
sse.effect.id = 28;
|
||||
sse.effect.level = getSchoolLevel(h,s);
|
||||
sse.effect.turnsRemain = h->getPrimSkillLevel(2);
|
||||
sendAndApply(&sse);
|
||||
break;
|
||||
}
|
||||
case 41: //bless
|
||||
{
|
||||
SetStackEffect sse;
|
||||
sse.stack = gs->curB->getStackT(ba.destinationTile)->ID;
|
||||
sse.effect.id = 41;
|
||||
sse.effect.level = getSchoolLevel(h,s);
|
||||
sse.effect.turnsRemain = h->getPrimSkillLevel(2);
|
||||
sendAndApply(&sse);
|
||||
break;
|
||||
}
|
||||
case 42: //curse
|
||||
{
|
||||
SetStackEffect sse;
|
||||
sse.stack = gs->curB->getStackT(ba.destinationTile)->ID;
|
||||
sse.effect.id = 42;
|
||||
sse.effect.level = getSchoolLevel(h,s);
|
||||
sse.effect.turnsRemain = h->getPrimSkillLevel(2);
|
||||
sendAndApply(&sse);
|
||||
break;
|
||||
}
|
||||
case 43: //bloodlust
|
||||
{
|
||||
SetStackEffect sse;
|
||||
sse.stack = gs->curB->getStackT(ba.destinationTile)->ID;
|
||||
sse.effect.id = 43;
|
||||
sse.effect.level = getSchoolLevel(h,s);
|
||||
sse.effect.turnsRemain = h->getPrimSkillLevel(2);
|
||||
sendAndApply(&sse);
|
||||
break;
|
||||
}
|
||||
case 45: //weakness
|
||||
{
|
||||
SetStackEffect sse;
|
||||
sse.stack = gs->curB->getStackT(ba.destinationTile)->ID;
|
||||
sse.effect.id = 45;
|
||||
sse.effect.level = getSchoolLevel(h,s);
|
||||
sse.effect.turnsRemain = h->getPrimSkillLevel(2);
|
||||
sendAndApply(&sse);
|
||||
break;
|
||||
}
|
||||
case 46: //stone skin
|
||||
{
|
||||
SetStackEffect sse;
|
||||
sse.stack = gs->curB->getStackT(ba.destinationTile)->ID;
|
||||
sse.effect.id = 46;
|
||||
sse.effect.level = getSchoolLevel(h,s);
|
||||
sse.effect.turnsRemain = h->getPrimSkillLevel(2);
|
||||
sendAndApply(&sse);
|
||||
break;
|
||||
}
|
||||
case 48: //prayer
|
||||
{
|
||||
SetStackEffect sse;
|
||||
sse.stack = gs->curB->getStackT(ba.destinationTile)->ID;
|
||||
sse.effect.id = 48;
|
||||
sse.effect.level = getSchoolLevel(h,s);
|
||||
sse.effect.turnsRemain = h->getPrimSkillLevel(2);
|
||||
sendAndApply(&sse);
|
||||
break;
|
||||
}
|
||||
case 53: //haste
|
||||
{
|
||||
SetStackEffect sse;
|
||||
|
Loading…
Reference in New Issue
Block a user