mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Stack experience more or less handled. Neutrals get 10K xp every day.
This commit is contained in:
@@ -441,7 +441,7 @@ int CStackInstance::getQuantityID() const
|
||||
int CStackInstance::getExpRank() const
|
||||
{
|
||||
int tier = type->level;
|
||||
if (isbetw(tier, 1, 7))
|
||||
if (iswith(tier, 1, 7))
|
||||
{
|
||||
for (int i = VLC->creh->expRanks[tier].size()-2; i >-1; --i)//sic!
|
||||
{ //exp values vary from 1st level to max exp at 11th level
|
||||
|
@@ -2962,6 +2962,8 @@ void CGCreature::newTurn() const
|
||||
cb->setObjProperty(id, 10, std::min (power/1000 , (ui32)CREEP_SIZE)); //set new amount
|
||||
cb->setObjProperty(id, 11, power); //increase temppower
|
||||
}
|
||||
if (STACK_EXP)
|
||||
cb->setObjProperty(id, 12, 10000); //for testing purpose
|
||||
}
|
||||
void CGCreature::setPropertyDer(ui8 what, ui32 val)
|
||||
{
|
||||
@@ -2973,6 +2975,9 @@ void CGCreature::setPropertyDer(ui8 what, ui32 val)
|
||||
case 11:
|
||||
temppower = val;
|
||||
break;
|
||||
case 12:
|
||||
giveStackExp(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1184,8 +1184,6 @@ struct BattleResult : public CPackForClient//3003
|
||||
expType exp[2]; //exp for attacker and defender
|
||||
std::set<ui32> artifacts; //artifacts taken from loser to winner
|
||||
|
||||
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & result & winner & casualties[0] & casualties[1] & exp & artifacts;
|
||||
|
@@ -910,6 +910,14 @@ void BattleResult::applyGs( CGameState *gs )
|
||||
if(h)
|
||||
h->bonuses.remove_if(Bonus::OneBattle);
|
||||
|
||||
if (STACK_EXP)
|
||||
{
|
||||
if (exp[0]) //checking local array is easier than dereferencing this crap twice
|
||||
gs->curB->belligerents[0]->giveStackExp(exp[0]);
|
||||
if (exp[1])
|
||||
gs->curB->belligerents[1]->giveStackExp(exp[1]);
|
||||
}
|
||||
|
||||
gs->curB->belligerents[0]->battle = gs->curB->belligerents[1]->battle = NULL;
|
||||
gs->curB.dellNull();
|
||||
}
|
||||
|
Reference in New Issue
Block a user