gwang 3 سال پیش
والد
کامیت
2c93fdac50
2فایلهای تغییر یافته به همراه38 افزوده شده و 19 حذف شده
  1. 36 17
      Gameserver/Amfphp/model/User/Ins_UserHero.php
  2. 2 2
      Gameserver/Amfphp/process/HeroProc.php

+ 36 - 17
Gameserver/Amfphp/model/User/Ins_UserHero.php

@@ -266,10 +266,11 @@ class Ins_UserHero extends Object_ext {
     /**
      * 获取该角色战斗力数值
      * 生命值+物理攻击*4+魔法强度*4+护甲*5+魔抗*5
+     * @param Data_UserGame $user
      * @return type
      */
-    public function GetPower() {
-        return (int) ($this->getHpForBattle() * 1.0                                    //
+    public function GetPower($user) {
+        return (int) ($this->getHpForBattle($user) * 1.0                                    //
                 + $this->getNengLiangZhiJiForBattle() * 0                              //
                 + $this->getWuLiGongJiForBattle() * 4                                  //
                 + $this->getFaShuQiangDuForBattle() * 4                                //
@@ -315,11 +316,11 @@ class Ins_UserHero extends Object_ext {
     /**
      * 获得角色装备的言灵提供的属性加成
      * @param type $attribute
+     * @param Data_UserGame $user
      * @return type
      */
-    public function getYanlingExtraProperty($attribute) {
+    public function getYanlingExtraProperty($attribute, $user) {
         $result = 0;
-        $player = req()->userInfo->game;
         var_dump($this);
         foreach ($this->yanling as $item) {
             $itemUID = $item->itemuid;
@@ -327,7 +328,7 @@ class Ins_UserHero extends Object_ext {
                 foreach (debug_backtrace()as $x) {
                     echoLine(json_encode($x));
                 }
-                $itemId = $player->store->yanling->$itemUID->typeId;
+                $itemId = $user->store->yanling->$itemUID->typeId;
                 $mo = GameConfig::item_yanling_getItem($itemId);
                 my_Assert(null != $mo, ErrCode::err_const_no);                  # 言灵常量找不到
                 switch ($attribute) {
@@ -506,51 +507,69 @@ class Ins_UserHero extends Object_ext {
 
     /**
      * 战场血量 = 基础血量 + 武器和言灵加成
+     * @param Data_UserGame $user
      * @return type
      */
-    public function getHpForBattle() {
+    public function getHpForBattle($user) {
         return (int) ($this->getHp()                                            // 英雄数据
                 + $this->getEquipExtraProperty(EHeroProperties ::HP)            // 武器加成
-                + $this->getYanlingExtraProperty(EHeroProperties :: HP)         // 言灵加成
+                + $this->getYanlingExtraProperty(EHeroProperties :: HP, $user)         // 言灵加成
                 );
     }
 
     /**
      * 战场能量值 = 基础能量值 + 武器和言灵加成
+     * @param Data_UserGame $user
      * @return type
      */
-    public function getNengLiangZhiJiForBattle() {
+    public function getNengLiangZhiJiForBattle($user) {
         return (int) ($this->getNengLiangZhi()                                  // 英雄本身
                 + $this->getEquipExtraProperty(EHeroProperties :: NENGLIANGZHI) // + 武器加成
-                + $this->getYanlingExtraProperty(EHeroProperties::NENGLIANGZHI) // + 言灵加成
+                + $this->getYanlingExtraProperty(EHeroProperties::NENGLIANGZHI, $user) // + 言灵加成
                 );
     }
 
-    public function getWuLiGongJiForBattle() {
+    /**
+     * @param Data_UserGame $user
+     * @return type
+     */
+    public function getWuLiGongJiForBattle($user) {
         return (int) ($this->getWuLiGongJi()                                            // 英雄数据
                 + $this->getEquipExtraProperty(EHeroProperties ::WULIGONGJI)            // 武器加成
-                + $this->getYanlingExtraProperty(EHeroProperties :: WULIGONGJI)         // 言灵加成
+                + $this->getYanlingExtraProperty(EHeroProperties :: WULIGONGJI, $user)         // 言灵加成
                 );
     }
 
-    function getFaShuQiangDuForBattle() {
+    /**
+     * @param Data_UserGame $user
+     * @return type
+     */
+    function getFaShuQiangDuForBattle($user) {
         return (int) ($this->getFaShuQiangDu()                                            // 英雄数据
                 + $this->getEquipExtraProperty(EHeroProperties ::FASHUQIANGDU)            // 武器加成
-                + $this->getYanlingExtraProperty(EHeroProperties :: FASHUQIANGDU)         // 言灵加成
+                + $this->getYanlingExtraProperty(EHeroProperties :: FASHUQIANGDU, $user)         // 言灵加成
                 );
     }
 
-    function getFangYuHuJiaForBattle() {
+    /**
+     * @param Data_UserGame $user
+     * @return type
+     */
+    function getFangYuHuJiaForBattle($user) {
         return (int) ($this->getFangYuHuJia()                                            // 英雄数据
                 + $this->getEquipExtraProperty(EHeroProperties ::FANGYUHUJIA)            // 武器加成
-                + $this->getYanlingExtraProperty(EHeroProperties :: FANGYUHUJIA)         // 言灵加成
+                + $this->getYanlingExtraProperty(EHeroProperties :: FANGYUHUJIA, $user)         // 言灵加成
                 );
     }
 
-    function getMoFaKangXingForBattle() {
+    /**
+     * @param Data_UserGame $user
+     * @return type
+     */
+    function getMoFaKangXingForBattle($user) {
         return (int) ($this->getMoFaKangXing()                                            // 英雄数据
                 + $this->getEquipExtraProperty(EHeroProperties ::MOFAKANGXING)            // 武器加成
-                + $this->getYanlingExtraProperty(EHeroProperties :: MOFAKANGXING)         // 言灵加成
+                + $this->getYanlingExtraProperty(EHeroProperties :: MOFAKANGXING, $user)         // 言灵加成
                 );
     }
 

+ 2 - 2
Gameserver/Amfphp/process/HeroProc.php

@@ -948,7 +948,7 @@ class HeroProc {
                     if ($hero) {
 //                        $fp += self::calcHeroFightPower($hero);
                         $h = new Ins_UserHero($hero);
-                        $fp += $h->GetPower();
+                        $fp += $h->GetPower($user);
                     }
                 }
             }
@@ -969,7 +969,7 @@ class HeroProc {
         $fp = 0;                                                                # 总战力:返回值
         foreach ($user->heros->collectHeros as $hid => $hero) {
             $h = new Ins_UserHero($hero);
-            $fp += $h->GetPower();
+            $fp += $h->GetPower($user);
         }
         $key_fp = MemKey_GameRun::Game_FightPowerRank_zset($zoneid);            # 战力榜
         $key_log = MemKey_GameRun::Game_Rank_FPowerBreakLog_hash($zoneid);      # 突破记录