버그 수정

This commit is contained in:
2020-04-27 02:07:34 +09:00
parent ad8acaf296
commit e0036ca32b
18 changed files with 186 additions and 100 deletions
+8 -41
View File
@@ -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')?>
<script>
jQuery(function($){
$('#leaveTroop').click(function(e){
return confirm("정말 부대를 탈퇴하시겠습니까?");
})
$('.submitBtn').click(function(event){
if(event.isPropagationStopped()){
return false;
}
var $this=$(this);
$.post({
url:'j_troop.php',
dataType:'json',
data:{
action:$this.val().replace(/\s/g, ''),
troop:$('input.troopId:checked').val(),
name:$('#troopName').val(),
gen:$('#genNo').val()
}
}).then(function(data){
console.log(data);
if(!data.result){
alert(data.reason);
location.reload();
}
location.reload();
}, function(){
alert('알 수 없는 에러가 발생했습니다.');
});
return false;
});
});
</script>
</head>
@@ -150,9 +117,9 @@ $('.submitBtn').click(function(event){
<tfoot><tr><td colspan='5'>
<?php if(!$troops): ?>
<?php elseif($me['troop'] == 0): ?>
<input type=submit class='submitBtn' value='부 대 가 입'>
<input type=button id='btnJoinTroop' value='부 대 가 입'>
<?php else: ?>
<input type=submit id="leaveTroop" class='submitBtn' value='부 대 탈 퇴'>
<input type=button id="btnLeaveTroop" value='부 대 탈 퇴'>
<?php endif;?>
</td></tr></tfoot>
<tbody>
@@ -181,7 +148,7 @@ foreach ($troops as $troopNo=>$troop) {
<?php if ($me['troop'] == 0): ?>
<tr>
<td align=center rowspan=2><input type='radio' class='troopId' name='troop' value='<?=$troop['troop']?>'></td>
<td align=center rowspan=2><input type='radio' class='troopId' name='troop' value='<?=$troopNo?>'></td>
<td align=center><?=$troop['name']?><br>【 <?=$cityText?> 】</td>
<td height=64 class='generalIcon' style='background:no-repeat center url("<?=$troopLeader['pictureFullPath']?>");background-size:64px;'>&nbsp;</td>
<td rowspan=2 width=62><?=$genlistText?></td>
@@ -208,7 +175,7 @@ foreach ($troops as $troopNo=>$troop) {
<option value='<?=$troopUser['no']?>'><?=$troopUser['name']?></option>
<?php endforeach; ?>
</select><br>
<input type=submit class='submitBtn' value='부 대 추 방' style=width:130px;height:25px;>
<input type=button id='btnKickTroop' value='부 대 추 방' style=width:130px;height:25px;>
<?php else: ?>
<?=$troopLeader['turnText']?>
<?php endif; ?>
@@ -229,11 +196,11 @@ foreach ($troops as $troopNo=>$troop) {
<table width=1000 class='tb_layout bg0'>
<tr>
<td width=80 id=bg1>부 대 명</td>
<td width=130><input type=text style=color:white;background-color:black; size=18 maxlength=18 name=name></td>
<td width=130><input type=text style=color:white;background-color:black; size=18 maxlength=18 id='nameplate'></td>
<?php if($me['troop'] == 0): ?>
<td><input type=submit name=btn value='부 대 창 설'></td>
<td><input type=button id='btnCreateTroop' value='부 대 창 설'></td>
<?php else: ?>
<td><input type=submit name=btn value='부 대 변 경'></td>
<td><input type=button id='btnChangeTroopName' value='부 대 변 경'></td>
<?php endif; ?>
</tr>
</table>
+1 -1
View File
@@ -501,7 +501,7 @@ function postUpdateMonthly() {
//5,6 기간 끝나면 합병
checkSurrender();
//초반이후 방랑군 자동 해체
if($admin['year'] >= $admin['startyear']+3) {
if($admin['year'] >= $admin['startyear']+2) {
checkWander();
}
// 작위 업데이트
+1 -1
View File
@@ -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([
+111
View File
@@ -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;
});
});
@@ -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{
@@ -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
];
@@ -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{
@@ -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
];
@@ -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
];
@@ -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
];
+1 -1
View File
@@ -97,7 +97,7 @@ abstract class BaseWarUnitTrigger extends ObjectTrigger{
$self->activateSkill('아이템소모');
$josaUl = JosaUtil::pick($itemRawName, '을');
$self->getLogger()->pushGeneralActionLog("<C>{$itemName}</>{$josaUl} 사용!", ActionLogger::PLAIN);
$self->general->deleteItem();
$self->getGeneral()->deleteItem();
return true;
}
+1
View File
@@ -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);
+32 -38
View File
@@ -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, [
+20 -5
View File
@@ -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;
+4
View File
@@ -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);
@@ -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}에 상대가 <R>{$reaction}</>했다!</>", ActionLogger::PLAIN);
if($is진노){
$self->bonusPhase += 1;
$self->addBonusPhase(1);
}
$self->multiplyWarPowerMultiply($self->criticalDamage());
@@ -22,7 +22,7 @@ class che_저격발동 extends BaseWarUnitTrigger{
}
$selfEnv['저격발동'] = true;
$general = $self->general;
$general = $self->getGeneral();
$oppose->getLogger()->pushGeneralActionLog("상대를 <C>저격</>했다!", ActionLogger::PLAIN);
$oppose->getLogger()->pushGeneralBattleDetailLog("상대를 <C>저격</>했다!", ActionLogger::PLAIN);
+3 -3
View File
@@ -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()