전투 버그 수정 중

This commit is contained in:
2019-10-06 02:49:54 +09:00
parent 8a210103c0
commit 70181d95c7
18 changed files with 40 additions and 27 deletions
+3 -3
View File
@@ -121,7 +121,6 @@ for($i=1; $i <= $count; $i++) {
<td align=center>접률</td> <td align=center>접률</td>
<td align=center>단접</td> <td align=center>단접</td>
<td align=center>국력</td> <td align=center>국력</td>
<td align=center>단합</td>
<td align=center>장수</td> <td align=center>장수</td>
<td align=center>속령</td> <td align=center>속령</td>
<td align=center>기술</td> <td align=center>기술</td>
@@ -213,6 +212,7 @@ for($i=0; $i < $nationCount; $i++) {
$query = "select COUNT(*) as cnt, $query = "select COUNT(*) as cnt,
SUM(pop) as pop, SUM(pop2) as pop2, SUM(pop) as pop, SUM(pop2) as pop2,
ROUND(SUM(pop)/SUM(pop2)*100, 2) as rate, ROUND(SUM(pop)/SUM(pop2)*100, 2) as rate,
trust,
ROUND(SUM(agri)/SUM(agri2)*100, 2) as agri, ROUND(SUM(agri)/SUM(agri2)*100, 2) as agri,
ROUND(SUM(comm)/SUM(comm2)*100, 2) as comm, ROUND(SUM(comm)/SUM(comm2)*100, 2) as comm,
ROUND(SUM(secu)/SUM(secu2)*100, 2) as secu, ROUND(SUM(secu)/SUM(secu2)*100, 2) as secu,
@@ -227,7 +227,7 @@ for($i=0; $i < $nationCount; $i++) {
<td align=center style=background-color:{$nation['color']};color:".newColor($nation['color']).";>{$nation['name']}</td> <td align=center style=background-color:{$nation['color']};color:".newColor($nation['color']).";>{$nation['name']}</td>
<td align=center>&nbsp;{$nation['connect']}&nbsp;</td> <td align=center>&nbsp;{$nation['connect']}&nbsp;</td>
<td align=center>&nbsp;{$nation['con']}&nbsp;</td> <td align=center>&nbsp;{$nation['con']}&nbsp;</td>
<td align=center>&nbsp;{$nation['strength']}&nbsp;</td> <td align=center>&nbsp;{$nation['power']}&nbsp;</td>
<td align=center>&nbsp;{$gen['cnt']}&nbsp;</td> <td align=center>&nbsp;{$gen['cnt']}&nbsp;</td>
<td align=center>&nbsp;{$city['cnt']}&nbsp;</td> <td align=center>&nbsp;{$city['cnt']}&nbsp;</td>
<td align=center>&nbsp;{$nation['tech']}&nbsp;</td> <td align=center>&nbsp;{$nation['tech']}&nbsp;</td>
@@ -247,7 +247,7 @@ for($i=0; $i < $nationCount; $i++) {
<td align=center>&nbsp;{$nation['dex40']}&nbsp;</td> <td align=center>&nbsp;{$nation['dex40']}&nbsp;</td>
<td align=center>&nbsp;{$gen['crew']}/{$gen['leadership']}00&nbsp;</td> <td align=center>&nbsp;{$gen['crew']}/{$gen['leadership']}00&nbsp;</td>
<td align=center>&nbsp;{$city['pop']}/{$city['pop2']}&nbsp;</td> <td align=center>&nbsp;{$city['pop']}/{$city['pop2']}&nbsp;</td>
<td align=center>&nbsp;".round($city['trust'],1)."%&nbsp;</td> <td align=center>&nbsp;".round($city['pop']/$city['pop2']*100,1)."%&nbsp;</td>
<td align=center>&nbsp;{$city['agri']}%&nbsp;</td> <td align=center>&nbsp;{$city['agri']}%&nbsp;</td>
<td align=center>&nbsp;{$city['comm']}%&nbsp;</td> <td align=center>&nbsp;{$city['comm']}%&nbsp;</td>
<td align=center>&nbsp;{$city['secu']}%&nbsp;</td> <td align=center>&nbsp;{$city['secu']}%&nbsp;</td>
+2 -2
View File
@@ -17,7 +17,7 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r
'level'=>0, 'level'=>0,
'gold'=>0, 'gold'=>0,
'rice'=>2000, 'rice'=>2000,
'type'=>0, 'type'=>GameConst::$neutralNationType,
'tech'=>0, 'tech'=>0,
'gennum'=>1 'gennum'=>1
]; ];
@@ -108,7 +108,7 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r
'dead' => $db->sqleval('dead + %i', $totalDead * 0.6) 'dead' => $db->sqleval('dead + %i', $totalDead * 0.6)
], 'city=%i', $rawDefenderCity['city']); ], 'city=%i', $rawDefenderCity['city']);
$attackerIncTech = buildNationTypeClass($rawAttackerNation['type'])->onCalacDomestic('기술', 'score', $attacker->getDead() * 0.01); $attackerIncTech = buildNationTypeClass($rawAttackerNation['type'])->onCalcDomestic('기술', 'score', $attacker->getDead() * 0.01);
$defenderIncTech = buildNationTypeClass($rawDefenderNation['type'])->onCalcDomestic('기술', 'score', $attacker->getKilled() * 0.01); $defenderIncTech = buildNationTypeClass($rawDefenderNation['type'])->onCalcDomestic('기술', 'score', $attacker->getKilled() * 0.01);
$attackerGenCnt = $rawAttackerNation['gennum']; $attackerGenCnt = $rawAttackerNation['gennum'];
@@ -6,6 +6,7 @@ use \sammo\SpecialityConst;
use \sammo\WarUnit; use \sammo\WarUnit;
use \sammo\BaseWarUnitTrigger; use \sammo\BaseWarUnitTrigger;
use \sammo\WarUnitTriggerCaller; use \sammo\WarUnitTriggerCaller;
use sammo\WarUnitTrigger\WarActivateSkills;
class che_돌격 implements iAction{ class che_돌격 implements iAction{
use \sammo\DefaultAction; use \sammo\DefaultAction;
+1 -1
View File
@@ -60,7 +60,7 @@ abstract class BaseWarUnitTrigger extends ObjectTrigger{
return $env; return $env;
} }
abstract protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):void; abstract protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool;
public function processConsumableItem():bool{ public function processConsumableItem():bool{
if(!($this->raiseType & static::TYPE_ITEM)){ if(!($this->raiseType & static::TYPE_ITEM)){
+3 -3
View File
@@ -85,10 +85,10 @@ class che_증여 extends Command\GeneralCommand{
ConstraintHelper::FriendlyDestGeneral() ConstraintHelper::FriendlyDestGeneral()
]; ];
if($this->arg['isGold']){ if($this->arg['isGold']){
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralGold(1); $this->runnableConstraints[] = ConstraintHelper::ReqGeneralGold(GameConst::$generalMinimumGold);
} }
else{ else{
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralRice(1); $this->runnableConstraints[] = ConstraintHelper::ReqGeneralRice(GameConst::$generalMinimumRice);
} }
} }
@@ -121,7 +121,7 @@ class che_증여 extends Command\GeneralCommand{
$resName = $isGold?'금':'쌀'; $resName = $isGold?'금':'쌀';
$destGeneral = $this->destGeneralObj; $destGeneral = $this->destGeneralObj;
$amount = Util::valueFit($amount, 0, $general->getVar($resKey)); $amount = Util::valueFit($amount, 0, $general->getVar($resKey) - ($isGold?GameConst::$generalMinimumGold:GameConst::$generalMinimumRice));
$amountText = number_format($amount, 0); $amountText = number_format($amount, 0);
$logger = $general->getLogger(); $logger = $general->getLogger();
+2 -1
View File
@@ -128,7 +128,8 @@ class che_출병 extends Command\GeneralCommand{
$general->applyDB($db); $general->applyDB($db);
//TODO: 장기적으로 통합해야함 //TODO: 장기적으로 통합해야함
processWar($general, $general->getStaticNation(), $this->destCity); $attackerNation = $db->queryFirstRow('SELECT nation, name, color, type, level, capital, tech from nation WHERE nation = %i', $attackerNationID);
processWar($general, $attackerNation, $this->destCity);
tryUniqueItemLottery($general); tryUniqueItemLottery($general);
$general->applyDB($db); $general->applyDB($db);
+2 -2
View File
@@ -65,10 +65,10 @@ class che_헌납 extends Command\GeneralCommand{
ConstraintHelper::SuppliedCity(), ConstraintHelper::SuppliedCity(),
]; ];
if($this->arg['isGold']){ if($this->arg['isGold']){
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralGold(1); $this->runnableConstraints[] = ConstraintHelper::ReqGeneralGold(GameConst::$generalMinimumGold);
} }
else{ else{
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralRice(1); $this->runnableConstraints[] = ConstraintHelper::ReqGeneralRice(GameConst::$generalMinimumRice);
} }
} }
+1 -1
View File
@@ -118,7 +118,7 @@ class che_몰수 extends Command\NationCommand{
$resName = $isGold?'금':'쌀'; $resName = $isGold?'금':'쌀';
$destGeneral = $this->destGeneralObj; $destGeneral = $this->destGeneralObj;
$amount = Util::valueFit($amount, 0, $general->getVar[$resKey]); $amount = Util::valueFit($amount, 0, ($general->getVar[$resKey]- $isGold?GameConst::$generalMinimumGold:GameConst::$generalMinimumRice));
$amountText = number_format($amount, 0); $amountText = number_format($amount, 0);
if($destGeneral->getVar('npc') >= 2 && Util::randBool(0.01)){ if($destGeneral->getVar('npc') >= 2 && Util::randBool(0.01)){
+2 -2
View File
@@ -83,7 +83,7 @@ class che_포상 extends Command\NationCommand{
$this->runnableConstraints[] = ConstraintHelper::ReqNationGold(1); $this->runnableConstraints[] = ConstraintHelper::ReqNationGold(1);
} }
else{ else{
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralRice(1+GameConst::$baserice); $this->runnableConstraints[] = ConstraintHelper::ReqNationRice(1+GameConst::$baserice);
} }
} }
@@ -119,7 +119,7 @@ class che_포상 extends Command\NationCommand{
$resName = $isGold?'금':'쌀'; $resName = $isGold?'금':'쌀';
$destGeneral = $this->destGeneralObj; $destGeneral = $this->destGeneralObj;
$amount = Util::valueFit($amount, 0, $nation[$resKey]); $amount = Util::valueFit($amount, 0, $nation[$resKey] - ($isGold?GameConst::$basegold:GameConst::$baserice));
$amountText = number_format($amount, 0); $amountText = number_format($amount, 0);
$logger = $general->getLogger(); $logger = $general->getLogger();
+9
View File
@@ -9,6 +9,7 @@ class DummyGeneral extends General{
'city'=>0, 'city'=>0,
'nation'=>0, 'nation'=>0,
'level'=>0, 'level'=>0,
'crewtype'=>-1
]; ];
$this->raw = $raw; $this->raw = $raw;
@@ -20,6 +21,14 @@ class DummyGeneral extends General{
} }
} }
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller();
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller();
}
function applyDB($db):bool{ function applyDB($db):bool{
return true; return true;
} }
+3
View File
@@ -98,6 +98,9 @@ class GameConstBase
/** @var int 시작시 쌀 */ /** @var int 시작시 쌀 */
public static $defaultRice = 1000; public static $defaultRice = 1000;
public static $generalMinimumGold = 0;
public static $generalMinimumRice = 500;
/** @var int 최대 턴 */ /** @var int 최대 턴 */
public static $maxTurn = 30; public static $maxTurn = 30;
public static $maxChiefTurn = 12; public static $maxChiefTurn = 12;
-6
View File
@@ -589,9 +589,6 @@ class General implements iAction{
$caller->merge($iObj->getBattleInitSkillTriggerList($unit)); $caller->merge($iObj->getBattleInitSkillTriggerList($unit));
} }
if($caller->isEmpty()){
return null;
}
return $caller; return $caller;
} }
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
@@ -619,9 +616,6 @@ class General implements iAction{
$caller->merge($iObj->getBattlePhaseSkillTriggerList($unit)); $caller->merge($iObj->getBattlePhaseSkillTriggerList($unit));
} }
if($caller->isEmpty()){
return null;
}
return $caller; return $caller;
} }
+2 -2
View File
@@ -281,7 +281,7 @@ class GeneralAI{
} }
$commandList['che_물자조달'] = ( $commandList['che_물자조달'] = (
(GameConst::$minNationalGold + GameConst::$minNationalRice + 10000) / (GameConst::$minNationalGold + GameConst::$minNationalRice + 24*5*$env['develcost']) /
Util::valueFit($nation['gold'] + $nation['rice'], (GameConst::$defaultGold + GameConst::$defaultRice)/2) Util::valueFit($nation['gold'] + $nation['rice'], (GameConst::$defaultGold + GameConst::$defaultRice)/2)
) * 10; ) * 10;
@@ -1435,7 +1435,7 @@ class GeneralAI{
return null; return null;
} }
$frontCities = $db->query('SELECT city, front, officer4 FROM city WHERE nation=%i AND front > 0 AND supply = 1'); $frontCities = $db->query('SELECT city, front, officer4 FROM city WHERE nation=%i AND front > 0 AND supply = 1', $nationID);
if(!$frontCities){ if(!$frontCities){
//접경이 아직 없음 //접경이 아직 없음
+2 -2
View File
@@ -138,7 +138,7 @@ class WarUnit{
} }
function getLogger():ActionLogger{ function getLogger():ActionLogger{
return $this->general->logger; return $this->getGeneral()->getLogger();
} }
function getKilled():int{ function getKilled():int{
@@ -219,7 +219,7 @@ class WarUnit{
$myAtt = $this->getComputedAttack(); $myAtt = $this->getComputedAttack();
$opDef = $oppose->getComputedDefence(); $opDef = $oppose->getComputedDefence();
// 감소할 병사 // 감소할 병사
$warPower = GameConst::$armperphase + $myAtt - $opDef; $warPower = GameConst::$armperphase + $myAtt - $opDef;
$opposeWarPowerMultiply = 1.0; $opposeWarPowerMultiply = 1.0;
+1
View File
@@ -13,6 +13,7 @@ class WarUnitCity extends WarUnit{
$general->setVar('city', $raw['city']); $general->setVar('city', $raw['city']);
$general->setVar('nation', $raw['nation']); $general->setVar('nation', $raw['nation']);
$general->initLogger($year, $month); $general->initLogger($year, $month);
$this->general = $general;
$this->raw = $raw; $this->raw = $raw;
$this->rawNation = $rawNation; $this->rawNation = $rawNation;
@@ -9,7 +9,7 @@ use sammo\Util;
use sammo\ObjectTrigger; use sammo\ObjectTrigger;
class WarActivateSkills extends BaseWarUnitTrigger{ class WarActivateSkills extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_INIT; protected $priority = ObjectTrigger::PRIORITY_BEGIN;
protected $isSelf; protected $isSelf;
protected $activeSkills; protected $activeSkills;
@@ -6,6 +6,7 @@ use sammo\WarUnitCity;
use sammo\WarUnit; use sammo\WarUnit;
use sammo\GameUnitDetail; use sammo\GameUnitDetail;
use sammo\ObjectTrigger; use sammo\ObjectTrigger;
use sammo\Util;
class che_필살시도 extends BaseWarUnitTrigger{ class che_필살시도 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_PRE + 100; protected $priority = ObjectTrigger::PRIORITY_PRE + 100;
@@ -25,7 +26,7 @@ class che_필살시도 extends BaseWarUnitTrigger{
return true; return true;
} }
$this->activateSkill('특수', '필살시도', '필살'); $self->activateSkill('특수', '필살시도', '필살');
return true; return true;
+3
View File
@@ -438,6 +438,9 @@ class Util extends \utilphp\util
*/ */
public static function valueFit($value, $min = null, $max = null) public static function valueFit($value, $min = null, $max = null)
{ {
if($max !== null && $min !== null && $max < $min){
return $min;
}
if ($min !== null && $value < $min) { if ($min !== null && $value < $min) {
return $min; return $min;
} }