فهرست منبع

Some fixes for shooting vs Creature Window.

DjWarmonger 14 سال پیش
والد
کامیت
e67b7b9da4
3فایلهای تغییر یافته به همراه13 افزوده شده و 12 حذف شده
  1. 9 9
      client/CCreatureWindow.cpp
  2. 1 0
      client/CCreatureWindow.h
  3. 3 3
      lib/CArtHandler.cpp

+ 9 - 9
client/CCreatureWindow.cpp

@@ -22,6 +22,7 @@
 #include <boost/bind.hpp>
 #include <boost/foreach.hpp>
 #include "../lib/CGameState.h"
+#include "../lib/BattleState.h"
 #include "../lib/CSpellHandler.h"
 
 using namespace CSDL_Ext;
@@ -42,6 +43,7 @@ CCreatureWindow::CCreatureWindow (const CStack &stack, int Type)
 	: type(Type)
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL;
+	battleStack = &stack;
 	if (stack.base)
 		init(stack.base, &stack, dynamic_cast<const CGHeroInstance*>(stack.base->armyObj));
 	else
@@ -50,7 +52,6 @@ CCreatureWindow::CCreatureWindow (const CStack &stack, int Type)
 		init(s, stack.type, NULL);
 		delete s;
 	}
-
 }
 
 CCreatureWindow::CCreatureWindow (const CStackInstance &stack, int Type)
@@ -329,19 +330,18 @@ void CCreatureWindow::showAll(SDL_Surface * 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
 
 	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());
 
-	if(stackNode->valOfBonuses(Bonus::SHOTS) && stackNode->hasBonusOfType(Bonus::SHOOTER)) //only for shooting units - important with wog exp shooters
-		printLine(2, CGI->generaltexth->allTexts[198], stackNode->valOfBonuses(Bonus::SHOTS)); //TODO: change shot count for battle stack
+	if(stackNode->valOfBonuses(Bonus::SHOTS) && stackNode->hasBonusOfType(Bonus::SHOOTER))
+	{//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
 	int dmgMultiply = 1;

+ 1 - 0
client/CCreatureWindow.h

@@ -33,6 +33,7 @@ public:
 	const CStackInstance *stack;
 	const CBonusSystemNode *stackNode;
 	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<CBonusItem*> bonusItems;
 	std::vector<LRClickableAreaWText*> spellEffects;

+ 3 - 3
lib/CArtHandler.cpp

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