diff --git a/hwe/b_troop.php b/hwe/b_troop.php
index 32a06e34..cd632b1b 100644
--- a/hwe/b_troop.php
+++ b/hwe/b_troop.php
@@ -88,47 +88,14 @@ uasort($troops, function($lhs, $rhs){
=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
=WebUtil::printJS('js/common.js')?>
+=WebUtil::printJS('js/troop.js')?>
=WebUtil::printJS('js/ext.plugin_troop.js')?>
=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
=WebUtil::printCSS('../d_shared/common.css')?>
=WebUtil::printCSS('css/common.css')?>
=WebUtil::printCSS('css/troops.css')?>
@@ -150,9 +117,9 @@ $('.submitBtn').click(function(event){
|
-
+
-
+
|
@@ -181,7 +148,7 @@ foreach ($troops as $troopNo=>$troop) {
- | '> |
+ |
=$troop['name']?> 【 =$cityText?> 】 |
");background-size:64px;'> |
=$genlistText?> |
@@ -208,7 +175,7 @@ foreach ($troops as $troopNo=>$troop) {
-
+
=$troopLeader['turnText']?>
@@ -229,11 +196,11 @@ foreach ($troops as $troopNo=>$troop) {
diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php
index 388ba355..bcd8dbee 100644
--- a/hwe/func_gamerule.php
+++ b/hwe/func_gamerule.php
@@ -501,7 +501,7 @@ function postUpdateMonthly() {
//5,6 기간 끝나면 합병
checkSurrender();
//초반이후 방랑군 자동 해체
- if($admin['year'] >= $admin['startyear']+3) {
+ if($admin['year'] >= $admin['startyear']+2) {
checkWander();
}
// 작위 업데이트
diff --git a/hwe/j_troop.php b/hwe/j_troop.php
index 88fc5900..465f87a0 100644
--- a/hwe/j_troop.php
+++ b/hwe/j_troop.php
@@ -85,7 +85,7 @@ if($action == '부대추방'){
$db->update('general', [
'troop'=>0
- ], 'no=%i AND troop_leader = %i', $gen, $generalID);
+ ], 'no=%i AND troop = %i', $gen, $generalID);
if($db->affectedRows() == 0){
Json::die([
diff --git a/hwe/js/troop.js b/hwe/js/troop.js
new file mode 100644
index 00000000..90241fb4
--- /dev/null
+++ b/hwe/js/troop.js
@@ -0,0 +1,111 @@
+jQuery(function($){
+ //btnJoinTroop, btnLeaveTroop, btnKickTroop, btnCreateTroop, btnChangeTroopName
+ $('#btnLeaveTroop').click(function(e){
+ if(!confirm("정말 부대를 탈퇴하시겠습니까?")){
+ return false;
+ }
+ $.post({
+ url:'j_troop.php',
+ dataType:'json',
+ data:{
+ action:'부대탈퇴'
+ }
+ }).then(function(data){
+ console.log(data);
+ if(!data.result){
+ alert(data.reason);
+ location.reload();
+ }
+
+ location.reload();
+
+ }, errUnknown);
+ return false;
+ });
+
+ $('#btnCreateTroop').click(function(e){
+ $.post({
+ url:'j_troop.php',
+ dataType:'json',
+ data:{
+ action:'부대창설',
+ name:$('#nameplate').val()
+ }
+ }).then(function(data){
+ console.log(data);
+ if(!data.result){
+ alert(data.reason);
+ location.reload();
+ }
+
+ location.reload();
+
+ }, errUnknown);
+ return false;
+ });
+
+ $('#btnChangeTroopName').click(function(e){
+ $.post({
+ url:'j_troop.php',
+ dataType:'json',
+ data:{
+ action:'부대변경',
+ name:$('#nameplate').val()
+ }
+ }).then(function(data){
+ console.log(data);
+ if(!data.result){
+ alert(data.reason);
+ location.reload();
+ }
+
+ location.reload();
+
+ }, errUnknown);
+ return false;
+ });
+
+ $('#btnKickTroop').click(function(e){
+ $.post({
+ url:'j_troop.php',
+ dataType:'json',
+ data:{
+ action:'부대추방',
+ gen:$('#genNo').val()
+ }
+ }).then(function(data){
+ console.log(data);
+ if(!data.result){
+ alert(data.reason);
+ location.reload();
+ }
+
+ location.reload();
+
+ }, errUnknown);
+ return false;
+ });
+
+ $('#btnJoinTroop').click(function(e){
+ $.post({
+ url:'j_troop.php',
+ dataType:'json',
+ data:{
+ action:'부대가입',
+ troop:$('.troopId:checked').val()
+ }
+ }).then(function(data){
+ console.log(data);
+ if(!data.result){
+ alert(data.reason);
+ location.reload();
+ }
+
+ location.reload();
+
+ }, errUnknown);
+ return false;
+ });
+
+
+});
\ No newline at end of file
diff --git a/hwe/sammo/ActionSpecialWar/che_격노.php b/hwe/sammo/ActionSpecialWar/che_격노.php
index e7720f69..116e86e1 100644
--- a/hwe/sammo/ActionSpecialWar/che_격노.php
+++ b/hwe/sammo/ActionSpecialWar/che_격노.php
@@ -17,9 +17,7 @@ class che_격노 extends \sammo\BaseSpecial{
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
- SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH,
- SpecialityHelper::STAT_INTEL
];
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
diff --git a/hwe/sammo/ActionSpecialWar/che_견고.php b/hwe/sammo/ActionSpecialWar/che_견고.php
index fe994290..2b85253b 100644
--- a/hwe/sammo/ActionSpecialWar/che_견고.php
+++ b/hwe/sammo/ActionSpecialWar/che_견고.php
@@ -17,7 +17,6 @@ class che_견고 extends \sammo\BaseSpecial{
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
- SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH
];
diff --git a/hwe/sammo/ActionSpecialWar/che_공성.php b/hwe/sammo/ActionSpecialWar/che_공성.php
index 9b60bfd7..96e56757 100644
--- a/hwe/sammo/ActionSpecialWar/che_공성.php
+++ b/hwe/sammo/ActionSpecialWar/che_공성.php
@@ -17,8 +17,6 @@ class che_공성 extends \sammo\BaseSpecial{
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_SIEGE,
- SpecialityHelper::STAT_STRENGTH | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_SIEGE,
- SpecialityHelper::STAT_INTEL | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_SIEGE,
];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
diff --git a/hwe/sammo/ActionSpecialWar/che_돌격.php b/hwe/sammo/ActionSpecialWar/che_돌격.php
index bf0662f2..b13f896e 100644
--- a/hwe/sammo/ActionSpecialWar/che_돌격.php
+++ b/hwe/sammo/ActionSpecialWar/che_돌격.php
@@ -17,7 +17,6 @@ class che_돌격 extends \sammo\BaseSpecial{
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
- SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH
];
diff --git a/hwe/sammo/ActionSpecialWar/che_무쌍.php b/hwe/sammo/ActionSpecialWar/che_무쌍.php
index 76f803ad..d2852e11 100644
--- a/hwe/sammo/ActionSpecialWar/che_무쌍.php
+++ b/hwe/sammo/ActionSpecialWar/che_무쌍.php
@@ -14,7 +14,6 @@ class che_무쌍 extends \sammo\BaseSpecial{
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
- SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH
];
diff --git a/hwe/sammo/ActionSpecialWar/che_위압.php b/hwe/sammo/ActionSpecialWar/che_위압.php
index d1b15dbb..4f3b0408 100644
--- a/hwe/sammo/ActionSpecialWar/che_위압.php
+++ b/hwe/sammo/ActionSpecialWar/che_위압.php
@@ -17,7 +17,6 @@ class che_위압 extends \sammo\BaseSpecial{
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
- SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH
];
diff --git a/hwe/sammo/BaseWarUnitTrigger.php b/hwe/sammo/BaseWarUnitTrigger.php
index 8e7d980e..cfdfa03c 100644
--- a/hwe/sammo/BaseWarUnitTrigger.php
+++ b/hwe/sammo/BaseWarUnitTrigger.php
@@ -97,7 +97,7 @@ abstract class BaseWarUnitTrigger extends ObjectTrigger{
$self->activateSkill('아이템소모');
$josaUl = JosaUtil::pick($itemRawName, '을');
$self->getLogger()->pushGeneralActionLog("{$itemName}>{$josaUl} 사용!", ActionLogger::PLAIN);
- $self->general->deleteItem();
+ $self->getGeneral()->deleteItem();
return true;
}
diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php
index 162c704f..422c8862 100644
--- a/hwe/sammo/Command/General/che_징병.php
+++ b/hwe/sammo/Command/General/che_징병.php
@@ -208,6 +208,7 @@ class che_징병 extends Command\GeneralCommand{
$general->increaseVar('leadership_exp', 1);
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
+ $general->setAuxVar('armType', $currCrewType->armType);
tryUniqueItemLottery($general);
$general->applyDB($db);
diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php
index 9d6e737c..e0c01119 100644
--- a/hwe/sammo/GeneralAI.php
+++ b/hwe/sammo/GeneralAI.php
@@ -2120,13 +2120,30 @@ class GeneralAI
$db = DB::db();
- $dex = [
- GameUnitConst::T_FOOTMAN => sqrt($general->getVar('dex1') + 500),
- GameUnitConst::T_ARCHER => sqrt($general->getVar('dex2') + 500),
- GameUnitConst::T_CAVALRY => sqrt($general->getVar('dex3') + 500),
- GameUnitConst::T_WIZARD => sqrt($general->getVar('dex4') + 500),
- GameUnitConst::T_SIEGE => sqrt($general->getVar('dex5') + 500),
- ];
+ $armType =$general->getAuxVar('armType');
+ if(!$armType){
+
+ $dex = [
+ GameUnitConst::T_FOOTMAN => sqrt($general->getVar('dex1') + 500),
+ GameUnitConst::T_ARCHER => sqrt($general->getVar('dex2') + 500),
+ GameUnitConst::T_CAVALRY => sqrt($general->getVar('dex3') + 500),
+ GameUnitConst::T_WIZARD => sqrt($general->getVar('dex4') + 500),
+ GameUnitConst::T_SIEGE => sqrt($general->getVar('dex5') + 500),
+ ];
+
+ $availableArmType = [];
+ if($genType & self::t무장){
+ $availableArmType[GameUnitConst::T_FOOTMAN] = $dex[GameUnitConst::T_FOOTMAN] * $this->fullStrength;
+ $availableArmType[GameUnitConst::T_ARCHER] = $dex[GameUnitConst::T_ARCHER] * $this->fullStrength;
+ $availableArmType[GameUnitConst::T_CAVALRY] = $dex[GameUnitConst::T_CAVALRY] * $this->fullStrength;
+ }
+ if($genType & self::t지장){
+ $availableArmType[GameUnitConst::T_WIZARD] = $dex[GameUnitConst::T_WIZARD] * $this->fullIntel * 3;
+ }
+ $armType = Util::choiceRandomUsingWeight($availableArmType);
+ }
+
+
$cities = [];
@@ -2139,38 +2156,15 @@ class GeneralAI
$relYear = Util::valueFit($env['year'] - $env['startyear'], 0);
- $typesAll = [];
- if ($genType & self::t무장) {
- $types = [];
-
- $unitType = Util::getKeyOfMaxValue([
- GameUnitConst::T_FOOTMAN => $dex[GameUnitConst::T_FOOTMAN] + Util::randRangeInt(0, 50),
- GameUnitConst::T_ARCHER => $dex[GameUnitConst::T_ARCHER] + Util::randRangeInt(0, 50),
- GameUnitConst::T_CAVALRY => $dex[GameUnitConst::T_CAVALRY] + Util::randRangeInt(0, 50),
- ]);
-
- foreach (GameUnitConst::byType($unitType) as $crewtype) {
- if ($crewtype->isValid($cities, $regions, $relYear, $tech)) {
- $score = $dex[$unitType] * $crewtype->pickScore($tech);
- $types[] = [$crewtype->id, $score];
- }
+ $types = [];
+ foreach (GameUnitConst::byType($armType) as $crewtype) {
+ if ($crewtype->isValid($cities, $regions, $relYear, $tech)) {
+ $score = $crewtype->pickScore($tech);
+ $types[] = [$crewtype->id, $score];
}
}
- if ($genType & self::t지장) {
- $types = [];
- foreach (GameUnitConst::byType(GameUnitConst::T_WIZARD) as $crewtype) {
- if ($crewtype->isValid($cities, $regions, $relYear, $tech)) {
- $score = $dex[GameUnitConst::T_WIZARD] * $crewtype->pickScore($tech);
- $types[] = [$crewtype->id, $score];
- }
- }
- foreach ($types as [$crewtype, $score]) {
- $typesAll[$crewtype] = [$crewtype, $score / count($types)];
- }
- }
-
- if ($typesAll) {
+ if ($types) {
$type = Util::choiceRandomUsingWeightPair($types);
} else {
$type = GameUnitConst::DEFAULT_CREWTYPE;
@@ -2178,7 +2172,7 @@ class GeneralAI
if($this->generalPolicy->can고급병종){
$currType = $general->getCrewTypeObj()->id;
- if(key_exists($currType, $typesAll) && $typesAll[$currType][1] >= $typesAll[$type][1]){
+ if(key_exists($currType, $types) && $types[$currType][1] >= $types[$type][1]){
$type = $currType;
}
}
@@ -2212,7 +2206,7 @@ class GeneralAI
'amount' => $crew
]);
}
- else if($gold < $cost){
+ else if($gold < $cost && $gold * 2 >= $cost){
$crew *= $gold / $cost;
$crew = Util::round($crew-49, -2);
$cmd = buildGeneralCommandClass('che_징병', $general, $env, [
diff --git a/hwe/sammo/SpecialityHelper.php b/hwe/sammo/SpecialityHelper.php
index c633bb0a..253820a1 100644
--- a/hwe/sammo/SpecialityHelper.php
+++ b/hwe/sammo/SpecialityHelper.php
@@ -78,17 +78,31 @@ class SpecialityHelper{
$leadership = $general['leadership']??50;
$strength = $general['strength']??50;
$intel = $general['intel']??50;
-
- if ($leadership * 0.95 > $strength && $leadership * 0.95 > $intel) {
+
+ if($leadership > GameConst::$chiefStatMin){
$myCond |= self::STAT_LEADERSHIP;
}
- else if($strength >= $intel){
+
+ if($strength >= $intel * 0.95 && $strength > GameConst::$chiefStatMin){
$myCond |= self::STAT_STRENGTH;
}
- else {
+
+ if($intel >= $strength * 0.95 && $intel > GameConst::$chiefStatMin){
$myCond |= self::STAT_INTEL;
}
+ if($myCond === 0){
+ if ($leadership * 0.9 > $strength && $leadership * 0.9 > $intel) {
+ $myCond |= self::STAT_LEADERSHIP;
+ }
+ else if($strength >= $intel){
+ $myCond |= self::STAT_STRENGTH;
+ }
+ else {
+ $myCond |= self::STAT_INTEL;
+ }
+ }
+
return $myCond;
}
@@ -116,7 +130,7 @@ class SpecialityHelper{
return array_rand($dex);
}
- return array_keys($dex, max($dex))[0];
+ return Util::choiceRandom(array_keys($dex, max($dex)));
}
/** @return BaseSpecial[] */
@@ -222,6 +236,7 @@ class SpecialityHelper{
$myCond = static::calcCondGeneric($general);
$myCond |= static::calcCondDexterity($general);
+ $myCond |= static::REQ_DEXTERITY;
foreach(static::getSpecialWarList() as $specialID=>$specialObj){
$conds = $specialObj::$type;
diff --git a/hwe/sammo/WarUnitGeneral.php b/hwe/sammo/WarUnitGeneral.php
index 46c65d0e..9fa9dabe 100644
--- a/hwe/sammo/WarUnitGeneral.php
+++ b/hwe/sammo/WarUnitGeneral.php
@@ -56,6 +56,10 @@ class WarUnitGeneral extends WarUnit{
}
}
+ function addBonusPhase(int $cnt){
+ $this->bonusPhase += $cnt;
+ }
+
function getMaxPhase():int{
$phase = $this->getCrewType()->speed;
$phase = $this->general->onCalcStat($this->general, 'initWarPhase', $phase);
diff --git a/hwe/sammo/WarUnitTrigger/che_격노발동.php b/hwe/sammo/WarUnitTrigger/che_격노발동.php
index e6f68544..812a9a51 100644
--- a/hwe/sammo/WarUnitTrigger/che_격노발동.php
+++ b/hwe/sammo/WarUnitTrigger/che_격노발동.php
@@ -17,6 +17,8 @@ class che_격노발동 extends BaseWarUnitTrigger{
return true;
}
+ /** @var WarUnitGeneral $self */
+
$targetAct = $oppose->hasActivatedSkill('필살')?'필살 공격':'회피 시도';
$is진노 = $self->hasActivatedSkill('진노');
$reaction = $is진노?'진노':'격노';
@@ -25,7 +27,7 @@ class che_격노발동 extends BaseWarUnitTrigger{
$oppose->getLogger()->pushGeneralBattleDetailLog("{$targetAct}에 상대가 {$reaction}>했다!>", ActionLogger::PLAIN);
if($is진노){
- $self->bonusPhase += 1;
+ $self->addBonusPhase(1);
}
$self->multiplyWarPowerMultiply($self->criticalDamage());
diff --git a/hwe/sammo/WarUnitTrigger/che_저격발동.php b/hwe/sammo/WarUnitTrigger/che_저격발동.php
index 26805880..a1c0eed0 100644
--- a/hwe/sammo/WarUnitTrigger/che_저격발동.php
+++ b/hwe/sammo/WarUnitTrigger/che_저격발동.php
@@ -22,7 +22,7 @@ class che_저격발동 extends BaseWarUnitTrigger{
}
$selfEnv['저격발동'] = true;
- $general = $self->general;
+ $general = $self->getGeneral();
$oppose->getLogger()->pushGeneralActionLog("상대를 저격>했다!", ActionLogger::PLAIN);
$oppose->getLogger()->pushGeneralBattleDetailLog("상대를 저격>했다!", ActionLogger::PLAIN);
diff --git a/src/run_daemon.py b/src/run_daemon.py
index 9a8b192f..8c298979 100644
--- a/src/run_daemon.py
+++ b/src/run_daemon.py
@@ -51,13 +51,13 @@ def main():
for resetPath in autoResetList:
future = executor.submit(run, resetPath)
waiters.append(future)
- for idx in range(4):
+ for idx in range(10):
for webPath in servList:
future = executor.submit(run, webPath)
waiters.append(future)
- if idx == 3:
+ if idx == 9:
break
- time.sleep(15)
+ time.sleep(6)
for future in waiters:
future.done()