1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Fixed #421 & #480. Some work on animations & sounds. Minor changes.

TODO: Interface should check game state before it's changed by triggered abilities of creatures.
This commit is contained in:
DjWarmonger 2011-05-15 06:37:57 +00:00
parent c6498d0af2
commit d4c2e55a00
5 changed files with 40 additions and 8 deletions

View File

@ -2326,21 +2326,48 @@ void CBattleInterface::stackRemoved(const CStack * stack)
creDir.erase(stackID);
}
void CBattleInterface::stackActivated(const CStack * stack)
void CBattleInterface::stackActivated(const CStack * stack) //TODO: check it all before game state is changed due to abilities
{
//don't show animation when no HP is regenerated
if (stack->firstHPleft != stack->MaxHealth())
{
if( stack->hasBonusOfType(Bonus::HP_REGENERATION) || stack->hasBonusOfType(Bonus::FULL_HP_REGENERATION, 1))
{
displayEffect(74, stack->position);
CCS->soundh->playSound(soundBase::REGENER);
}
if( stack->hasBonusOfType(Bonus::FULL_HP_REGENERATION, 0))
displayEffect(4, stack->position);
{
displayEffect(74, stack->position);
CCS->soundh->playSound(soundBase::REGENER);
}
}
if(stack->hasBonusOfType(Bonus::MANA_DRAIN))
displayEffect(77, stack->position);
{
CGHeroInstance * enemy = NULL; //probably could be smarter and not duplicated
if (defendingHero)
if (defendingHero->myHero->tempOwner != stack->owner)
enemy = const_cast<CGHeroInstance *>(defendingHero->myHero);
if (attackingHero)
if (attackingHero->myHero->tempOwner != stack->owner)
enemy = const_cast<CGHeroInstance *>(attackingHero->myHero);
if (enemy)
{
ui32 manaDrained = stack->valOfBonuses(Bonus::MANA_DRAIN);
amin (manaDrained, enemy->mana);
if (manaDrained)
{
displayEffect(77, stack->position);
CCS->soundh->playSound(soundBase::MANADRAI);
}
}
}
if(stack->hasBonusOfType(Bonus::POISON))
displayEffect(67, stack->position);
{
displayEffect(67, stack->position);
CCS->soundh->playSound(soundBase::POISON);
}
//givenCommand = NULL;
stackToActivate = stack;
@ -3590,7 +3617,8 @@ void CBattleInterface::startAction(const BattleAction* action)
switch (action->actionType)
{
case BattleAction::STACK_HEAL:
displayEffect(50, action->destinationTile);
displayEffect(74, action->destinationTile);
CCS->soundh->playSound(soundBase::REGENER);
break;
}
}

View File

@ -848,10 +848,13 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, std::string & src
b.type = Bonus::SPELL_DAMAGE_REDUCTION;
b.subtype = -1; //all magic schools
break;
case 'P':
b.type = Bonus::CASTS; break;
case 'R':
b.type = Bonus::ADDITIONAL_RETALIATION; break;
case 'W':
b.type = Bonus::MAGIC_RESISTANCE;
b.subtype = 0; //otherwise creature window goes crazy
break;
case 'f': //on-off skill

View File

@ -1375,7 +1375,7 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
void CGHeroInstance::showNecromancyDialog(const CStackBasicDescriptor &raisedStack) const
{
InfoWindow iw;
iw.soundID = soundBase::GENIE;
iw.soundID = soundBase::treasure; //should be random from among resource sounds
iw.player = tempOwner;
iw.components.push_back(Component(raisedStack));

View File

@ -165,7 +165,8 @@ namespace PrimarySkill
BONUS_NAME(BIND_EFFECT) /*doesn't do anything particular, works as a marker)*/\
BONUS_NAME(ACID_BREATH) /*additional val damage per creature after attack, additional info - chance in percent*/\
BONUS_NAME(RECEPTIVE) /*accepts friendly spells even with immunity*/\
BONUS_NAME(DIRECT_DAMAGE_IMMUNITY) /*direct damage spells, that is*/
BONUS_NAME(DIRECT_DAMAGE_IMMUNITY) /*direct damage spells, that is*/\
BONUS_NAME(CASTS) /*how many times creature can cast activated spell*/
/// Struct for handling bonuses of several types. Can be transfered to any hero
struct DLL_EXPORT Bonus

View File

@ -3208,7 +3208,7 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
complain("There is either no healer, no destination, or healer cannot heal :P");
}
int maxHealable = destStack->MaxHealth() - destStack->firstHPleft;
int maxiumHeal = std::max(10, attackingHero->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, 27));
int maxiumHeal = healer->count * std::max(10, attackingHero->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, 27));
int healed = std::min(maxHealable, maxiumHeal);