diff --git a/hwe/sammo/Command/General/che_탈취.php b/hwe/sammo/Command/General/che_탈취.php index 65e93ba4..d5ec1885 100644 --- a/hwe/sammo/Command/General/che_탈취.php +++ b/hwe/sammo/Command/General/che_탈취.php @@ -1,99 +1,100 @@ -generalObj; - $nationID = $general->getNationID(); - $date = $general->getTurnTime($general::TURNTIME_HM); - - $logger = $general->getLogger(); - - $destCity = $this->destCity; - - $destCityName = $destCity['name']; - $destCityID = $destCity['city']; - $destNationID = $destCity['nation']; - - $commandName = $this->getName(); - $db = DB::db(); - - // 탈취 최대 400 * 8 - $gold = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level']; - $rice = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level']; - - if($destCity['supply']){ - [$destNationGold, $destNationRice] = $db->queryFirstList('SELECT gold,rice FROM nation WHERE nation=%i', $destNationID); - - $destNationGold -= $gold; - $destNationRice -= $rice; - - if($destNationGold < GameConst::$minNationalGold) { - $gold += $destNationGold - GameConst::$minNationalGold; - $destNationGold = GameConst::$minNationalGold; - } - if($destNationRice < GameConst::$minNationalRice) { - $rice += $destNationRice - GameConst::$minNationalRice; - $destNationRice = GameConst::$minNationalRice; - } - - $db->update('nation', [ - 'gold'=>$destNationGold, - 'rice'=>$destNationRice - ], 'nation=%i', $destNationID); - $db->update('city', [ - 'state'=>34 - ], 'city=%i', $destCityID); - } - else{ - $db->update('city', [ - 'comm'=>Util::valueFit($destCity['comm'] - $gold / 12, 0), - 'agri'=>Util::valueFit($destCity['agri'] - $rice / 12, 0), - 'state'=>34 - ], 'city=%i', $destCityID); - } - - // 본국으로 일부 회수, 재야이면 본인이 전량 소유 - if($nationID != 0) { - $db->update('nation', [ - 'gold' => $db->sqleval('gold + %i', Util::round($gold * 0.7)), - 'rice' => $db->sqleval('rice + %i', Util::round($rice * 0.7)) - ], 'nation=%i', $nationID); - $general->increaseVar('gold', $gold - Util::round($gold * 0.7)); - $general->increaseVar('rice', $rice - Util::round($rice * 0.7)); - } else { - $general->increaseVar('gold', $gold); - $general->increaseVar('rice', $rice); - } - - $db->update('city', [ - 'state'=>32, - 'agri'=>$destCity['agri'], - 'comm'=>$destCity['comm'] - ], 'city=%i', $destCityID); - - $goldText = number_format($gold); - $riceText = number_format($rice); - - $josaYi = JosaUtil::pick($destCityName, '이'); - $logger->pushGlobalActionLog("{$destCityName}에서 금과 쌀을 도둑맞았습니다."); - $josaYi = JosaUtil::pick($commandName, '이'); - $logger->pushGeneralActionLog("{$destCityName}에 {$commandName}{$josaYi} 성공했습니다. <1>$date"); - - $logger->pushGeneralActionLog("금{$goldText} 쌀{$riceText}을 획득했습니다.", ActionLogger::PLAIN); - } - +generalObj; + $nationID = $general->getNationID(); + $date = $general->getTurnTime($general::TURNTIME_HM); + + $logger = $general->getLogger(); + + $destCity = $this->destCity; + + $destCityName = $destCity['name']; + $destCityID = $destCity['city']; + $destNationID = $destCity['nation']; + + $commandName = $this->getName(); + $db = DB::db(); + + // 탈취 최대 800 * 8 * sqrt(1 + (year - startyear) / 5) / 2 + $yearCoef = sqrt(1 + ($this->env['year'] - $this->env['startyear']) / 5) / 2; + $gold = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level'] * $yearCoef; + $rice = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level'] * $yearCoef; + + if($destCity['supply']){ + [$destNationGold, $destNationRice] = $db->queryFirstList('SELECT gold,rice FROM nation WHERE nation=%i', $destNationID); + + $destNationGold -= $gold; + $destNationRice -= $rice; + + if($destNationGold < GameConst::$minNationalGold) { + $gold += $destNationGold - GameConst::$minNationalGold; + $destNationGold = GameConst::$minNationalGold; + } + if($destNationRice < GameConst::$minNationalRice) { + $rice += $destNationRice - GameConst::$minNationalRice; + $destNationRice = GameConst::$minNationalRice; + } + + $db->update('nation', [ + 'gold'=>$destNationGold, + 'rice'=>$destNationRice + ], 'nation=%i', $destNationID); + $db->update('city', [ + 'state'=>34 + ], 'city=%i', $destCityID); + } + else{ + $db->update('city', [ + 'comm'=>Util::valueFit($destCity['comm'] - $gold / 12, 0), + 'agri'=>Util::valueFit($destCity['agri'] - $rice / 12, 0), + 'state'=>34 + ], 'city=%i', $destCityID); + } + + // 본국으로 일부 회수, 재야이면 본인이 전량 소유 + if($nationID != 0) { + $db->update('nation', [ + 'gold' => $db->sqleval('gold + %i', Util::round($gold * 0.7)), + 'rice' => $db->sqleval('rice + %i', Util::round($rice * 0.7)) + ], 'nation=%i', $nationID); + $general->increaseVar('gold', $gold - Util::round($gold * 0.7)); + $general->increaseVar('rice', $rice - Util::round($rice * 0.7)); + } else { + $general->increaseVar('gold', $gold); + $general->increaseVar('rice', $rice); + } + + $db->update('city', [ + 'state'=>32, + 'agri'=>$destCity['agri'], + 'comm'=>$destCity['comm'] + ], 'city=%i', $destCityID); + + $goldText = number_format($gold); + $riceText = number_format($rice); + + $josaYi = JosaUtil::pick($destCityName, '이'); + $logger->pushGlobalActionLog("{$destCityName}에서 금과 쌀을 도둑맞았습니다."); + $josaYi = JosaUtil::pick($commandName, '이'); + $logger->pushGeneralActionLog("{$destCityName}에 {$commandName}{$josaYi} 성공했습니다. <1>$date"); + + $logger->pushGeneralActionLog("금{$goldText} 쌀{$riceText}을 획득했습니다.", ActionLogger::PLAIN); + } + } \ No newline at end of file diff --git a/hwe/sammo/GameConstBase.php b/hwe/sammo/GameConstBase.php index e8fa36dc..fcc5cfd0 100644 --- a/hwe/sammo/GameConstBase.php +++ b/hwe/sammo/GameConstBase.php @@ -48,7 +48,7 @@ class GameConstBase /** @var int 계략시 최소 수치 감소량*/ public static $sabotageDamageMin = 100; /** @var int 계략시 최대 수치 감소량*/ - public static $sabotageDamageMax = 500; + public static $sabotageDamageMax = 800; /** @var string 기본 배경색깔 푸른색*/ public static $basecolor = "#000044"; /** @var string 기본 배경색깔 초록색*/