forked from devsam/core
계략 강화, 탈취량 시간에 따라 증가
This commit is contained in:
@@ -1,99 +1,100 @@
|
||||
<?php
|
||||
namespace sammo\Command\General;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
General,
|
||||
ActionLogger,
|
||||
GameConst, GameUnitConst,
|
||||
Command
|
||||
};
|
||||
|
||||
class che_탈취 extends che_화계{
|
||||
static protected $actionName = '탈취';
|
||||
|
||||
static protected $statType = 'strength';
|
||||
static protected $injuryGeneral = false;
|
||||
|
||||
protected function affectDestCity(int $injuryCount){
|
||||
$general = $this->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("<G><b>{$destCityName}</b></>에서 금과 쌀을 도둑맞았습니다.");
|
||||
$josaYi = JosaUtil::pick($commandName, '이');
|
||||
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>에 {$commandName}{$josaYi} 성공했습니다. <1>$date</>");
|
||||
|
||||
$logger->pushGeneralActionLog("금<C>{$goldText}</> 쌀<C>{$riceText}</>을 획득했습니다.", ActionLogger::PLAIN);
|
||||
}
|
||||
|
||||
<?php
|
||||
namespace sammo\Command\General;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
General,
|
||||
ActionLogger,
|
||||
GameConst, GameUnitConst,
|
||||
Command
|
||||
};
|
||||
|
||||
class che_탈취 extends che_화계{
|
||||
static protected $actionName = '탈취';
|
||||
|
||||
static protected $statType = 'strength';
|
||||
static protected $injuryGeneral = false;
|
||||
|
||||
protected function affectDestCity(int $injuryCount){
|
||||
$general = $this->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("<G><b>{$destCityName}</b></>에서 금과 쌀을 도둑맞았습니다.");
|
||||
$josaYi = JosaUtil::pick($commandName, '이');
|
||||
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>에 {$commandName}{$josaYi} 성공했습니다. <1>$date</>");
|
||||
|
||||
$logger->pushGeneralActionLog("금<C>{$goldText}</> 쌀<C>{$riceText}</>을 획득했습니다.", ActionLogger::PLAIN);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 기본 배경색깔 초록색*/
|
||||
|
||||
Reference in New Issue
Block a user