瀏覽代碼

vcmi: add a last hex setting

I consider this behaviour as H3 bug, but this is H3.
So, added a setting to disable this behaviour.
Konstantin 2 年之前
父節點
當前提交
f704a17e1a
共有 4 個文件被更改,包括 12 次插入2 次删除
  1. 3 1
      config/gameConfig.json
  2. 1 0
      lib/GameSettings.cpp
  3. 1 0
      lib/GameSettings.h
  4. 7 1
      server/CGameHandler.cpp

+ 3 - 1
config/gameConfig.json

@@ -165,7 +165,9 @@
 			// every 1 defense point damage influence in battle when defense points > attack points during creature attack
 			"defensePointDamageFactor": 0.025, 
 			// limit of damage reduction that can be achieved by overpowering defense points
-			"defensePointDamageFactorCap": 0.7
+			"defensePointDamageFactorCap": 0.7,
+			// If set to true, double-wide creatures will trigger obstacle effect when moving one tile forward or backwards
+			"oneHexTriggersObstacles": false
 		},	
 
 		"creatures":

+ 1 - 0
lib/GameSettings.cpp

@@ -58,6 +58,7 @@ void GameSettings::load(const JsonNode & input)
 		{EGameSettings::COMBAT_DEFENSE_POINT_DAMAGE_FACTOR_CAP, "combat",    "defensePointDamageFactorCap"},
 		{EGameSettings::COMBAT_GOOD_LUCK_DICE,                  "combat",    "goodLuckDice"               },
 		{EGameSettings::COMBAT_GOOD_MORALE_DICE,                "combat",    "goodMoraleDice"             },
+		{EGameSettings::COMBAT_ONE_HEX_TRIGGERS_OBSTACLES,      "combat",    "oneHexTriggersObstacles"   },
 		{EGameSettings::CREATURES_ALLOW_ALL_FOR_DOUBLE_MONTH,   "creatures", "allowAllForDoubleMonth"     },
 		{EGameSettings::CREATURES_ALLOW_RANDOM_SPECIAL_WEEKS,   "creatures", "allowRandomSpecialWeeks"    },
 		{EGameSettings::CREATURES_DAILY_STACK_EXPERIENCE,       "creatures", "dailyStackExperience"       },

+ 1 - 0
lib/GameSettings.h

@@ -54,6 +54,7 @@ enum class EGameSettings
 	TEXTS_TERRAIN,
 	TOWNS_BUILDINGS_PER_TURN_CAP,
 	TOWNS_STARTING_DWELLING_CHANCES,
+	COMBAT_ONE_HEX_TRIGGERS_OBSTACLES,
 
 	OPTIONS_COUNT
 };

+ 7 - 1
server/CGameHandler.cpp

@@ -1559,7 +1559,13 @@ int CGameHandler::moveStack(int stack, BattleHex dest)
 				stackIsMoving = false;
 		}
 	}
-
+	//handle last hex separately for deviation
+	if (VLC->settings()->getBoolean(EGameSettings::COMBAT_ONE_HEX_TRIGGERS_OBSTACLES))
+	{
+		if (dest == battle::Unit::occupiedHex(start, curStack->doubleWide(), curStack->side)
+			|| start == battle::Unit::occupiedHex(dest, curStack->doubleWide(), curStack->side))
+			passed.clear(); //Just empty passed, obstacles will handled automatically
+	}
 	//handling obstacle on the final field (separate, because it affects both flying and walking stacks)
 	handleDamageFromObstacle(curStack, false, passed);