cyzhao 5 kuukautta sitten
vanhempi
commit
5ed8a6b522

+ 1 - 1
Gameserver/App/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-24 16:11:13
+ // 日期: 2024-12-26 09:33:33
 ////////////////////
 
 /**

+ 1 - 1
Gameserver/App/model/Const/sm_activeTask.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-19 12:05:55
+ // 日期: 2024-12-24 18:05:44
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_activeTask_type.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-19 12:05:55
+ // 日期: 2024-12-24 18:05:44
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_equip.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-24 15:09:40
+ // 日期: 2024-12-25 14:35:56
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_glc2.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-18 18:01:58
+ // 日期: 2024-12-24 16:35:56
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_item.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-24 16:05:07
+ // 日期: 2024-12-25 14:35:56
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/User/E_PredicateActionType.php

@@ -26,7 +26,7 @@ class E_PredicateActionType {
     const mulDamage = "mulDamage";
     
     /**
-     * 所有装备基础属性+5%----等级的基础攻击力/生命 攻击力取actionParam1 生命actionParam2
+     * 所有装备基础属性+5%----基础攻击力/生命 攻击力取actionParam1 生命actionParam2
      */
     const mulEquipBasicProps = "mulEquipBasicProps";
     

+ 140 - 27
Gameserver/App/process/FightPower_Calculate.php

@@ -13,31 +13,152 @@ namespace loyalsoft;
  * 战力 = (基础攻击力 * 攻击力系数 + 基础生命值 * 生命值系数 + (1+暴击率) * (1+暴击伤害) * 攻击力系数 + 肉食恢复加成 * (1+肉食恢复效果)*生命值系数+伤害减免值 * (1+伤害减免效果)* 生命值系数)*(1+装备系数+角色系数)
  */
 class FightPower_Calculate {
-    //战力 = (基础攻击力 * 攻击力系数 + 基础生命值 * 生命值系数 + (1+暴击率) * (1+暴击伤害) * 攻击力系数 + 肉食恢复加成 * (1+肉食恢复效果)*生命值系数+伤害减免值 * (1+伤害减免效果)* 生命值系数) * (1+装备系数+角色系数)
+    
 
+    public static function GetFightPower() {       
+        $file = __NAMESPACE__ . '\\'  . 'E_PredicateActionType';       
+        $reflectionClass = new \ReflectionClass($file);
+        $constants = $reflectionClass->getConstants();
+
+        $dic = new \stdClass();
+        foreach ($constants as $name => $predicateActionType) {
+            $dic->$predicateActionType = 0;
+        }
+                      
+        $CurrentHeroId = ctx()->heros->CurrentHeroId;
+        $mo = GameConfig::hero_getItem($CurrentHeroId);
+        my_Assert($mo != null, ErrCode::err_const_no);
+        
+//【1.当前英雄表里的基础攻击 2.装备品质解锁的攻击力 3.装备里镶嵌的宝石攻击力 4.组成套装的攻击力5.启灵攻击力 6.英雄自带词条】 7.装备等级带来的攻击力/生命
+        //英雄带的【1.配置表基础 2.英雄身上的词条】           
+        $addDamage = E_PredicateActionType::addDamage;
+        $addHp = E_PredicateActionType::addHp;
+        $addBigHitRate = E_PredicateActionType::addBigHitRate;
+        $addBigHitVal = E_PredicateActionType::addBigHitVal;
+        
+        $dic->$addDamage += $mo->attack;
+        $dic->$addHp += $mo->hp; 
+        $dic->$addBigHitRate += $mo->bigHit_rate; 
+        $dic->$addBigHitVal += $mo->bigHit_Val;
+        
+        $hero_special_predicate = explode(',', $mo->special_predicate);           
+        foreach ($hero_special_predicate as $hero_predicateId) {
+            self::predicateActionParamVal($hero_predicateId,$dic);        
+        }
+        
+        //装备
+        $attck = 0;
+        $hp = 0;
+        $equipDic = ctx()->store->equipLocation;
+             
+        $suitDic = new \stdClass();              
+        $equipParam = 0;
+        foreach ($equipDic as $index => $equipUid) {
+            //等级
+            $ins_Equip = new Ins_Equip(ctx()->store->equip->$equipUid);
+            $equipParam += $ins_Equip->mo()->mulFightPower;
+            if ($ins_Equip->mo()->position % 2 == 1) {
+                $attck += GameConfig::equip_levelupgrade_getItem($ins_Equip->mo()->rarity, $ins_Equip->qual, $ins_Equip->mo()->position, $ins_Equip->level)->attckNum;
+            } elseif ($ins_Equip->mo()->position % 2 == 0) {
+                $hp += GameConfig::equip_levelupgrade_getItem($ins_Equip->mo()->rarity, $ins_Equip->qual, $ins_Equip->mo()->position, $ins_Equip->level)->hpNum;
+            }
+            //品阶解锁
+            $str = explode(';', $ins_Equip->mo()->qual_predicateId);
+            foreach ($str as $val) {
+                $str2 = explode(',', $val);
+                if($ins_Equip->qual >= $str2[0]){
+                    self::predicateActionParamVal($str2[1],$dic);                
+                }                          
+            }
+            
+            //套装
+            $suitId = $ins_Equip->mo()->suitId;
+            if(StlUtil::dictHasProperty($suitDic, $suitId)){
+                $suitDic->$suitId += 1;
+            } else {
+                $suitDic->$suitId = 1;
+            }
+            
+            //宝石
+            if($ins_Equip->qual >=4 && $ins_Equip->gemSetSlot != null){
+                foreach ($ins_Equip->gemSetSlot as $index => $gemUid) {
+                    if($gemUid != 0){
+                        $gem_predicateId = ctx()->store->gemStore->$gemUid->predicateId;
+                        self::predicateActionParamVal($gem_predicateId,$dic);                    
+                    }
+                }               
+            }
+        }
+        
+        foreach ($suitDic as $suitId => $num) {
+            $suitMo = GameConfig::equip_suit_getItem($suitId);
+            my_Assert($suitMo != null, ErrCode::err_const_no);
+            if($num >= $suitMo->num){
+                self::predicateActionParamVal($suitMo->effect,$dic);             
+            }
+        }
+        
+        $arr = GameConfig::evolve();
+        $evolveMaxId_left = ctx()->gates->evolveMaxId_left;
+        $evolveMaxId_right = ctx()->gates->evolveMaxId_right;
+        foreach ($arr as $key => $value) {
+            isEditor() and $value = new \sm_evolve();
+            if ($key <= $evolveMaxId_left) {             
+                self::predicateActionParamVal($value->predicateId,$dic);
+                continue;             
+            }
+            
+            if($value->specificEvolveId >0 && $value->specificEvolveId <= $evolveMaxId_right){
+                self::predicateActionParamVal($value->specificPredicateId,$dic);
+                continue;
+            }
+            
+            break;
+        }
+        
+        $dic->$addDamage +=$attck;     
+        $dic->$addHp +=$hp; 
+        //战力 = (基础攻击力 * 攻击力系数 + 基础生命值 * 生命值系数 + (1+暴击率) * (1+暴击伤害) * 攻击力系数 + 肉食恢复加成 * (1+肉食恢复效果)*生命值系数+伤害减免值 * (1+伤害减免效果)* 生命值系数) * (1+装备系数+角色系数)       
+        $attackParas = GameConfig::glc2()->attackParas;
+        $hpParas = GameConfig::glc2()->hpParas;
+        $base_addDamage = $dic->$addDamage;
+        $base_addHp = $dic->$addHp;
+        $baojilv = $dic->$addBigHitRate;
+        $baojishanghai = $dic->$addBigHitVal;
+        $addEatFood = E_PredicateActionType::addEatFood;
+        $roushihuifu = $dic->$addEatFood;
+        $mulEatFood = E_PredicateActionType::mulEatFood;
+        $roushihuifu_xiaoguo = $dic->$mulEatFood;
+        $addDecDamage = E_PredicateActionType::addDecDamage;
+        $shanghaijianmian = $dic->$addDecDamage;
+        $mulDecDamage = E_PredicateActionType::mulDecDamage;
+        $shanghaijianmian_xiaoguo = $dic->$mulDecDamage;
+        
+        $fightPower = ($base_addDamage*$attackParas + $base_addHp*$hpParas + (1+$baojilv)*(1+$baojishanghai)*$attackParas + $roushihuifu*(1+$roushihuifu_xiaoguo)*$hpParas + $shanghaijianmian*(1+$shanghaijianmian_xiaoguo)* $hpParas)*(1 + $equipParam + $mo->mulFightPower);
+     
+        return round($fightPower,0);
+    }
+    
+    
     /**
      * 获取词条对应的参数值
      * @param type $predicateId
      */
-    public static function predicateActionParamVal($dic, $predicateId) {
+    public static function predicateActionParamVal($predicateId,&$dic) {        
         $predicateMo = GameConfig::predicate_getItem($predicateId);
-
-        $predicateDic = new \stdClass();
-        
+        my_Assert(null != $predicateMo, ErrCode::err_const_no);
         switch ($predicateMo->actionType) {
-            case E_PredicateActionType::mulEquipBasicProps://所有装备基础属性+5%----等级的基础攻击力/生命 攻击力取actionParam1 生命actionParam2            
+            case E_PredicateActionType::mulEquipBasicProps://所有装备基础属性+5%---基础攻击力/生命 攻击力取actionParam1 生命actionParam2            
                 if ($predicateMo->actionParam1 != null) {
                     $actionKey = E_PredicateActionType::mulEquipBasicProps_damage;
                     $actionVal = $predicateMo->actionParam1;
-
-                    $dic = self::predicateActionParamVal_Sav($dic, $actionKey,$actionVal);
+                    $dic->$actionKey += $actionVal;                   
                 }
 
                 if ($predicateMo->actionParam2 != null) {
                     $actionKey = E_PredicateActionType::mulEquipBasicProps_hp;
                     $actionVal = $predicateMo->actionParam2;
-
-                    $dic = self::predicateActionParamVal_Sav($dic, $actionKey,$actionVal);
+                    $dic->$actionKey += $actionVal;                 
                 }
 
                 break;
@@ -47,26 +168,18 @@ class FightPower_Calculate {
                 $actionVal1 = $predicateMo->actionParam1;
                 $actionVal2 = $predicateMo->actionParam2;
 
-                $dic = self::predicateActionParamVal_Sav($dic, $actionKey1,$actionVal1);
-                $dic = self::predicateActionParamVal_Sav($dic, $actionKey2,$actionVal2);
-
+                $dic->$actionKey1 += $actionVal1;
+                $dic->$actionKey2 += $actionVal2;                          
                 break;
-            default:               
-                $dic = self::predicateActionParamVal_Sav($dic, $predicateMo->actionType, $predicateMo->actionParam1);
+            default:                             
+                $actionKey = $predicateMo->actionType;
+                $actionVal = $predicateMo->actionParam1;                     
+                                              
+                if(StlUtil::dictHasProperty($dic, $actionKey)){
+                    $dic->$actionKey += $actionVal;                  
+                }                                                         
                 break;
         }
-        
-        return $dic;
-    }
-
-    public static function predicateActionParamVal_Sav($dic,$actionKey, $actionVal) {
-        if (StlUtil::dictHasProperty($dic, $actionKey)) {
-            $dic->$actionKey += $actionVal;
-        } else {
-            $dic->$actionKey = $actionVal;
-        }
-        
-        return $dic;
     }
 
 }

+ 5 - 3
Gameserver/App/process/FightProc.php

@@ -1252,7 +1252,8 @@ class FightProc {
         $uid = req()->uid;
 
         $score = self::GetRankScoreUid($uid, 2);
-        $power = self::countUserFightPower();
+        //$power = self::countUserFightPower();
+        $power = FightPower_Calculate::GetFightPower();
         if ($power > $score) {
             $arr = array();
             $arr["$uid"] = self::createScore($power);
@@ -1300,8 +1301,9 @@ class FightProc {
             $isExistFinishReward_other = self::isExistNoDrawed_FightPower();
         } else {
             $list = gMem()->zrevrange(MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid), 0, glc()->Rank_FightPower_OnListRank, true);
-            $selfExtraInfo = self::countUserFightPower();
-
+            //$selfExtraInfo = self::countUserFightPower();
+            $selfExtraInfo = FightPower_Calculate::GetFightPower();
+            
             $isExistFinishReward = self::isExistNoDrawed_FightPower();
             $isExistFinishReward_other = self::isExistNoDrawed_MainGate();
         }