DjWarmonger 12 år sedan
förälder
incheckning
4fd9bcfedc
6 ändrade filer med 37 tillägg och 32 borttagningar
  1. 1 1
      client/CCreatureWindow.cpp
  2. 6 3
      config/spell_info.json
  3. 0 27
      lib/BattleState.cpp
  4. 0 1
      lib/BattleState.h
  5. 27 0
      lib/HeroBonus.cpp
  6. 3 0
      lib/HeroBonus.h

+ 1 - 1
client/CCreatureWindow.cpp

@@ -540,7 +540,7 @@ void CCreatureWindow::showAll(SDL_Surface * to)
 
 	printLine(3, CGI->generaltexth->allTexts[199], stackNode->getMinDamage() * dmgMultiply, stackNode->getMaxDamage() * dmgMultiply, true);
 	printLine(4, CGI->generaltexth->allTexts[388], c->valOfBonuses(Bonus::STACK_HEALTH), stackNode->valOfBonuses(Bonus::STACK_HEALTH));
-	printLine(6, CGI->generaltexth->zelp[441].first, c->valOfBonuses(Bonus::STACKS_SPEED), stackNode->valOfBonuses(Bonus::STACKS_SPEED));
+	printLine(6, CGI->generaltexth->zelp[441].first, c->Speed(), stackNode->Speed());
 
 	for(CBonusItem* b : bonusItems)
 		b->showAll (to);

+ 6 - 3
config/spell_info.json

@@ -588,7 +588,8 @@
 				{
 					"type": 	"STACKS_SPEED",
 					"duration": "N_TURNS",
-					"values":[2, 2, 4, 4]
+					"values":[2, 2, 4, 4],
+					"ainfos":[0,0,0,0]
 				}
 			]
 		},
@@ -669,7 +670,8 @@
 				{
 					"type": 	"STACKS_SPEED",
 					"duration": "N_TURNS",
-					"values":[3, 3, 5, 5]
+					"values":[3, 3, 5, 5],
+					"ainfos":[0,0,0,0]
 				}
 			],
 			"immunity":["SIEGE_WEAPON"]
@@ -690,7 +692,8 @@
 					"type": 	"STACKS_SPEED",
 					"valueType": "PERCENT_TO_ALL",
 					"duration": "N_TURNS",
-					"values":[-25,-25,-50,-50]
+					"values":[-25,-25,-50,-50],
+					"ainfos":[0,0,0,0]
 				}
 			],
 			"immunity":["SIEGE_WEAPON"]

+ 0 - 27
lib/BattleState.cpp

@@ -895,33 +895,6 @@ void CStack::postInit()
 	casts = valOfBonuses(Bonus::CASTS);
 }
 
-ui32 CStack::Speed( int turn /*= 0*/ , bool useBind /* = false*/) const
-{
-	if(hasBonus(Selector::type(Bonus::SIEGE_WEAPON).And(Selector::turns(turn)))) //war machines cannot move
-		return 0;
-
-	int speed = valOfBonuses(Selector::type(Bonus::STACKS_SPEED).And(Selector::turns(turn)));
-
-	int percentBonus = 0;
-	for(const Bonus *b : getBonusList())
-	{
-		if(b->type == Bonus::STACKS_SPEED)
-		{
-			percentBonus += b->additionalInfo;
-		}
-	}
-
-	speed = ((100 + percentBonus) * speed)/100;
-
-	//bind effect check - doesn't influence stack initiative
-	if (useBind && getEffect (SpellID::BIND))
-	{
-		return 0;
-	}
-
-	return speed;
-}
-
 ui32 CStack::level() const
 {
 	if (base)

+ 0 - 1
lib/BattleState.h

@@ -185,7 +185,6 @@ public:
 	bool waited(int turn = 0) const;
 	bool canMove(int turn = 0) const; //if stack can move
 	bool canBeHealed() const; //for first aid tent - only harmed stacks that are not war machines
-	ui32 Speed(int turn = 0, bool useBind = false) const; //get speed of creature with all modificators
 	ui32 level() const;
 	si32 magicResistance() const override; //include aura of resistance
 	static void stackEffectToFeature(std::vector<Bonus> & sf, const Bonus & sse);

+ 27 - 0
lib/HeroBonus.cpp

@@ -486,6 +486,33 @@ si32 IBonusBearer::magicResistance() const
 	return valOfBonuses(Bonus::MAGIC_RESISTANCE);
 }
 
+ui32 CBonusSystemNode::Speed( int turn /*= 0*/ , bool useBind /* = false*/) const
+{
+	if(hasBonus(Selector::type(Bonus::SIEGE_WEAPON).And(Selector::turns(turn)))) //war machines cannot move
+		return 0;
+
+	int speed = valOfBonuses(Selector::type(Bonus::STACKS_SPEED).And(Selector::turns(turn)));
+
+	int percentBonus = 0;
+	for(const Bonus *b : getBonusList())
+	{
+		if(b->type == Bonus::STACKS_SPEED)
+		{
+			percentBonus += b->additionalInfo;
+		}
+	}
+
+	speed = ((100 + percentBonus) * speed)/100;
+
+	//bind effect check - doesn't influence stack initiative
+	if (useBind && getEffect (SpellID::BIND))
+	{
+		return 0;
+	}
+
+	return speed;
+}
+
 bool IBonusBearer::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
 {
 	std::stringstream cachingStr;

+ 3 - 0
lib/HeroBonus.h

@@ -675,6 +675,9 @@ public:
 	virtual std::string bonusToString(const Bonus *bonus, bool description) const {return "";}; //description or bonus name
 	virtual std::string nodeName() const;
 
+	ui32 Speed(int turn = 0, bool useBind = false) const; //get speed of creature with all modificators
+	//FIXME: this interface should be moved to IBonusBearer, but bonus list is required for original implementation to compile
+
 	void deserializationFix();
 	void exportBonus(Bonus * b);
 	void exportBonuses();