From 6cad7e6809cee4aa2ab16cc2fa6f1d2843410e33 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Tue, 13 Sep 2022 20:23:13 +0800 Subject: [PATCH] 1 --- webapp/controller/GunController.class.php | 18 +++++--- webapp/controller/HeroController.class.php | 8 ++-- webapp/services/FormulaService.php | 52 ++++++++++++++++++++++ 3 files changed, 68 insertions(+), 10 deletions(-) diff --git a/webapp/controller/GunController.class.php b/webapp/controller/GunController.class.php index fa251ee6..9c4de8c1 100644 --- a/webapp/controller/GunController.class.php +++ b/webapp/controller/GunController.class.php @@ -55,6 +55,7 @@ class GunController extends BaseAuthedController { $this->_rspErr(1, "You don't have the gun yet"); return; } + $gun = Gun::toDto($gunDb); $this->_rspData(array( 'data' => $gun @@ -116,6 +117,7 @@ class GunController extends BaseAuthedController { Gun::getGunList(function ($row) use(&$gunList) { array_push($gunList, Gun::toDto($row)); }); + $this->_rspData(array( 'gun_list' => $gunList )); @@ -464,8 +466,8 @@ class GunController extends BaseAuthedController { } $this->_rspData(array( 'property_chg' => $propertyChgService->toDto(), - 'old_hero' => $oldGun, - 'new_hero' => $newGun, + 'old_gun' => $oldGun, + 'new_gun' => $newGun, )); } break; @@ -513,18 +515,20 @@ class GunController extends BaseAuthedController { 'errcode' => 0, 'errmsg' => '', 'state' => 0, - 'old_hero' => $oldGun, - 'new_hero' => $newGun, + 'old_gun' => $oldGun, + 'new_gun' => $newGun, //'errmsg' => 'advance failed', 'property_chg' => $propertyChgService->toDto(), )); return; } - $gunLucky = \services\FormulaService::Weapon_Advanced_Lucky_Value($gunDb['quality'] + 1); - $durability = \services\FormulaService::Weapon_NFT_Maximum_Durability($gunDb['quality'] + 1,$gunLucky); + $gunLucky = \services\FormulaService::Weapon_Advanced_Lucky_Value($gunDb['quality']); + $nextGunLucky = \services\FormulaService::Weapon_Advanced_Lucky_Value($gunDb['quality'] + 1); + $durability = \services\FormulaService::Weapon_NFT_Maximum_Durability($gunDb['quality'],$gunLucky); + $nextDurability = \services\FormulaService::Weapon_NFT_Maximum_Durability($gunDb['quality'] + 1,$nextGunLucky); Gun::update($gunUniId, array( - 'durability' => $durability, + 'durability' => $gunDb['durability']+($nextDurability-$durability), 'quality' => $gunDb['quality'] + 1, 'lock_type' => 0, 'unlock_time' => 0, diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index c9867e1c..59a0f13d 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -360,11 +360,13 @@ class HeroController extends BaseAuthedController { )); return; } - $heroLucky = \services\FormulaService::Hero_Advanced_Lucky_Value($heroDb['quality'] + 1); - $heroTili = \services\FormulaService::Hero_NFT_Maximum_Physical_Strength($heroDb['quality'] + 1,$heroLucky); + $heroLucky = \services\FormulaService::Hero_Advanced_Lucky_Value($heroDb['quality']); + $nextHeroLucky = \services\FormulaService::Hero_Advanced_Lucky_Value($heroDb['quality'] + 1); + $heroTili = \services\FormulaService::Hero_NFT_Maximum_Physical_Strength($heroDb['quality'],$heroLucky); + $nextHeroTili = \services\FormulaService::Hero_NFT_Maximum_Physical_Strength($heroDb['quality'] + 1,$nextHeroLucky); Hero::update($heroUniId, array( - 'hero_tili' => $heroTili, + 'hero_tili' => $heroDb['hero_tili']+($nextHeroTili-$heroTili), 'skill_points' => $heroDb['skill_points'] + $nextQualityMeta['skill_point'], 'quality' => $heroDb['quality'] + 1, 'advanced_count' => $heroDb['advanced_count'] + 1, diff --git a/webapp/services/FormulaService.php b/webapp/services/FormulaService.php index 9a017119..0d4f67ea 100644 --- a/webapp/services/FormulaService.php +++ b/webapp/services/FormulaService.php @@ -283,6 +283,16 @@ class FormulaService extends BaseService { return 1; } + //英雄劳力值 + public static function Hero_Labor_Value(){ + return 1; + } + + //武器劳力值 + public static function Weapon_Labor_Value(){ + return 1; + } + //英雄芯片劳力值 public static function Hero_Chip_Labor_Value(){ return 1; @@ -354,6 +364,12 @@ class FormulaService extends BaseService { return ($grand>=5?1:0)*($grand<=10?1:0)*round(91*$grand*($grand-6.06)/100+1000/100,0)*100+($grand>=11?1:0)*($grand<=15?1:0)*round(364.29*$grand*($grand-17.847)/100+33446/100,0)*100*self::CEG_Discount_Rate(); } + //芯片镶嵌MINT费用 + public static function Chip_Inlay_Mint($grand){ + //SIGN(芯片等级 >= 5) * ROUND((10+7*(芯片星级-1))*CEG_Discount_Rate,2) + return ($grand>=5?1:0)*round((10+7*($grand-1))*self::CEG_Discount_Rate(),2); + } + //芯片NFT拆卸MINT费用 public static function Chip_Demount_Mint($tili){ return round($tili*10*self::CEG_Discount_Rate()); @@ -460,4 +476,40 @@ class FormulaService extends BaseService { //ROUND(每日新增1阶枪械NFT数量(前1天官方商城正价购买)*6%,0)*30%*600*CEG折扣比率 return round($gun_count*0.06,0)*0.3*600*self::CEG_Discount_Rate(); } + + //每日英雄体力值衰减百分比 + public static function Hero_PSA_Value($quality){ + //MAX(0,ROUND((Hero_Payback_Period-Hero_Attenuation_Parameter* Hero_Labor_Value)/((1-Hero_Attenuation_Parameter/2)* Hero_Payback_Period^2)/ROUND(1.1714+0.0286*英雄阶数,3),4))*(1+0.1*ROUND(SIN(Hero_Labor_Value),2)) + return max(0,round((self::Hero_Payback_Period($quality)-self::Hero_Attenuation_Parameter($quality)*self::Hero_Labor_Value())/((1-self::Hero_Attenuation_Parameter($quality)/2)*pow(self::Hero_Payback_Period($quality),2))/round(1.1714+0.0286*$quality,3),4))*(1+0.1*round(sin(self::Hero_Labor_Value()),2)); + } + + //每日武器耐久度衰减百分比 + public static function Weapon_DA_Value($quality){ + //MAX(0,ROUND((Weapon_Payback_Period-Weapon_Attenuation_Parameter* Weapon_Labor_Value)/((1-Weapon_Attenuation_Parameter/2)* Weapon_Payback_Period ^2)/ROUND(1.1714+0.0286*武器阶数,3),4))*(1+0.1*ROUND(SIN(Weapon_Labor_Value),2)) + return max(0,round((self::Weapon_Payback_Period($quality)-self::Weapon_Attenuation_Parameter($quality)*self::Weapon_Labor_Value())/((1-self::Weapon_Attenuation_Parameter($quality)/2)*pow(self::Weapon_Payback_Period($quality),2))/round(1.1714+0.0286*$quality,3),4))*(1+0.1*round(sin(self::Weapon_Labor_Value()),2)); + } + + //英雄回本周期(参数单位:天) + public static function Hero_Payback_Period($quality){ + //ROUND(-0.019*英雄阶数^3+0.1884*英雄阶数^2+11.685*英雄阶数+48.765,0) + return round(-0.019*pow($quality,3)+0.1884*pow($quality,2)+11.685*$quality+48.765,0); + } + + //英雄衰减参数 + public static function Hero_Attenuation_Parameter($quality){ + //ROUND(-0.000015*英雄阶数^3+0.0008*英雄阶数^2-0.02325*英雄阶数+0.606,3) + return round(-0.000015*pow($quality,3)+0.0008*pow($quality,2)-0.02325*$quality+0.606,3); + } + + //枪械回本周期(参数单位:天) + public static function Weapon_Payback_Period($quality){ + //ROUND(-0.019*武器阶数^3+0.1884*武器阶数^2+11.685*武器阶数+48.765,0) + return round(-0.019*pow($quality,3)+0.1884*pow($quality,2)+11.685*$quality+48.765,0); + } + + //枪械衰减参数 + public static function Weapon_Attenuation_Parameter($quality){ + //ROUND(-0.000015*武器阶数^3+0.0008*武器阶数^2-0.02325*武器阶数+0.606,3) + return round(-0.000015*pow($quality,3)+0.0008*pow($quality,2)-0.02325*$quality+0.606,3); + } }