mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Format code
This commit is contained in:
parent
516d938f7a
commit
76ac9991ed
@ -1010,7 +1010,7 @@ const CGHeroInstance * CStack::getMyHero() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui32 CStack::totalHelth() const
|
ui32 CStack::totalHealth() const
|
||||||
{
|
{
|
||||||
return (MaxHealth() * (count-1)) + firstHPleft;
|
return (MaxHealth() * (count-1)) + firstHPleft;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ public:
|
|||||||
static void stackEffectToFeature(std::vector<Bonus> & sf, const Bonus & sse);
|
static void stackEffectToFeature(std::vector<Bonus> & sf, const Bonus & sse);
|
||||||
std::vector<si32> activeSpells() const; //returns vector of active spell IDs sorted by time of cast
|
std::vector<si32> activeSpells() const; //returns vector of active spell IDs sorted by time of cast
|
||||||
const CGHeroInstance *getMyHero() const; //if stack belongs to hero (directly or was by him summoned) returns hero, nullptr otherwise
|
const CGHeroInstance *getMyHero() const; //if stack belongs to hero (directly or was by him summoned) returns hero, nullptr otherwise
|
||||||
ui32 totalHelth() const; // total health for all creatures in stack;
|
ui32 totalHealth() const; // total health for all creatures in stack;
|
||||||
|
|
||||||
static bool isMeleeAttackPossible(const CStack * attacker, const CStack * defender, BattleHex attackerPos = BattleHex::INVALID, BattleHex defenderPos = BattleHex::INVALID);
|
static bool isMeleeAttackPossible(const CStack * attacker, const CStack * defender, BattleHex attackerPos = BattleHex::INVALID, BattleHex defenderPos = BattleHex::INVALID);
|
||||||
|
|
||||||
|
@ -904,16 +904,16 @@ void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, cons
|
|||||||
if (!bat.shot() && !vstd::contains(def->state, EBattleStackState::CLONED) &&
|
if (!bat.shot() && !vstd::contains(def->state, EBattleStackState::CLONED) &&
|
||||||
def->hasBonusOfType(Bonus::FIRE_SHIELD) && !att->hasBonusOfType(Bonus::FIRE_IMMUNITY))
|
def->hasBonusOfType(Bonus::FIRE_SHIELD) && !att->hasBonusOfType(Bonus::FIRE_IMMUNITY))
|
||||||
{
|
{
|
||||||
// TODO: Fire sheild damage should be calculated separately after BattleAttack applied.
|
// TODO: Fire shield damage should be calculated separately after BattleAttack applied.
|
||||||
// Currently it's looks like attacking stack damage itself with defenders fire shield.
|
// Currently it looks like attacking stack damage itself with defenders fire shield.
|
||||||
// So no separate message on spell damge in log and expirience calculation is likely wrong too.
|
// So no separate message on spell damage in log and experience calculation is likely wrong too.
|
||||||
BattleStackAttacked bsa2;
|
BattleStackAttacked bsa2;
|
||||||
bsa2.stackAttacked = att->ID; //invert
|
bsa2.stackAttacked = att->ID; //invert
|
||||||
bsa2.attackerID = def->ID;
|
bsa2.attackerID = def->ID;
|
||||||
bsa2.flags |= BattleStackAttacked::EFFECT; //FIXME: play animation upon efreet and not attacker
|
bsa2.flags |= BattleStackAttacked::EFFECT; //FIXME: play animation upon efreet and not attacker
|
||||||
bsa2.effect = 11;
|
bsa2.effect = 11;
|
||||||
|
|
||||||
bsa2.damageAmount = (std::min(def->totalHelth(), bsa.damageAmount) * def->valOfBonuses(Bonus::FIRE_SHIELD)) / 100; //TODO: scale with attack/defense
|
bsa2.damageAmount = (std::min(def->totalHealth(), bsa.damageAmount) * def->valOfBonuses(Bonus::FIRE_SHIELD)) / 100; //TODO: scale with attack/defense
|
||||||
att->prepareAttacked(bsa2, getRandomGenerator());
|
att->prepareAttacked(bsa2, getRandomGenerator());
|
||||||
bat.bsa.push_back(bsa2);
|
bat.bsa.push_back(bsa2);
|
||||||
}
|
}
|
||||||
@ -1952,9 +1952,8 @@ void CGameHandler::setAmount(ObjectInstanceID objid, ui32 val)
|
|||||||
bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, bool transit, PlayerColor asker /*= 255*/)
|
bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, bool transit, PlayerColor asker /*= 255*/)
|
||||||
{
|
{
|
||||||
const CGHeroInstance *h = getHero(hid);
|
const CGHeroInstance *h = getHero(hid);
|
||||||
|
// not turn of that hero or player can't simply teleport hero (at least not with this function)
|
||||||
if(!h || (asker != PlayerColor::NEUTRAL && (teleporting || h->getOwner() != gs->currentPlayer)) //not turn of that hero or player can't simply teleport hero (at least not with this function)
|
if (!h || (asker != PlayerColor::NEUTRAL && (teleporting || h->getOwner() != gs->currentPlayer)))
|
||||||
)
|
|
||||||
{
|
{
|
||||||
logGlobal->error("Illegal call to move hero!");
|
logGlobal->error("Illegal call to move hero!");
|
||||||
return false;
|
return false;
|
||||||
@ -5170,8 +5169,11 @@ void CGameHandler::attackCasting(const BattleAttack & bat, Bonus::BonusType atta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool castMe = false;
|
bool castMe = false;
|
||||||
if(oneOfAttacked == nullptr) //all attacked creatures have been killed
|
if (oneOfAttacked == nullptr)
|
||||||
|
{
|
||||||
|
logGlobal->debug("attackCasting: all attacked creatures have been killed");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int spellLevel = 0;
|
int spellLevel = 0;
|
||||||
TBonusListPtr spellsByType = attacker->getBonuses(Selector::typeSubtype(attackMode, spellID));
|
TBonusListPtr spellsByType = attacker->getBonuses(Selector::typeSubtype(attackMode, spellID));
|
||||||
for (const std::shared_ptr<Bonus> sf : *spellsByType)
|
for (const std::shared_ptr<Bonus> sf : *spellsByType)
|
||||||
@ -5195,12 +5197,12 @@ void CGameHandler::attackCasting(const BattleAttack & bat, Bonus::BonusType atta
|
|||||||
//casting
|
//casting
|
||||||
if (castMe) //stacks use 0 spell power. If needed, default = 3 or custom value is used
|
if (castMe) //stacks use 0 spell power. If needed, default = 3 or custom value is used
|
||||||
{
|
{
|
||||||
|
logGlobal->debug("battle spell cast");
|
||||||
BattleSpellCastParameters parameters(gs->curB, attacker, spell);
|
BattleSpellCastParameters parameters(gs->curB, attacker, spell);
|
||||||
parameters.spellLvl = spellLevel;
|
parameters.spellLvl = spellLevel;
|
||||||
parameters.effectLevel = spellLevel;
|
parameters.effectLevel = spellLevel;
|
||||||
parameters.aimToStack(oneOfAttacked);
|
parameters.aimToStack(oneOfAttacked);
|
||||||
parameters.mode = ECastingMode::AFTER_ATTACK_CASTING;
|
parameters.mode = ECastingMode::AFTER_ATTACK_CASTING;
|
||||||
|
|
||||||
parameters.cast(spellEnv);
|
parameters.cast(spellEnv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user