From 76f61fa09e9bae14dc0f41030b60969f41719fe9 Mon Sep 17 00:00:00 2001 From: mateuszb Date: Thu, 20 May 2010 11:06:40 +0000 Subject: [PATCH] * implemented hourglass of evil hour --- server/CGameHandler.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 9b82752fa..dcb20ec45 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -663,7 +663,16 @@ void CGameHandler::prepareAttack(BattleAttack &bat, const CStack *att, const CSt bsa->stackAttacked = def->ID; bsa->attackerID = att->ID; int attackerLuck = att->LuckVal(); - if(attackerLuck > 0 && rand()%24 < attackerLuck) //TODO?: negative luck option? + const CGHeroInstance * h0 = gs->curB->heroes[0], + * h1 = gs->curB->heroes[1]; + bool noLuck = false; + if(h0 && NBonus::hasOfType(h0, Bonus::BLOCK_LUCK) || + h1 && NBonus::hasOfType(h1, Bonus::BLOCK_LUCK)) + { + noLuck = true; + } + + if(!noLuck && attackerLuck > 0 && rand()%24 < attackerLuck) //TODO?: negative luck option? { bsa->damageAmount *= 2; bat.flags |= 4;