1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-07 00:58:39 +02:00

Partial support for Daemon Summoning.

It freezes for unknown reason, but still.

Minor fixes.
This commit is contained in:
DjWarmonger
2011-10-02 07:16:34 +00:00
parent 6fdb984799
commit 07b8f87fb7
5 changed files with 16 additions and 14 deletions

View File

@ -152,7 +152,8 @@
"ability_add": [ [ "SPECIFIC_SPELL_POWER", 100, 38, 0 ], // 100 hp per Archangel "ability_add": [ [ "SPECIFIC_SPELL_POWER", 100, 38, 0 ], // 100 hp per Archangel
[ "SPELLCASTER", 0, 38, 0 ], //archangels cast resurrection [ "SPELLCASTER", 0, 38, 0 ], //archangels cast resurrection
[ "HATE", 50, 55, 0 ], //archangels hate arch [ "HATE", 50, 55, 0 ], //archangels hate arch
[ "HATE", 50, 54, 0 ] ], //archangels hate devils [ "HATE", 50, 54, 0 ] , //archangels hate devils
[ "CASTS", 1, 0, 0]],
"defname": "CRANGL.DEF" "defname": "CRANGL.DEF"
}, },
@ -397,6 +398,7 @@
"faction": 2, "faction": 2,
"ability_add": [ [ "CREATURE_ENCHANT_POWER", 6, 0, 0 ], //spells last 6 turns "ability_add": [ [ "CREATURE_ENCHANT_POWER", 6, 0, 0 ], //spells last 6 turns
[ "RANDOM_SPELLCASTER", 0, 0, 0 ], //master genies cast spells [ "RANDOM_SPELLCASTER", 0, 0, 0 ], //master genies cast spells
[ "CASTS", 3, 0, 0],
[ "HATE", 50, 53, 0 ], [ "HATE", 50, 53, 0 ],
[ "HATE", 50, 52, 0 ] ], //master genies hate efreet sultans [ "HATE", 50, 52, 0 ] ], //master genies hate efreet sultans
"defname": "CSULTA.DEF" "defname": "CSULTA.DEF"
@ -544,7 +546,8 @@
"level": 5, "level": 5,
"name": [ "PitFoe" ], "name": [ "PitFoe" ],
"faction": 3, "faction": 3,
"ability_add": [ [ "DAEMON_SUMMONING", 0, 52, 0 ] ], //pit lord //Efreeti "ability_add": [ [ "DAEMON_SUMMONING", 50, 48, 0 ],
[ "CASTS", 1, 0, 0] ], //pit lord
"defname": "CPFOE.DEF" "defname": "CPFOE.DEF"
}, },

View File

@ -2192,13 +2192,11 @@ void CStack::postInit()
assert(type); assert(type);
assert(getParentNodes().size()); assert(getParentNodes().size());
firstHPleft = valOfBonuses(Bonus::STACK_HEALTH); firstHPleft = MaxHealth();
shots = getCreature()->valOfBonuses(Bonus::SHOTS); shots = getCreature()->valOfBonuses(Bonus::SHOTS);
counterAttacks = 1 + valOfBonuses(Bonus::ADDITIONAL_RETALIATION); counterAttacks = 1 + valOfBonuses(Bonus::ADDITIONAL_RETALIATION);
casts = valOfBonuses(Bonus::CASTS); //TODO: set them in cr_abils.txt casts = valOfBonuses(Bonus::CASTS); //TODO: set them in cr_abils.txt
state.insert(ALIVE); //alive state indication state.insert(ALIVE); //alive state indication
assert(firstHPleft > 0);
} }
ui32 CStack::Speed( int turn /*= 0*/ ) const ui32 CStack::Speed( int turn /*= 0*/ ) const

View File

@ -1238,7 +1238,7 @@ struct StacksHealedOrResurrected : public CPackForClient //3013
{ {
ui32 stackID; ui32 stackID;
ui32 healedHP; ui32 healedHP;
ui8 lowLevelResurrection; //in case this stack is resurrected by this heal, it will be marked as SUMMONED ui8 lowLevelResurrection; //in case this stack is resurrected by this heal, it will be marked as SUMMONED //TODO: replace with separate counter
template <typename Handler> void serialize(Handler &h, const int version) template <typename Handler> void serialize(Handler &h, const int version)
{ {
h & stackID & healedHP & lowLevelResurrection; h & stackID & healedHP & lowLevelResurrection;

View File

@ -1168,8 +1168,7 @@ DLL_EXPORT void StacksHealedOrResurrected::applyGs( CGameState *gs )
{ {
changedStack->state.insert(ALIVE); changedStack->state.insert(ALIVE);
if(healedStacks[g].lowLevelResurrection) if(healedStacks[g].lowLevelResurrection)
changedStack->state.insert(SUMMONED); changedStack->state.insert(SUMMONED); //TODO: different counter for rised units
//changedStack->addNewBonus( makeFeature(HeroBonus::SUMMONED, HeroBonus::ONE_BATTLE, 0, 0, HeroBonus::BONUS_FROM_HERO) );
} }
//int missingHPfirst = changedStack->MaxHealth() - changedStack->firstHPleft; //int missingHPfirst = changedStack->MaxHealth() - changedStack->firstHPleft;
int res = std::min( healedStacks[g].healedHP / changedStack->MaxHealth() , changedStack->baseAmount - changedStack->count ); int res = std::min( healedStacks[g].healedHP / changedStack->MaxHealth() , changedStack->baseAmount - changedStack->count );

View File

@ -3286,7 +3286,6 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
case BattleAction::DAEMON_SUMMONING: case BattleAction::DAEMON_SUMMONING:
//TODO: From Strategija: //TODO: From Strategija:
//Summon Demon is a level 2 spell. //Summon Demon is a level 2 spell.
//Cloned Pit Lord stack can use the specialty as well.
{ {
StartAction start_action(ba); StartAction start_action(ba);
sendAndApply(&start_action); sendAndApply(&start_action);
@ -3299,15 +3298,18 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
bsa.creID = summoner->getBonus(Selector::type(Bonus::DAEMON_SUMMONING))->subtype; //in case summoner can summon more than one type of monsters... scream! bsa.creID = summoner->getBonus(Selector::type(Bonus::DAEMON_SUMMONING))->subtype; //in case summoner can summon more than one type of monsters... scream!
ui64 risedHp = summoner->count * summoner->valOfBonuses(Bonus::DAEMON_SUMMONING, bsa.creID); ui64 risedHp = summoner->count * summoner->valOfBonuses(Bonus::DAEMON_SUMMONING, bsa.creID);
bsa.amount = std::min ((ui32)(risedHp/destStack->MaxHealth()), destStack->baseAmount); bsa.amount = std::min ((ui32)(risedHp / VLC->creh->creatures[bsa.creID]->MaxHealth()), destStack->baseAmount);
bsa.pos = gs->curB->getAvaliableHex(bsa.creID, bsa.attacker, destStack->position); bsa.pos = gs->curB->getAvaliableHex(bsa.creID, bsa.attacker, destStack->position);
bsa.summoned = false; bsa.summoned = false;
if (bsa.amount) //there's rare possibility single creature cannot rise desired type
{
BattleStacksRemoved bsr; //remove body BattleStacksRemoved bsr; //remove body
bsr.stackIDs.insert(destStack->ID); bsr.stackIDs.insert(destStack->ID);
sendAndApply(&bsr); sendAndApply(&bsr);
sendAndApply(&bsa); sendAndApply(&bsa);
}
sendAndApply(&end_action); sendAndApply(&end_action);
break; break;