From c591cb6e215ea5e762560afdae059f1d4fd7f4ec Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期五, 28 九月 2018 16:32:37 +0800
Subject: [PATCH] Merge branch 'master' into 3687天赋功能

---
 Fight/BossFakeLineUtility.cs |  119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 116 insertions(+), 3 deletions(-)

diff --git a/Fight/BossFakeLineUtility.cs b/Fight/BossFakeLineUtility.cs
index 10597e3..6d67480 100644
--- a/Fight/BossFakeLineUtility.cs
+++ b/Fight/BossFakeLineUtility.cs
@@ -24,9 +24,9 @@
         DTC0102_tagCDBPlayer.switchAccountEvent += OnAccountSwitch;
     }
 
-    //杩欎釜鍊煎湪鍒濊boss鍜屾渶鍚庣湅瑙乥oss鐨勬椂鍊欒褰曪紝鍏跺�间负time.time+1鍒嗛挓锛岃繖娈垫椂闂村唴鍛婅瘔鐜╁鍏舵墍鍦ㄥ垎绾跨殑boss鐨勬浜℃儏鍐碉紝鍚﹀垯鍛婅瘔鐜╁鍏叡boss鐨勬浜℃儏鍐点��
-    public uint lastBossNpcID;
-    public float inMistakeForBossAliveOverTime = 0f;
+    public int recordBossId { get { return bossSawRecorder.npcId; } }
+    NpcSawRecorder bossSawRecorder = new NpcSawRecorder();
+    NpcSawRecorder stoneSawRecorder = new NpcSawRecorder();
 
     public bool IsShuntBoss(int _bossId)
     {
@@ -66,6 +66,49 @@
             var tombstoneId = bossInfoConfig.StoneNPCID;
             return GAMgr.Instance.GetCloserNPC(PlayerDatas.Instance.hero.Pos, tombstoneId) != null;
         }
+    }
+
+    public void RecordSawStone(int npcId, int lineId)
+    {
+        stoneSawRecorder.Record(npcId, lineId, Time.realtimeSinceStartup);
+    }
+
+    public bool HasSawLineStoneRecently(int bossId, int lineId)
+    {
+        var config = Config.Instance.Get<BossInfoConfig>(bossId);
+        if (config != null)
+        {
+            return stoneSawRecorder.HasSawRecently(config.StoneNPCID, lineId, 60);
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    public void ClearStoneRecord()
+    {
+        stoneSawRecorder.Clear();
+    }
+
+    public void RecordSawBoss(int bossId, int lineId)
+    {
+        bossSawRecorder.Record(bossId, lineId, Time.realtimeSinceStartup);
+    }
+
+    public bool HasSawBossRecently(int bossId)
+    {
+        return stoneSawRecorder.HasSawRecently(bossId, 60);
+    }
+
+    public bool HasSawLineBossRecently(int bossId, int lineId)
+    {
+        return bossSawRecorder.HasSawRecently(bossId, lineId, 60);
+    }
+
+    public void ClearBossRecord()
+    {
+        bossSawRecorder.Clear();
     }
 
     FindPreciousModel findPreciousModel { get { return ModelCenter.Instance.GetModel<FindPreciousModel>(); } }
@@ -121,7 +164,77 @@
 
     private void OnAccountSwitch()
     {
+        m_MakeFakeLineTimes = 0;
         bossKillTimes.Clear();
+        ClearBossRecord();
+        ClearStoneRecord();
+    }
+
+    class NpcSawRecorder
+    {
+        public int npcId { get; private set; }
+
+        int m_LineId = -1;
+        public int lineId {
+            get { return m_LineId; }
+            private set { m_LineId = value; }
+        }
+
+        float m_Time = -99999;
+        public float time {
+            get { return m_Time; }
+            private set { m_Time = value; }
+        }
+
+        public void Record(int npcId, int lineId, float time)
+        {
+            this.npcId = npcId;
+            this.lineId = lineId;
+            this.time = time;
+        }
+
+        public void Clear()
+        {
+            this.npcId = 0;
+            this.lineId = -1;
+            this.time = -99999;
+        }
+
+        public bool HasSawRecently(int npcId, float second)
+        {
+            if (this.npcId != npcId)
+            {
+                return false;
+            }
+
+            if (Time.realtimeSinceStartup - this.time > 60)
+            {
+                return false;
+            }
+
+            return true;
+        }
+
+        public bool HasSawRecently(int npcId, int lineId, float second)
+        {
+            if (this.npcId != npcId)
+            {
+                return false;
+            }
+
+            if (this.lineId != lineId)
+            {
+                return false;
+            }
+
+            if (Time.realtimeSinceStartup - this.time > 60)
+            {
+                return false;
+            }
+
+            return true;
+        }
+
     }
 
 }

--
Gitblit v1.8.0