1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-13 11:40:38 +02:00

Some fixes for shooting vs Creature Window.

This commit is contained in:
DjWarmonger 2011-08-06 07:05:04 +00:00
parent d29850a2fa
commit e67b7b9da4
3 changed files with 13 additions and 12 deletions

View File

@ -22,6 +22,7 @@
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include "../lib/CGameState.h" #include "../lib/CGameState.h"
#include "../lib/BattleState.h"
#include "../lib/CSpellHandler.h" #include "../lib/CSpellHandler.h"
using namespace CSDL_Ext; using namespace CSDL_Ext;
@ -42,6 +43,7 @@ CCreatureWindow::CCreatureWindow (const CStack &stack, int Type)
: type(Type) : type(Type)
{ {
OBJ_CONSTRUCTION_CAPTURING_ALL; OBJ_CONSTRUCTION_CAPTURING_ALL;
battleStack = &stack;
if (stack.base) if (stack.base)
init(stack.base, &stack, dynamic_cast<const CGHeroInstance*>(stack.base->armyObj)); init(stack.base, &stack, dynamic_cast<const CGHeroInstance*>(stack.base->armyObj));
else else
@ -50,7 +52,6 @@ CCreatureWindow::CCreatureWindow (const CStack &stack, int Type)
init(s, stack.type, NULL); init(s, stack.type, NULL);
delete s; delete s;
} }
} }
CCreatureWindow::CCreatureWindow (const CStackInstance &stack, int Type) CCreatureWindow::CCreatureWindow (const CStackInstance &stack, int Type)
@ -329,19 +330,18 @@ void CCreatureWindow::showAll(SDL_Surface * to)
{ {
CIntObject::showAll(to); CIntObject::showAll(to);
//count = boost::lexical_cast<std::string>(stack->count);
//if (count.size()) //TODO
// printTo(count, 117, 174, FONT_SMALL, tytulowy,*bitmap);
if(count.size())
printTo(count.c_str(), pos.x+114, pos.y+174, FONT_TIMES, zwykly, to);
printAtMiddle(c->namePl, 180, 30, FONT_SMALL, tytulowy,*bitmap); //creature name printAtMiddle(c->namePl, 180, 30, FONT_SMALL, tytulowy,*bitmap); //creature name
printLine(0, CGI->generaltexth->primarySkillNames[0], c->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK), stackNode->Attack()); printLine(0, CGI->generaltexth->primarySkillNames[0], c->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK), stackNode->Attack());
printLine(1, CGI->generaltexth->primarySkillNames[1], c->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE), stackNode->Defense()); printLine(1, CGI->generaltexth->primarySkillNames[1], c->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE), stackNode->Defense());
if(stackNode->valOfBonuses(Bonus::SHOTS) && stackNode->hasBonusOfType(Bonus::SHOOTER)) //only for shooting units - important with wog exp shooters if(stackNode->valOfBonuses(Bonus::SHOTS) && stackNode->hasBonusOfType(Bonus::SHOOTER))
printLine(2, CGI->generaltexth->allTexts[198], stackNode->valOfBonuses(Bonus::SHOTS)); //TODO: change shot count for battle stack {//only for shooting units - important with wog exp shooters
if (type == BATTLE)
printLine(2, CGI->generaltexth->allTexts[198], battleStack->shots);
else
printLine(2, CGI->generaltexth->allTexts[198], stackNode->valOfBonuses(Bonus::SHOTS));
}
//TODO //TODO
int dmgMultiply = 1; int dmgMultiply = 1;

View File

@ -33,6 +33,7 @@ public:
const CStackInstance *stack; const CStackInstance *stack;
const CBonusSystemNode *stackNode; const CBonusSystemNode *stackNode;
const CGHeroInstance *heroOwner; const CGHeroInstance *heroOwner;
const CStack * battleStack; //determine the umber of shots in battle
std::vector<SComponent*> upgResCost; //cost of upgrade (if not possible then empty) std::vector<SComponent*> upgResCost; //cost of upgrade (if not possible then empty)
std::vector<CBonusItem*> bonusItems; std::vector<CBonusItem*> bonusItems;
std::vector<LRClickableAreaWText*> spellEffects; std::vector<LRClickableAreaWText*> spellEffects;

View File

@ -735,9 +735,9 @@ void CArtHandler::addBonuses()
giveArtBonus(136, Bonus::FREE_SHIP_BOARDING, 0); giveArtBonus(136, Bonus::FREE_SHIP_BOARDING, 0);
//Bow of the Sharpshooter //Bow of the Sharpshooter
giveArtBonus(137, Bonus::NO_DISTANCE_PENALTY, 0); giveArtBonus(137, Bonus::NO_DISTANCE_PENALTY, 0, 0, 0, new HasAnotherBonusLimiter(Bonus::SHOOTER));
giveArtBonus(137, Bonus::NO_OBSTACLES_PENALTY, 0); giveArtBonus(137, Bonus::NO_OBSTACLES_PENALTY, 0, 0, 0, new HasAnotherBonusLimiter(Bonus::SHOOTER));
giveArtBonus(137, Bonus::FREE_SHOOTING, 0); giveArtBonus(137, Bonus::FREE_SHOOTING, 0, 0, 0, new HasAnotherBonusLimiter(Bonus::SHOOTER));
//Wizard's Well //Wizard's Well
giveArtBonus(138, Bonus::FULL_MANA_REGENERATION, 0); giveArtBonus(138, Bonus::FULL_MANA_REGENERATION, 0);