From e613b40eeaa3c45a6bc3188d61cd11ec7be2c874 Mon Sep 17 00:00:00 2001
From: pregmodfan <pregmodfan@cock.li>
Date: Fri, 29 Sep 2017 12:40:27 +0300
Subject: [PATCH] Even more tweaking for rules second level properties

---
 src/js/storyJS.tw | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/js/storyJS.tw b/src/js/storyJS.tw
index ecaf157acba..e3c27a179eb 100644
--- a/src/js/storyJS.tw
+++ b/src/js/storyJS.tw
@@ -928,6 +928,11 @@ window.mergeRules = function(rules) {
             if (applies)
             {	
 
+            	//Objects in JS in operaions "=" pass by reference, so we need completly new object to avoid mess up previous rules.
+            	if ("object" == typeof rules[i][prop] && "object" != typeof combinedRule[prop])
+            		combinedRule[prop] = new Object();
+
+            	//If we already have object - now we will process it's properties, but object itself should be skiped.
             	if ("object" != typeof combinedRule[prop])
                 	combinedRule[prop] = rules[i][prop];
             
-- 
GitLab