From 3c5a0fd4ce180d227da0d86f4a63235c0749fbaa Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Tue, 12 Apr 2011 08:59:18 +0000 Subject: [PATCH] Creatures now use SHOTS Bonus to express their total ammo count. Support for "additional shots" exp premy. --- client/CCreatureWindow.cpp | 6 ++++-- client/GUIClasses.cpp | 6 ++++-- lib/BattleState.cpp | 2 +- lib/CCreatureHandler.cpp | 3 +++ lib/HeroBonus.h | 3 ++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/client/CCreatureWindow.cpp b/client/CCreatureWindow.cpp index ac73d49fc..a7fe5dea9 100644 --- a/client/CCreatureWindow.cpp +++ b/client/CCreatureWindow.cpp @@ -315,8 +315,10 @@ void CCreatureWindow::showAll(SDL_Surface * to) printLine(0, CGI->generaltexth->primarySkillNames[0], c->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK), stackNode->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK)); printLine(1, CGI->generaltexth->primarySkillNames[1], c->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE), stackNode->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE)); - if(c->shots) - printLine(2, CGI->generaltexth->allTexts[198], c->shots); + //if(c->shots) + // printLine(2, CGI->generaltexth->allTexts[198], c->shots); + if(stackNode->valOfBonuses(Bonus::SHOTS)) + printLine(2, CGI->generaltexth->allTexts[198], stackNode->valOfBonuses(Bonus::SHOTS)); //TODO int dmgMultiply = 1; diff --git a/client/GUIClasses.cpp b/client/GUIClasses.cpp index 7830b9f29..f9571eef1 100644 --- a/client/GUIClasses.cpp +++ b/client/GUIClasses.cpp @@ -2167,8 +2167,10 @@ void CCreInfoWindow::init(const CCreature *cre, const CBonusSystemNode *stackNod printLine(0, CGI->generaltexth->primarySkillNames[0], cre->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK), stackNode->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK)); printLine(1, CGI->generaltexth->primarySkillNames[1], cre->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE), stackNode->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE)); - if(c->shots) - printLine(2, CGI->generaltexth->allTexts[198], c->shots); + //if(c->shots) + // printLine(2, CGI->generaltexth->allTexts[198], c->shots); + if(stackNode->valOfBonuses(Bonus::SHOTS)) + printLine(2, CGI->generaltexth->allTexts[198], stackNode->valOfBonuses(Bonus::SHOTS)); //TODO int dmgMultiply = 1; diff --git a/lib/BattleState.cpp b/lib/BattleState.cpp index 4ebcf8ae2..d836cda74 100644 --- a/lib/BattleState.cpp +++ b/lib/BattleState.cpp @@ -1962,7 +1962,7 @@ void CStack::postInit() assert(parents.size()); firstHPleft = valOfBonuses(Bonus::STACK_HEALTH); - shots = getCreature()->shots; + shots = getCreature()->valOfBonuses(Bonus::SHOTS); counterAttacks = 1 + valOfBonuses(Bonus::ADDITIONAL_RETALIATION); state.insert(ALIVE); //alive state indication diff --git a/lib/CCreatureHandler.cpp b/lib/CCreatureHandler.cpp index a37e4639e..c292213b4 100644 --- a/lib/CCreatureHandler.cpp +++ b/lib/CCreatureHandler.cpp @@ -285,6 +285,7 @@ void CCreatureHandler::loadCreatures() ncre.addBonus(ncre.damageMax, Bonus::CREATURE_DAMAGE, 2); ncre.shots = readNumber(befi, i, andame, buf); + ncre.addBonus(ncre.shots, Bonus::SHOTS); ncre.spells = readNumber(befi, i, andame, buf); ncre.ammMin = readNumber(befi, i, andame, buf); ncre.ammMax = readNumber(befi, i, andame, buf); @@ -831,6 +832,8 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, std::string & src break; case 'S': b.type = Bonus::STACKS_SPEED; break; + case 'O': + b.type = Bonus::SHOTS; break; case 'b': b.type = Bonus::ENEMY_DEFENCE_REDUCTION; break; diff --git a/lib/HeroBonus.h b/lib/HeroBonus.h index f094c5701..076966bbf 100644 --- a/lib/HeroBonus.h +++ b/lib/HeroBonus.h @@ -155,7 +155,8 @@ namespace PrimarySkill BONUS_NAME(SPECIAL_UPGRADE) /*val = base, additionalInfo = target */\ BONUS_NAME(DRAGON_NATURE) \ BONUS_NAME(CREATURE_DAMAGE)/*subtype 0 = both, 1 = min, 2 = max*/\ - BONUS_NAME(EXP_MULTIPLIER)/* val - percent of additional exp gained by stack/commander (base value 100)*/ + BONUS_NAME(EXP_MULTIPLIER)/* val - percent of additional exp gained by stack/commander (base value 100)*/\ + BONUS_NAME(SHOTS) /// Struct for handling bonuses of several types. Can be transfered to any hero struct DLL_EXPORT Bonus