계략 강화, 탈취량 시간에 따라 증가
This commit is contained in:
@@ -1,99 +1,100 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace sammo\Command\General;
|
namespace sammo\Command\General;
|
||||||
|
|
||||||
use \sammo\{
|
use \sammo\{
|
||||||
DB, Util, JosaUtil,
|
DB, Util, JosaUtil,
|
||||||
General,
|
General,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst, GameUnitConst,
|
GameConst, GameUnitConst,
|
||||||
Command
|
Command
|
||||||
};
|
};
|
||||||
|
|
||||||
class che_탈취 extends che_화계{
|
class che_탈취 extends che_화계{
|
||||||
static protected $actionName = '탈취';
|
static protected $actionName = '탈취';
|
||||||
|
|
||||||
static protected $statType = 'strength';
|
static protected $statType = 'strength';
|
||||||
static protected $injuryGeneral = false;
|
static protected $injuryGeneral = false;
|
||||||
|
|
||||||
protected function affectDestCity(int $injuryCount){
|
protected function affectDestCity(int $injuryCount){
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
$nationID = $general->getNationID();
|
$nationID = $general->getNationID();
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
$destCity = $this->destCity;
|
$destCity = $this->destCity;
|
||||||
|
|
||||||
$destCityName = $destCity['name'];
|
$destCityName = $destCity['name'];
|
||||||
$destCityID = $destCity['city'];
|
$destCityID = $destCity['city'];
|
||||||
$destNationID = $destCity['nation'];
|
$destNationID = $destCity['nation'];
|
||||||
|
|
||||||
$commandName = $this->getName();
|
$commandName = $this->getName();
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
// 탈취 최대 400 * 8
|
// 탈취 최대 800 * 8 * sqrt(1 + (year - startyear) / 5) / 2
|
||||||
$gold = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level'];
|
$yearCoef = sqrt(1 + ($this->env['year'] - $this->env['startyear']) / 5) / 2;
|
||||||
$rice = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level'];
|
$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);
|
if($destCity['supply']){
|
||||||
|
[$destNationGold, $destNationRice] = $db->queryFirstList('SELECT gold,rice FROM nation WHERE nation=%i', $destNationID);
|
||||||
$destNationGold -= $gold;
|
|
||||||
$destNationRice -= $rice;
|
$destNationGold -= $gold;
|
||||||
|
$destNationRice -= $rice;
|
||||||
if($destNationGold < GameConst::$minNationalGold) {
|
|
||||||
$gold += $destNationGold - GameConst::$minNationalGold;
|
if($destNationGold < GameConst::$minNationalGold) {
|
||||||
$destNationGold = GameConst::$minNationalGold;
|
$gold += $destNationGold - GameConst::$minNationalGold;
|
||||||
}
|
$destNationGold = GameConst::$minNationalGold;
|
||||||
if($destNationRice < GameConst::$minNationalRice) {
|
}
|
||||||
$rice += $destNationRice - GameConst::$minNationalRice;
|
if($destNationRice < GameConst::$minNationalRice) {
|
||||||
$destNationRice = GameConst::$minNationalRice;
|
$rice += $destNationRice - GameConst::$minNationalRice;
|
||||||
}
|
$destNationRice = GameConst::$minNationalRice;
|
||||||
|
}
|
||||||
$db->update('nation', [
|
|
||||||
'gold'=>$destNationGold,
|
$db->update('nation', [
|
||||||
'rice'=>$destNationRice
|
'gold'=>$destNationGold,
|
||||||
], 'nation=%i', $destNationID);
|
'rice'=>$destNationRice
|
||||||
$db->update('city', [
|
], 'nation=%i', $destNationID);
|
||||||
'state'=>34
|
$db->update('city', [
|
||||||
], 'city=%i', $destCityID);
|
'state'=>34
|
||||||
}
|
], 'city=%i', $destCityID);
|
||||||
else{
|
}
|
||||||
$db->update('city', [
|
else{
|
||||||
'comm'=>Util::valueFit($destCity['comm'] - $gold / 12, 0),
|
$db->update('city', [
|
||||||
'agri'=>Util::valueFit($destCity['agri'] - $rice / 12, 0),
|
'comm'=>Util::valueFit($destCity['comm'] - $gold / 12, 0),
|
||||||
'state'=>34
|
'agri'=>Util::valueFit($destCity['agri'] - $rice / 12, 0),
|
||||||
], 'city=%i', $destCityID);
|
'state'=>34
|
||||||
}
|
], 'city=%i', $destCityID);
|
||||||
|
}
|
||||||
// 본국으로 일부 회수, 재야이면 본인이 전량 소유
|
|
||||||
if($nationID != 0) {
|
// 본국으로 일부 회수, 재야이면 본인이 전량 소유
|
||||||
$db->update('nation', [
|
if($nationID != 0) {
|
||||||
'gold' => $db->sqleval('gold + %i', Util::round($gold * 0.7)),
|
$db->update('nation', [
|
||||||
'rice' => $db->sqleval('rice + %i', Util::round($rice * 0.7))
|
'gold' => $db->sqleval('gold + %i', Util::round($gold * 0.7)),
|
||||||
], 'nation=%i', $nationID);
|
'rice' => $db->sqleval('rice + %i', Util::round($rice * 0.7))
|
||||||
$general->increaseVar('gold', $gold - Util::round($gold * 0.7));
|
], 'nation=%i', $nationID);
|
||||||
$general->increaseVar('rice', $rice - Util::round($rice * 0.7));
|
$general->increaseVar('gold', $gold - Util::round($gold * 0.7));
|
||||||
} else {
|
$general->increaseVar('rice', $rice - Util::round($rice * 0.7));
|
||||||
$general->increaseVar('gold', $gold);
|
} else {
|
||||||
$general->increaseVar('rice', $rice);
|
$general->increaseVar('gold', $gold);
|
||||||
}
|
$general->increaseVar('rice', $rice);
|
||||||
|
}
|
||||||
$db->update('city', [
|
|
||||||
'state'=>32,
|
$db->update('city', [
|
||||||
'agri'=>$destCity['agri'],
|
'state'=>32,
|
||||||
'comm'=>$destCity['comm']
|
'agri'=>$destCity['agri'],
|
||||||
], 'city=%i', $destCityID);
|
'comm'=>$destCity['comm']
|
||||||
|
], 'city=%i', $destCityID);
|
||||||
$goldText = number_format($gold);
|
|
||||||
$riceText = number_format($rice);
|
$goldText = number_format($gold);
|
||||||
|
$riceText = number_format($rice);
|
||||||
$josaYi = JosaUtil::pick($destCityName, '이');
|
|
||||||
$logger->pushGlobalActionLog("<G><b>{$destCityName}</b></>에서 금과 쌀을 도둑맞았습니다.");
|
$josaYi = JosaUtil::pick($destCityName, '이');
|
||||||
$josaYi = JosaUtil::pick($commandName, '이');
|
$logger->pushGlobalActionLog("<G><b>{$destCityName}</b></>에서 금과 쌀을 도둑맞았습니다.");
|
||||||
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>에 {$commandName}{$josaYi} 성공했습니다. <1>$date</>");
|
$josaYi = JosaUtil::pick($commandName, '이');
|
||||||
|
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>에 {$commandName}{$josaYi} 성공했습니다. <1>$date</>");
|
||||||
$logger->pushGeneralActionLog("금<C>{$goldText}</> 쌀<C>{$riceText}</>을 획득했습니다.", ActionLogger::PLAIN);
|
|
||||||
}
|
$logger->pushGeneralActionLog("금<C>{$goldText}</> 쌀<C>{$riceText}</>을 획득했습니다.", ActionLogger::PLAIN);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ class GameConstBase
|
|||||||
/** @var int 계략시 최소 수치 감소량*/
|
/** @var int 계략시 최소 수치 감소량*/
|
||||||
public static $sabotageDamageMin = 100;
|
public static $sabotageDamageMin = 100;
|
||||||
/** @var int 계략시 최대 수치 감소량*/
|
/** @var int 계략시 최대 수치 감소량*/
|
||||||
public static $sabotageDamageMax = 500;
|
public static $sabotageDamageMax = 800;
|
||||||
/** @var string 기본 배경색깔 푸른색*/
|
/** @var string 기본 배경색깔 푸른색*/
|
||||||
public static $basecolor = "#000044";
|
public static $basecolor = "#000044";
|
||||||
/** @var string 기본 배경색깔 초록색*/
|
/** @var string 기본 배경색깔 초록색*/
|
||||||
|
|||||||
Reference in New Issue
Block a user