Ver código fonte

vcmi: remove SELF_LUCK bonus

This bonus also now handled by LUCK bonus with INDEPENDENT_MAX of 1
Konstantin 2 anos atrás
pai
commit
ff5f828031
3 arquivos alterados com 13 adições e 13 exclusões
  1. 3 1
      config/creatures/neutral.json
  2. 10 9
      lib/HeroBonus.cpp
  3. 0 3
      lib/HeroBonus.h

+ 3 - 1
config/creatures/neutral.json

@@ -400,7 +400,9 @@
 		{
 			"lucky" :
 			{
-				"type" : "SELF_LUCK"
+				"type" : "LUCK",
+				"val" : 1,
+				"valueType" : "INDEPENDENT_MAX"
 			}
 		 },
 		"graphics" :

+ 10 - 9
lib/HeroBonus.cpp

@@ -114,6 +114,7 @@ const std::set<std::string> deprecatedBonusSet = {
 	"BLOCK_MORALE",
 	"BLOCK_LUCK",
 	"SELF_MORALE",
+	"SELF_LUCK"
 };
 
 ///CBonusProxy
@@ -670,13 +671,11 @@ Selector::type()(Bonus::NON_LIVING)
 
 CSelector IBonusBearer::moraleSelector = Selector::type()(Bonus::MORALE);
 CSelector IBonusBearer::luckSelector = Selector::type()(Bonus::LUCK);
-CSelector IBonusBearer::selfLuckSelector = Selector::type()(Bonus::SELF_LUCK);
 
 IBonusBearer::IBonusBearer()
 	:anaffectedByMorale(this, anaffectedByMoraleSelector),
 	moraleValue(this, moraleSelector, 0),
-	luckValue(this, luckSelector, 0),
-	selfLuck(this, selfLuckSelector)
+	luckValue(this, luckSelector, 0)
 {
 }
 
@@ -761,9 +760,6 @@ int IBonusBearer::LuckVal() const
 
 	int ret = luckValue.getValue();
 
-	if(selfLuck.getHasBonus()) //eg. halfling
-		vstd::amax(ret, +1);
-
 	return vstd::abetween(ret, -3, +3);
 }
 
@@ -790,9 +786,6 @@ int IBonusBearer::LuckValAndBonusList(TConstBonusListPtr & bonusList) const
 	}
 	int ret = luckValue.getValueAndList(bonusList);
 
-	if(selfLuck.getHasBonus()) //eg. halfling
-		vstd::amax(ret, +1);
-
 	return vstd::abetween(ret, -3, +3);
 }
 
@@ -1975,6 +1968,14 @@ BonusParams::BonusParams(std::string deprecatedTypeStr, std::string deprecatedSu
 		valueType = Bonus::INDEPENDENT_MAX;
 		valueTypeRelevant = true;
 	}
+	else if (deprecatedTypeStr == "SELF_LUCK")
+	{
+		type = Bonus::LUCK;
+		val = 1;
+		valRelevant = true;
+		valueType = Bonus::INDEPENDENT_MAX;
+		valueTypeRelevant = true;
+	}
 	else
 		isConverted = false;
 }

+ 0 - 3
lib/HeroBonus.h

@@ -258,7 +258,6 @@ public:
 	BONUS_NAME(FEAR)									\
 	BONUS_NAME(FEARLESS)								\
 	BONUS_NAME(NO_DISTANCE_PENALTY)						\
-	BONUS_NAME(SELF_LUCK) /*halfling*/					\
 	BONUS_NAME(ENCHANTER)/* for Enchanter spells, val - skill level, subtype - spell id, additionalInfo - cooldown */ \
 	BONUS_NAME(HEALER)									\
 	BONUS_NAME(SIEGE_WEAPON)							\
@@ -709,8 +708,6 @@ private:
 	CTotalsProxy moraleValue;
 	static CSelector luckSelector;
 	CTotalsProxy luckValue;
-	static CSelector selfLuckSelector;
-	CCheckProxy selfLuck;
 
 public:
 	//new bonusing node interface