특기 획득 구조 변경

This commit is contained in:
2020-04-26 22:31:49 +09:00
parent 2bb6ef8efb
commit 724c7388af
50 changed files with 545 additions and 543 deletions
+2 -2
View File
@@ -115,12 +115,12 @@ switch($btn) {
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($general['no']), $text, new \DateTime(), new \DateTime('9999-12-31'), []); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($general['no']), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg->send(true); $msg->send(true);
$specialWar = SpecialityConst::pickSpecialWar($general); $specialWar = SpecialityHelper::pickSpecialWar($general);
$db->update('general', [ $db->update('general', [
'specage2'=>$db->sqleval('age'), 'specage2'=>$db->sqleval('age'),
'special2'=>$specialWar 'special2'=>$specialWar
], 'no=%i', $general['no']); ], 'no=%i', $general['no']);
$specialWarName = SpecialityConst::WAR[$specialWar][0]; $specialWarName = buildGeneralSpecialWarClass($specialWar)->getName();
$josaUl = JosaUtil::pick($specialWarName, '을'); $josaUl = JosaUtil::pick($specialWarName, '을');
pushGeneralHistory($general['no'], ["<C>●</>{$year}{$month}월:특기 【<b><C>{$specialWarName}</></b>】{$josaUl} 습득"]); pushGeneralHistory($general['no'], ["<C>●</>{$year}{$month}월:특기 【<b><C>{$specialWarName}</></b>】{$josaUl} 습득"]);
pushGenLog($general['no'], ["<C>●</>특기 【<b><L>{$specialWarName}</></b>】{$josaUl} 익혔습니다!"]); pushGenLog($general['no'], ["<C>●</>특기 【<b><L>{$specialWarName}</></b>】{$josaUl} 익혔습니다!"]);
+1 -1
View File
@@ -280,7 +280,7 @@ foreach($generals as $general){
if($ourGeneral && !$isNPC){ if($ourGeneral && !$isNPC){
$turnText = []; $turnText = [];
$generalObj = new General($general, null, null, null, false); $generalObj = new General($general, null, null, null, null, false);
foreach($generalTurnList[$generalObj->getID()] as $turnRawIdx=>$turn){ foreach($generalTurnList[$generalObj->getID()] as $turnRawIdx=>$turn){
$turnIdx = $turnRawIdx+1; $turnIdx = $turnRawIdx+1;
$turnText[] = "{$turnIdx} : $turn"; $turnText[] = "{$turnIdx} : $turn";
+6 -7
View File
@@ -29,7 +29,7 @@ $startYear = $gameStor->getValue('startyear');
<?=WebUtil::printJS('../e_lib/download2.js')?> <?=WebUtil::printJS('../e_lib/download2.js')?>
<?=WebUtil::printJS('js/common.js')?> <?=WebUtil::printJS('js/common.js')?>
<script> <script>
var defaultSpecialDomestic = <?=GameConst::$defaultSpecialDomestic?>; var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
</script> </script>
<?=WebUtil::printJS('js/battle_simulator.js')?> <?=WebUtil::printJS('js/battle_simulator.js')?>
</head> </head>
@@ -167,7 +167,7 @@ var defaultSpecialDomestic = <?=GameConst::$defaultSpecialDomestic?>;
<select class="custom-select form_nation_type" style="width:25ch;"> <select class="custom-select form_nation_type" style="width:25ch;">
<?php foreach(GameConst::$availableNationType as $typeID): ?> <?php foreach(GameConst::$availableNationType as $typeID): ?>
<?php $nationTypeObj = buildNationTypeClass($typeID) ?> <?php $nationTypeObj = buildNationTypeClass($typeID) ?>
<option value="<?=$typeID?>"><?=$nationTypeObj->name?> (<?=$nationTypeClass::$pros?>, <?=$nationTypeClass::$cons?>)</option> <option value="<?=$typeID?>"><?=$nationTypeObj->getName()?> (<?=$nationTypeObj::$pros?>, <?=$nationTypeObj::$cons?>)</option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<div class="input-group-prepend"> <div class="input-group-prepend">
@@ -339,7 +339,7 @@ var defaultSpecialDomestic = <?=GameConst::$defaultSpecialDomestic?>;
</div> </div>
<select class="custom-select form_crewtype"> <select class="custom-select form_crewtype">
<?php foreach(GameUnitConst::all() as $crewTypeID => $crewType): ?> <?php foreach(GameUnitConst::all() as $crewTypeID => $crewType): ?>
<?php if($crewTypeID < 0){ continue; } ?> <?php if($crewType->armType === GameUnitConst::T_CASTLE){ continue; } ?>
<option value="<?=$crewTypeID?>"><?=$crewType->name?></option> <option value="<?=$crewTypeID?>"><?=$crewType->name?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@@ -351,7 +351,7 @@ var defaultSpecialDomestic = <?=GameConst::$defaultSpecialDomestic?>;
<span class="input-group-text">성격</span> <span class="input-group-text">성격</span>
</div> </div>
<select class="custom-select form_general_character"> <select class="custom-select form_general_character">
<?php foreach(getCharacterList() as $characterID => [$name,$info]): ?> <?php foreach(getCharacterList(false) as $characterID => [$name,$info]): ?>
<option value="<?=$characterID?>"><?=$name?></option> <option value="<?=$characterID?>"><?=$name?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@@ -369,9 +369,8 @@ var defaultSpecialDomestic = <?=GameConst::$defaultSpecialDomestic?>;
<span class="input-group-text">전특</span> <span class="input-group-text">전특</span>
</div> </div>
<select class="custom-select form_general_special_war"> <select class="custom-select form_general_special_war">
<option value="0">-</option> <?php foreach(SpecialityHelper::getSpecialWarList(false) as $specialWarID =>$specialObj): ?>
<?php foreach(SpecialityConst::WAR as $specialWarID => [$name,$buff,$cond]): ?> <option value="<?=$specialWarID?>"><?=$specialObj->getName()?></option>
<option value="<?=$specialWarID?>"><?=$name?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
+2 -2
View File
@@ -1203,7 +1203,7 @@ function addAge() {
if($year >= $startYear+3) { if($year >= $startYear+3) {
foreach($db->query('SELECT no,name,nation,leadership,strength,intel from general where specage<=age and special=%s', GameConst::$defaultSpecialDomestic) as $general){ foreach($db->query('SELECT no,name,nation,leadership,strength,intel from general where specage<=age and special=%s', GameConst::$defaultSpecialDomestic) as $general){
$generalID = $general['no']; $generalID = $general['no'];
$special = SpecialityConst::pickSpecialDomestic($general); $special = SpecialityHelper::pickSpecialDomestic($general);
$specialClass = buildGeneralSpecialDomesticClass($special); $specialClass = buildGeneralSpecialDomesticClass($special);
$specialText = $specialClass->getName(); $specialText = $specialClass->getName();
$db->update('general', [ $db->update('general', [
@@ -1219,7 +1219,7 @@ function addAge() {
foreach($db->query('SELECT no,name,nation,leadership,strength,intel,npc,dex1,dex2,dex3,dex4,dex5 from general where specage2<=age and special2=%s', GameConst::$defaultSpecialWar) as $general){ foreach($db->query('SELECT no,name,nation,leadership,strength,intel,npc,dex1,dex2,dex3,dex4,dex5 from general where specage2<=age and special2=%s', GameConst::$defaultSpecialWar) as $general){
$generalID = $general['no']; $generalID = $general['no'];
$special2 = SpecialityConst::pickSpecialWar($general); $special2 = SpecialityHelper::pickSpecialWar($general);
$specialClass = buildGeneralSpecialWarClass($special2); $specialClass = buildGeneralSpecialWarClass($special2);
$specialText = $specialClass->getName(); $specialText = $specialClass->getName();
+14 -4
View File
@@ -9,12 +9,22 @@ namespace sammo;
* (단, autoload, 정적 변수 초기화는 허용) * (단, autoload, 정적 변수 초기화는 허용)
*/ */
function getCharacterList(){ function getCharacterList(bool $onlyAvailable=true){
$infoText = []; $infoText = [];
foreach(GameConst::$allPersonality as $personalityID){ if(!$onlyAvailable){
$class = buildPersonalityClass(GameConst::$neutralPersonality);
$infoText[GameConst::$neutralPersonality] = [$class->getName(), $class->getInfo()];
}
foreach(GameConst::$availablePersonality as $personalityID){
$class = buildPersonalityClass($personalityID); $class = buildPersonalityClass($personalityID);
$infoText[$personalityID] = [$class->getName(), $class->getInfo()]; $infoText[$personalityID] = [$class->getName(), $class->getInfo()];
} }
if(!$onlyAvailable){
foreach(GameConst::$optionalPersonality as $personalityID){
$class = buildPersonalityClass($personalityID);
$infoText[$personalityID] = [$class->getName(), $class->getInfo()];
}
}
return $infoText; return $infoText;
} }
@@ -247,7 +257,7 @@ function getGeneralSpecialDomesticClass(?string $type){
throw new \InvalidArgumentException("{$type}은 올바른 내정 특기가 아님"); throw new \InvalidArgumentException("{$type}은 올바른 내정 특기가 아님");
} }
function buildGeneralSpecialDomesticClass(?string $type):iAction{ function buildGeneralSpecialDomesticClass(?string $type):BaseSpecial{
static $cache = []; static $cache = [];
if($type === null){ if($type === null){
$type = 'None'; $type = 'None';
@@ -282,7 +292,7 @@ function getGeneralSpecialWarClass(?string $type){
throw new \InvalidArgumentException("{$type}은 올바른 전투 특기가 아님"); throw new \InvalidArgumentException("{$type}은 올바른 전투 특기가 아님");
} }
function buildGeneralSpecialWarClass(?string $type):iAction{ function buildGeneralSpecialWarClass(?string $type):BaseSpecial{
static $cache = []; static $cache = [];
if($type === null){ if($type === null){
$type = 'None'; $type = 'None';
-21
View File
@@ -21,27 +21,6 @@ function getNationLevelList():array{
return $table; return $table;
} }
function getNationTypeList():array{
return GameConst::$availableNationType;
$table = [
13=>['명가', '기술↑ 인구↑', '쌀수입↓ 수성↓'],
12=>['음양가', '내정↑ 인구↑', '기술↓ 전략↓'],
11=>['종횡가', '전략↑ 수성↑', '금수입↓ 내정↓'],
10=>['불가', '민심↑ 수성↑', '금수입↓'],
9=>['도적', '계략↑', '금수입↓ 치안↓ 민심↓'],
8=>['오두미도', '쌀수입↑ 인구↑', '기술↓ 수성↓ 내정↓'],
7=>['태평도', '인구↑ 민심↑', '기술↓ 수성↓'],
6=>['도가', '인구↑', '기술↓ 치안↓'],
5=>['묵가', '수성↑', '기술↓'],
4=>['덕가', '치안↑인구↑ 민심↑', '쌀수입↓ 수성↓'],
3=>['병가', '기술↑ 수성↑', '인구↓ 민심↓'],
2=>['유가', '내정↑ 민심↑', '쌀수입↓'],
1=>['법가', '금수입↑ 치안↑', '인구↓ 민심↓'],
];
return $table;
}
function getCityLevelList():array{ function getCityLevelList():array{
return [ return [
1 => '수', 1 => '수',
+3 -3
View File
@@ -94,7 +94,7 @@ function processGoldIncome() {
// 각 장수들에게 지급 // 각 장수들에게 지급
foreach ($generalRawList as $rawGeneral) { foreach ($generalRawList as $rawGeneral) {
$generalObj = new General($rawGeneral, null, null, $year, $month, false); $generalObj = new General($rawGeneral, null, null, null, $year, $month, false);
$gold = Util::round(getBill($generalObj->getVar('dedication'))*$ratio); $gold = Util::round(getBill($generalObj->getVar('dedication'))*$ratio);
$generalObj->increaseVar('gold', $gold); $generalObj->increaseVar('gold', $gold);
@@ -369,7 +369,7 @@ function processRiceIncome() {
// 각 장수들에게 지급 // 각 장수들에게 지급
foreach ($generalRawList as $rawGeneral) { foreach ($generalRawList as $rawGeneral) {
$generalObj = new General($rawGeneral, null, null, $year, $month, false); $generalObj = new General($rawGeneral, null, null, null, $year, $month, false);
$rice = Util::round(getBill($generalObj->getVar('dedication'))*$ratio); $rice = Util::round(getBill($generalObj->getVar('dedication'))*$ratio);
$generalObj->increaseVar('rice', $rice); $generalObj->increaseVar('rice', $rice);
@@ -589,7 +589,7 @@ function disaster() {
$generalList = array_map( $generalList = array_map(
function($rawGeneral) use ($city, $year, $month){ function($rawGeneral) use ($city, $year, $month){
return new General($rawGeneral, null, $city, $year, $month, false); return new General($rawGeneral, null, $city, null, $year, $month, false);
}, },
$generalListByCity[$city['city']]??[] $generalListByCity[$city['city']]??[]
); );
+1 -1
View File
@@ -50,7 +50,7 @@ $turn = [];
$generals = []; $generals = [];
foreach($db->query('SELECT no,name,turntime,npc,city,nation,officer_level FROM general WHERE nation = %i AND officer_level >= 5',$nationID) as $rawGeneral){ foreach($db->query('SELECT no,name,turntime,npc,city,nation,officer_level FROM general WHERE nation = %i AND officer_level >= 5',$nationID) as $rawGeneral){
$generals[$rawGeneral['officer_level']] = new General($rawGeneral, null, null, $year, $month, false); $generals[$rawGeneral['officer_level']] = new General($rawGeneral, null, null, null, $year, $month, false);
} }
$nationTurnList = []; $nationTurnList = [];
+26 -22
View File
@@ -31,6 +31,7 @@ if($query === null){
]); ]);
} }
LogText('simulate', $query);
$defaultCheck = [ $defaultCheck = [
'required'=>[ 'required'=>[
@@ -74,7 +75,7 @@ $rawAttacker['turntime'] = TimeUtil::now();
$rawAttackerCity = $query['attackerCity']; $rawAttackerCity = $query['attackerCity'];
$rawAttackerNation = $query['attackerNation']; $rawAttackerNation = $query['attackerNation'];
$rawdefenderList = $query['defenderGenerals']; $rawDefenderList = $query['defenderGenerals'];
$rawDefenderCity = $query['defenderCity']; $rawDefenderCity = $query['defenderCity'];
$rawDefenderNation = $query['defenderNation']; $rawDefenderNation = $query['defenderNation'];
@@ -83,13 +84,13 @@ $generalCheck = [
'required'=>[ 'required'=>[
'no', 'name', 'nation', 'turntime', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train', 'no', 'name', 'nation', 'turntime', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train',
'intel', 'intel_exp', 'book', 'strength', 'strength_exp', 'weapon', 'injury', 'leadership', 'leadership_exp', 'horse', 'item', 'intel', 'intel_exp', 'book', 'strength', 'strength_exp', 'weapon', 'injury', 'leadership', 'leadership_exp', 'horse', 'item',
'explevel', 'experience', 'dedication', 'officer_level', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5', 'explevel', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
'recent_war' 'recent_war'
], ],
'integer'=>[ 'integer'=>[
'no', 'nation', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train', 'no', 'nation', 'crew', 'crewtype', 'atmos', 'train',
'intel', 'intel_exp', 'book', 'strength', 'strength_exp', 'weapon', 'injury', 'leadership', 'leadership_exp', 'horse', 'item', 'intel', 'intel_exp', 'strength', 'strength_exp', 'injury', 'leadership', 'leadership_exp',
'explevel', 'experience', 'dedication', 'officer_level', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5', 'explevel', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
], ],
'min'=>[ 'min'=>[
['no', 1], ['no', 1],
@@ -115,8 +116,8 @@ $generalCheck = [
['officer_level', [1, 12]] ['officer_level', [1, 12]]
], ],
'in'=>[ 'in'=>[
['personal', array_keys(getCharacterList())], ['personal', array_merge(GameConst::$availablePersonality, GameConst::$optionalPersonality)],
['special2', array_merge(array_keys(SpecialityConst::WAR), ['None'])], ['special2', array_merge(GameConst::$availableSpecialWar, GameConst::$optionalSpecialWar)],
['crewtype', array_keys(GameUnitConst::all())], ['crewtype', array_keys(GameUnitConst::all())],
['horse', array_keys(GameConst::$allItems['horse'])], ['horse', array_keys(GameConst::$allItems['horse'])],
['weapon', array_keys(GameConst::$allItems['weapon'])], ['weapon', array_keys(GameConst::$allItems['weapon'])],
@@ -135,7 +136,6 @@ if(!$v->validate()){
} }
$defenderList = []; $defenderList = [];
foreach($rawDefenderList as $idx=>$rawDefenderGeneral){ foreach($rawDefenderList as $idx=>$rawDefenderGeneral){
$v = new Validator($rawDefenderGeneral); $v = new Validator($rawDefenderGeneral);
$v->rules($generalCheck); $v->rules($generalCheck);
@@ -146,7 +146,7 @@ foreach($rawDefenderList as $idx=>$rawDefenderGeneral){
'reason'=>"[수비자{$idx}]".$v->errorStr() 'reason'=>"[수비자{$idx}]".$v->errorStr()
]); ]);
} }
$defenderList[] = new General($rawDefenderGeneral, null, $rawDefenderCity, $year, $month, true); $defenderList[] = new General($rawDefenderGeneral, null, $rawDefenderCity, $rawAttackerNation, $year, $month, true);
} }
@@ -205,7 +205,7 @@ $nationCheck = [
'nation', 'name', 'gold', 'rice', 'gennum' 'nation', 'name', 'gold', 'rice', 'gennum'
], ],
'integer'=>[ 'integer'=>[
'type', 'level', 'capital', 'nation', 'gennum', 'level', 'capital', 'nation', 'gennum',
], ],
'numeric'=>[ 'numeric'=>[
'tech', 'gold', 'rice' 'tech', 'gold', 'rice'
@@ -217,7 +217,7 @@ $nationCheck = [
['gennum', 1], ['gennum', 1],
], ],
'in'=>[ 'in'=>[
['type', array_keys(getNationTypeList())], ['type', GameConst::$availableNationType],
['level', array_keys(getNationLevelList())] ['level', array_keys(getNationLevelList())]
] ]
]; ];
@@ -246,8 +246,8 @@ if($action == 'reorder'){
}); });
$order = []; $order = [];
foreach($defenderList as $rawDefenderGeneral){ foreach($defenderList as $defenderGeneral){
$order[] = $rawDefenderGeneral['no']; $order[] = $defenderGeneral->getID();
} }
Json::die([ Json::die([
@@ -261,6 +261,11 @@ usort($defenderList, function(General $lhs, General $rhs){
return -(extractBattleOrder($lhs) <=> extractBattleOrder($rhs)); return -(extractBattleOrder($lhs) <=> extractBattleOrder($rhs));
}); });
$rawDefenderList = array_map(function(General $general){
return $general->getRaw();
}, $defenderList);
unset($defenderList);
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$startYear = $gameStor->startyear; $startYear = $gameStor->startyear;
@@ -269,18 +274,17 @@ $cityRate = Util::round(($year - $startYear) / 1.5) + 60;
function simulateBattle( function simulateBattle(
$rawAttacker, $rawAttackerCity, $rawAttackerNation, $rawAttacker, $rawAttackerCity, $rawAttackerNation,
$defenderList, $rawDefenderCity, $rawDefenderNation, $rawDefenderList, $rawDefenderCity, $rawDefenderNation,
$startYear, $year, $month, $cityRate $startYear, $year, $month, $cityRate
){ ){
$attacker = new WarUnitGeneral( $attacker = new WarUnitGeneral(
new General($rawAttacker, null, $rawAttackerCity, $year, $month), new General($rawAttacker, null, $rawAttackerCity, $rawAttackerNation, $year, $month),
$rawAttackerNation, $rawAttackerNation,
true true
); );
$city = new WarUnitCity($rawDefenderCity, $rawDefenderNation, $year, $month, $cityRate); $city = new WarUnitCity($rawDefenderCity, $rawDefenderNation, $year, $month, $cityRate);
$iterDefender = new \ArrayIterator($defenderList); $iterDefender = new \ArrayIterator($rawDefenderList);
$iterDefender->rewind(); $iterDefender->rewind();
$battleResult = []; $battleResult = [];
@@ -306,15 +310,15 @@ function simulateBattle(
return null; return null;
} }
$rawGeneral = $iterDefender->current(); $defenderObj = new General($iterDefender->current(), null, $rawDefenderCity, $rawDefenderNation, $year, $month);
if(extractBattleOrder($rawGeneral) <= 0){ if(extractBattleOrder($defenderObj) <= 0){
return null; return null;
} }
$defenderRice += $rawGeneral['rice']; $defenderRice += $defenderObj->getVar('rice');
$retVal = new WarUnitGeneral( $retVal = new WarUnitGeneral(
new General($rawGeneral, null, $rawDefenderCity, $year, $month), $defenderObj,
$rawDefenderNation, $rawDefenderNation,
false false
); );
@@ -371,7 +375,7 @@ $defendersActivatedSkills = [];
foreach(Util::range($repeatCnt) as $repeatIdx){ foreach(Util::range($repeatCnt) as $repeatIdx){
[$attacker, $city, $battleResult, $conquerCity, $attackerRice, $defenderRice] = simulateBattle( [$attacker, $city, $battleResult, $conquerCity, $attackerRice, $defenderRice] = simulateBattle(
$rawAttacker, $rawAttackerCity, $rawAttackerNation, $rawAttacker, $rawAttackerCity, $rawAttackerNation,
$defenderList, $rawDefenderCity, $rawDefenderNation, $rawDefenderList, $rawDefenderCity, $rawDefenderNation,
$startYear, $year, $month, $cityRate $startYear, $year, $month, $cityRate
); );
$lastWarLog = Util::mapWithKey(function($key, $values){ $lastWarLog = Util::mapWithKey(function($key, $values){
+1 -1
View File
@@ -158,7 +158,7 @@ $age = 20 + ($pleadership + $pstrength + $pintel) * 2 - (mt_rand(0, 1));
// 아직 남았고 천재등록상태이면 특기 부여 // 아직 남았고 천재등록상태이면 특기 부여
if ($genius) { if ($genius) {
$specage2 = $age; $specage2 = $age;
$special2 = SpecialityConst::pickSpecialWar([ $special2 = SpecialityHelper::pickSpecialWar([
'leadership'=>$leadership, 'leadership'=>$leadership,
'strength'=>$strength, 'strength'=>$strength,
'intel'=>$intel, 'intel'=>$intel,
+17 -10
View File
@@ -204,19 +204,19 @@ jQuery(function($){
explevel:getInt('.form_exp_level'), explevel:getInt('.form_exp_level'),
leadership:getInt('.form_leadership'), leadership:getInt('.form_leadership'),
horse:getInt('.form_general_horse'), horse:getVal('.form_general_horse'),
strength:getInt('.form_strength'), strength:getInt('.form_strength'),
weapon:getInt('.form_general_weap'), weapon:getVal('.form_general_weap'),
intel:getInt('.form_intel'), intel:getInt('.form_intel'),
book:getInt('.form_general_book'), book:getVal('.form_general_book'),
item:getInt('.form_general_item'), item:getVal('.form_general_item'),
injury:getInt('.form_injury'), injury:getInt('.form_injury'),
rice:getInt('.form_rice'), rice:getInt('.form_rice'),
personal:getInt('.form_general_character'), personal:getVal('.form_general_character'),
special2:getInt('.form_general_special_war'), special2:getVal('.form_general_special_war'),
crew:getInt('.form_crew'), crew:getInt('.form_crew'),
crewtype:getInt('.form_crewtype'), crewtype:getInt('.form_crewtype'),
@@ -523,7 +523,7 @@ jQuery(function($){
}; };
var attackerNation = { var attackerNation = {
type:parseInt($attackerNation.find('.form_nation_type').val()), type:$attackerNation.find('.form_nation_type').val(),
tech:parseInt($attackerNation.find('.form_tech').val()) * 1000, tech:parseInt($attackerNation.find('.form_tech').val()) * 1000,
level:parseInt($attackerNation.find('.form_nation_level').val()), level:parseInt($attackerNation.find('.form_nation_level').val()),
capital:$attackerNation.find('.form_is_capital:checked').val()=='1'?1:2, capital:$attackerNation.find('.form_is_capital:checked').val()=='1'?1:2,
@@ -540,7 +540,7 @@ jQuery(function($){
}; };
var defenderNation = { var defenderNation = {
type:parseInt($defenderNation.find('.form_nation_type').val()), type:$defenderNation.find('.form_nation_type').val(),
tech:parseInt($defenderNation.find('.form_tech').val()) * 1000, tech:parseInt($defenderNation.find('.form_tech').val()) * 1000,
level:parseInt($defenderNation.find('.form_nation_level').val()), level:parseInt($defenderNation.find('.form_nation_level').val()),
capital:$defenderNation.find('.form_is_capital:checked').val()=='1'?3:4, capital:$defenderNation.find('.form_is_capital:checked').val()=='1'?3:4,
@@ -573,7 +573,7 @@ jQuery(function($){
level:0, level:0,
gold:0, gold:0,
rice:2000, rice:2000,
type:0, type:'None',
tech:0, tech:0,
gennum:200, gennum:200,
}; };
@@ -616,7 +616,10 @@ jQuery(function($){
var attackerGeneral = extendGeneralInfoForDB(allData.attackerGeneral); var attackerGeneral = extendGeneralInfoForDB(allData.attackerGeneral);
if(2 <= attackerGeneral.officer_level && attackerGeneral.officer_level <= 4){ if(2 <= attackerGeneral.officer_level && attackerGeneral.officer_level <= 4){
attackerCity.officer_city = 1; attackerGeneral.officer_city = 1;
}
else{
attackerGeneral.officer_city = 0;
} }
var defenderNation = $.extend({}, defaultNation, allData.defenderNation); var defenderNation = $.extend({}, defaultNation, allData.defenderNation);
@@ -635,6 +638,9 @@ jQuery(function($){
if(2 <= defenderGeneral.officer_level && defenderGeneral.officer_level <= 4){ if(2 <= defenderGeneral.officer_level && defenderGeneral.officer_level <= 4){
defenderGeneral.officer_city = 3; defenderGeneral.officer_city = 3;
} }
else{
defenderGeneral.officer_city = 0;
}
defenderGenerals.push(defenderGeneral); defenderGenerals.push(defenderGeneral);
}); });
@@ -763,6 +769,7 @@ jQuery(function($){
type:'post', type:'post',
url:'j_simulate_battle.php', url:'j_simulate_battle.php',
dataType:'json', dataType:'json',
contentType: "application/json",
data:{ data:{
action:'reorder', action:'reorder',
query:JSON.stringify(data), query:JSON.stringify(data),
+4 -5
View File
@@ -2,19 +2,18 @@
namespace sammo\ActionSpecialDomestic; namespace sammo\ActionSpecialDomestic;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class None implements iAction{ class None extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 0; protected $id = 0;
protected $name = '-'; protected $name = '-';
protected $info = ''; protected $info = '';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 0; static $selectWeight = 0;
static $type = [ static $type = [
SpecialityConst::DISABLED SpecialityHelper::DISABLED
]; ];
} }
@@ -2,16 +2,15 @@
namespace sammo\ActionSpecialDomestic; namespace sammo\ActionSpecialDomestic;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class che_거상 implements iAction{ class che_거상 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 999; protected $id = 999;
protected $name = '거상'; protected $name = '거상';
protected $info = '<비활성화>'; protected $info = '<비활성화>';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 0; static $selectWeight = 0;
static $type = []; static $type = [];
@@ -2,19 +2,18 @@
namespace sammo\ActionSpecialDomestic; namespace sammo\ActionSpecialDomestic;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class che_경작 implements iAction{ class che_경작 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 1; protected $id = 1;
protected $name = '경작'; protected $name = '경작';
protected $info = '[내정] 농지 개간 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'; protected $info = '[내정] 농지 개간 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_INTEL SpecialityHelper::STAT_INTEL
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
@@ -2,21 +2,20 @@
namespace sammo\ActionSpecialDomestic; namespace sammo\ActionSpecialDomestic;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class che_귀모 implements iAction{ class che_귀모 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 31; protected $id = 31;
protected $name = '귀모'; protected $name = '귀모';
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'; protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p';
static $selectWeightType = SpecialityConst::WEIGHT_PERCENT; static $selectWeightType = SpecialityHelper::WEIGHT_PERCENT;
static $selectWeight = 2.5; static $selectWeight = 2.5;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH, SpecialityHelper::STAT_STRENGTH,
SpecialityConst::STAT_INTEL SpecialityHelper::STAT_INTEL
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
@@ -2,19 +2,18 @@
namespace sammo\ActionSpecialDomestic; namespace sammo\ActionSpecialDomestic;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class che_발명 implements iAction{ class che_발명 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 3; protected $id = 3;
protected $name = '발명'; protected $name = '발명';
protected $info = '[내정] 기술 연구 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'; protected $info = '[내정] 기술 연구 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_INTEL SpecialityHelper::STAT_INTEL
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
@@ -2,19 +2,18 @@
namespace sammo\ActionSpecialDomestic; namespace sammo\ActionSpecialDomestic;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class che_상재 implements iAction{ class che_상재 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 2; protected $id = 2;
protected $name = '상재'; protected $name = '상재';
protected $info = '[내정] 상업 투자 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'; protected $info = '[내정] 상업 투자 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_INTEL SpecialityHelper::STAT_INTEL
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
@@ -2,19 +2,18 @@
namespace sammo\ActionSpecialDomestic; namespace sammo\ActionSpecialDomestic;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class che_수비 implements iAction{ class che_수비 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 11; protected $id = 11;
protected $name = '수비'; protected $name = '수비';
protected $info = '[내정] 수비 강화 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'; protected $info = '[내정] 수비 강화 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_STRENGTH SpecialityHelper::STAT_STRENGTH
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
@@ -2,19 +2,18 @@
namespace sammo\ActionSpecialDomestic; namespace sammo\ActionSpecialDomestic;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class che_인덕 implements iAction{ class che_인덕 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 20; protected $id = 20;
protected $name = '인덕'; protected $name = '인덕';
protected $info = '[내정] 주민 선정·정착 장려 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'; protected $info = '[내정] 주민 선정·정착 장려 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP SpecialityHelper::STAT_LEADERSHIP
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
@@ -2,19 +2,18 @@
namespace sammo\ActionSpecialDomestic; namespace sammo\ActionSpecialDomestic;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class che_축성 implements iAction{ class che_축성 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 10; protected $id = 10;
protected $name = '축성'; protected $name = '축성';
protected $info = '[내정] 기술 연구 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'; protected $info = '[내정] 기술 연구 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_STRENGTH SpecialityHelper::STAT_STRENGTH
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
@@ -2,19 +2,18 @@
namespace sammo\ActionSpecialDomestic; namespace sammo\ActionSpecialDomestic;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class che_통찰 implements iAction{ class che_통찰 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 12; protected $id = 12;
protected $name = '통찰'; protected $name = '통찰';
protected $info = '[내정] 치안 강화 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'; protected $info = '[내정] 치안 강화 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_STRENGTH SpecialityHelper::STAT_STRENGTH
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
+4 -5
View File
@@ -2,19 +2,18 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class None implements iAction{ class None extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 0; protected $id = 0;
protected $name = '-'; protected $name = '-';
protected $info = ''; protected $info = '';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 0; static $selectWeight = 0;
static $type = [ static $type = [
SpecialityConst::DISABLED SpecialityHelper::DISABLED
]; ];
} }
+6 -7
View File
@@ -2,25 +2,24 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller; use sammo\WarUnitTriggerCaller;
use sammo\WarUnitTrigger\che_격노시도; use sammo\WarUnitTrigger\che_격노시도;
use sammo\WarUnitTrigger\che_격노발동; use sammo\WarUnitTrigger\che_격노발동;
class che_격노 implements iAction{ class che_격노 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 74; protected $id = 74;
protected $name = '격노'; protected $name = '격노';
protected $info = '[전투] 상대방 필살 및 회피 시도시 일정 확률로 격노(필살) 발동, 공격 시 일정 확률로 진노(1페이즈 추가)'; protected $info = '[전투] 상대방 필살 및 회피 시도시 일정 확률로 격노(필살) 발동, 공격 시 일정 확률로 진노(1페이즈 추가)';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH, SpecialityHelper::STAT_STRENGTH,
SpecialityConst::STAT_INTEL SpecialityHelper::STAT_INTEL
]; ];
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
+5 -6
View File
@@ -2,24 +2,23 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller; use sammo\WarUnitTriggerCaller;
use sammo\BaseWarUnitTrigger; use sammo\BaseWarUnitTrigger;
use sammo\WarUnitTrigger\WarActivateSkills; use sammo\WarUnitTrigger\WarActivateSkills;
class che_견고 implements iAction{ class che_견고 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 62; protected $id = 62;
protected $name = '견고'; protected $name = '견고';
protected $info = '[전투] 상대 필살 불가, 상대 계략 시도시 성공 확률 -10%p'; protected $info = '[전투] 상대 필살 불가, 상대 계략 시도시 성공 확률 -10%p';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH SpecialityHelper::STAT_STRENGTH
]; ];
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
+6 -7
View File
@@ -2,24 +2,23 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\GameUnitConst; use \sammo\GameUnitConst;
use \sammo\WarUnit; use \sammo\WarUnit;
use \sammo\WarUnitCity; use \sammo\WarUnitCity;
class che_공성 implements iAction{ class che_공성 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 53; protected $id = 53;
protected $name = '공성'; protected $name = '공성';
protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%'; protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP | SpecialityConst::REQ_DEXTERITY | SpecialityConst::ARMY_SIEGE, SpecialityHelper::STAT_LEADERSHIP | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_SIEGE,
SpecialityConst::STAT_STRENGTH | SpecialityConst::REQ_DEXTERITY | SpecialityConst::ARMY_SIEGE, SpecialityHelper::STAT_STRENGTH | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_SIEGE,
SpecialityConst::STAT_INTEL | SpecialityConst::REQ_DEXTERITY | SpecialityConst::ARMY_SIEGE, SpecialityHelper::STAT_INTEL | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_SIEGE,
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
+5 -6
View File
@@ -2,22 +2,21 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\GameUnitConst; use \sammo\GameUnitConst;
class che_궁병 implements iAction{ class che_궁병 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 51; protected $id = 51;
protected $name = '궁병'; protected $name = '궁병';
protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p'; protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP | SpecialityConst::REQ_DEXTERITY | SpecialityConst::ARMY_ARCHER, SpecialityHelper::STAT_LEADERSHIP | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_ARCHER,
SpecialityConst::STAT_STRENGTH | SpecialityConst::REQ_DEXTERITY | SpecialityConst::ARMY_ARCHER SpecialityHelper::STAT_STRENGTH | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_ARCHER
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
+4 -5
View File
@@ -2,21 +2,20 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\GameUnitConst; use \sammo\GameUnitConst;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_귀병 implements iAction{ class che_귀병 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 40; protected $id = 40;
protected $name = '귀병'; protected $name = '귀병';
protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p'; protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_INTEL | SpecialityConst::ARMY_WIZARD | SpecialityConst::REQ_DEXTERITY SpecialityHelper::STAT_INTEL | SpecialityHelper::ARMY_WIZARD | SpecialityHelper::REQ_DEXTERITY
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
+5 -6
View File
@@ -2,22 +2,21 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\GameUnitConst; use \sammo\GameUnitConst;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_기병 implements iAction{ class che_기병 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 52; protected $id = 52;
protected $name = '기병'; protected $name = '기병';
protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%'; protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP | SpecialityConst::REQ_DEXTERITY | SpecialityConst::ARMY_CAVALRY, SpecialityHelper::STAT_LEADERSHIP | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_CAVALRY,
SpecialityConst::STAT_STRENGTH | SpecialityConst::REQ_DEXTERITY | SpecialityConst::ARMY_CAVALRY SpecialityHelper::STAT_STRENGTH | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_CAVALRY
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
+5 -6
View File
@@ -2,24 +2,23 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
use \sammo\BaseWarUnitTrigger; use \sammo\BaseWarUnitTrigger;
use \sammo\WarUnitTriggerCaller; use \sammo\WarUnitTriggerCaller;
use sammo\WarUnitTrigger\WarActivateSkills; use sammo\WarUnitTrigger\WarActivateSkills;
class che_돌격 implements iAction{ class che_돌격 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 60; protected $id = 60;
protected $name = '돌격'; protected $name = '돌격';
protected $info = '[전투] 상대 회피 불가, 공격 시 전투 페이즈 +1, 공격 시 대미지 +10%'; protected $info = '[전투] 상대 회피 불가, 공격 시 전투 페이즈 +1, 공격 시 대미지 +10%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH SpecialityHelper::STAT_STRENGTH
]; ];
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
+5 -6
View File
@@ -2,21 +2,20 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_무쌍 implements iAction{ class che_무쌍 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 61; protected $id = 61;
protected $name = '무쌍'; protected $name = '무쌍';
protected $info = '[전투] 대미지 +10%, 공격 시 필살 확률 +10%p'; protected $info = '[전투] 대미지 +10%, 공격 시 필살 확률 +10%p';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH SpecialityHelper::STAT_STRENGTH
]; ];
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
+4 -5
View File
@@ -2,7 +2,7 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller; use sammo\WarUnitTriggerCaller;
use \sammo\BaseWarUnitTrigger; use \sammo\BaseWarUnitTrigger;
@@ -10,17 +10,16 @@ use \sammo\WarUnitTrigger\WarActivateSkills;
use \sammo\WarUnitTrigger\che_반계시도; use \sammo\WarUnitTrigger\che_반계시도;
use \sammo\WarUnitTrigger\che_반계발동; use \sammo\WarUnitTrigger\che_반계발동;
class che_반계 implements iAction{ class che_반계 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 45; protected $id = 45;
protected $name = '반계'; protected $name = '반계';
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +100%)'; protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +100%)';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_INTEL, SpecialityHelper::STAT_INTEL,
]; ];
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
+5 -6
View File
@@ -2,22 +2,21 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\GameUnitConst; use \sammo\GameUnitConst;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_보병 implements iAction{ class che_보병 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 50; protected $id = 50;
protected $name = '보병'; protected $name = '보병';
protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%'; protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP | SpecialityConst::REQ_DEXTERITY | SpecialityConst::ARMY_FOOTMAN, SpecialityHelper::STAT_LEADERSHIP | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_FOOTMAN,
SpecialityConst::STAT_STRENGTH | SpecialityConst::REQ_DEXTERITY | SpecialityConst::ARMY_FOOTMAN SpecialityHelper::STAT_STRENGTH | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_FOOTMAN
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
+4 -5
View File
@@ -2,20 +2,19 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_신산 implements iAction{ class che_신산 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 41; protected $id = 41;
protected $name = '신산'; protected $name = '신산';
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p<br>[전투] 계략 시도 확률 +20%p, 계략 성공 확률 +20%p'; protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p<br>[전투] 계략 시도 확률 +20%p, 계략 성공 확률 +20%p';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_INTEL, SpecialityHelper::STAT_INTEL,
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
+4 -5
View File
@@ -2,20 +2,19 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_신중 implements iAction{ class che_신중 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 44; protected $id = 44;
protected $name = '신중'; protected $name = '신중';
protected $info = '[전투] 계략 성공 확률 100%'; protected $info = '[전투] 계략 성공 확률 100%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_INTEL, SpecialityHelper::STAT_INTEL,
]; ];
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
+5 -6
View File
@@ -2,24 +2,23 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller; use sammo\WarUnitTriggerCaller;
use \sammo\WarUnitTrigger\che_위압시도; use \sammo\WarUnitTrigger\che_위압시도;
use \sammo\WarUnitTrigger\che_위압발동; use \sammo\WarUnitTrigger\che_위압발동;
class che_위압 implements iAction{ class che_위압 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 63; protected $id = 63;
protected $name = '위압'; protected $name = '위압';
protected $info = '[전투] 훈련/사기≥90, 병력≥1,000 일 때 첫 페이즈 위압 발동(적 공격 불가)'; protected $info = '[전투] 훈련/사기≥90, 병력≥1,000 일 때 첫 페이즈 위압 발동(적 공격 불가)';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH SpecialityHelper::STAT_STRENGTH
]; ];
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
+6 -7
View File
@@ -2,7 +2,7 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use sammo\BaseGeneralTrigger; use sammo\BaseGeneralTrigger;
use sammo\SpecialityConst; use sammo\SpecialityHelper;
use \sammo\General; use \sammo\General;
use \sammo\GeneralTrigger; use \sammo\GeneralTrigger;
use \sammo\GeneralTriggerCaller; use \sammo\GeneralTriggerCaller;
@@ -11,19 +11,18 @@ use sammo\WarUnitTrigger\che_전투치료발동;
use sammo\WarUnitTrigger\che_전투치료시도; use sammo\WarUnitTrigger\che_전투치료시도;
use sammo\WarUnitTriggerCaller; use sammo\WarUnitTriggerCaller;
class che_의술 implements iAction{ class che_의술 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 73; protected $id = 73;
protected $name = '의술'; protected $name = '의술';
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)'; protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)';
static $selectWeightType = SpecialityConst::WEIGHT_PERCENT; static $selectWeightType = SpecialityHelper::WEIGHT_PERCENT;
static $selectWeight = 2; static $selectWeight = 2;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH, SpecialityHelper::STAT_STRENGTH,
SpecialityConst::STAT_INTEL SpecialityHelper::STAT_INTEL
]; ];
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{ public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
+6 -7
View File
@@ -2,25 +2,24 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller; use sammo\WarUnitTriggerCaller;
use \sammo\WarUnitTrigger\che_저격시도; use \sammo\WarUnitTrigger\che_저격시도;
use \sammo\WarUnitTrigger\che_저격발동; use \sammo\WarUnitTrigger\che_저격발동;
class che_저격 implements iAction{ class che_저격 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 70; protected $id = 70;
protected $name = '저격'; protected $name = '저격';
protected $info = '[전투] 전투 개시 시 1/3 확률로 저격 발동'; protected $info = '[전투] 전투 개시 시 1/3 확률로 저격 발동';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH, SpecialityHelper::STAT_STRENGTH,
SpecialityConst::STAT_INTEL SpecialityHelper::STAT_INTEL
]; ];
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
+4 -5
View File
@@ -2,20 +2,19 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_집중 implements iAction{ class che_집중 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 43; protected $id = 43;
protected $name = '집중'; protected $name = '집중';
protected $info = '[전투] 계략 성공 시 대미지 +50%'; protected $info = '[전투] 계략 성공 시 대미지 +50%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_INTEL, SpecialityHelper::STAT_INTEL,
]; ];
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
+6 -7
View File
@@ -2,22 +2,21 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_징병 implements iAction{ class che_징병 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 72; protected $id = 72;
protected $name = '징병'; protected $name = '징병';
protected $info = '[군사] 징·모병비 -50%, 통솔 순수 능력치 보정 +15%'; protected $info = '[군사] 징·모병비 -50%, 통솔 순수 능력치 보정 +15%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH, SpecialityHelper::STAT_STRENGTH,
SpecialityConst::STAT_INTEL SpecialityHelper::STAT_INTEL
]; ];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
+6 -7
View File
@@ -2,22 +2,21 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_척사 implements iAction{ class che_척사 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 75; protected $id = 75;
protected $name = '척사'; protected $name = '척사';
protected $info = '[전투] 지역·도시 병종 상대로 대미지 +10%, 아군 피해 -10%'; protected $info = '[전투] 지역·도시 병종 상대로 대미지 +10%, 아군 피해 -10%';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH, SpecialityHelper::STAT_STRENGTH,
SpecialityConst::STAT_INTEL SpecialityHelper::STAT_INTEL
]; ];
public function getWarPowerMultiplier(WarUnit $unit):array{ public function getWarPowerMultiplier(WarUnit $unit):array{
+6 -7
View File
@@ -2,22 +2,21 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_필살 implements iAction{ class che_필살 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 71; protected $id = 71;
protected $name = '필살'; protected $name = '필살';
protected $info = '[전투] 필살 확률 +20%p'; protected $info = '[전투] 필살 확률 +20%p';
static $selectWeightType = SpecialityConst::WEIGHT_NORM; static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1; static $selectWeight = 1;
static $type = [ static $type = [
SpecialityConst::STAT_LEADERSHIP, SpecialityHelper::STAT_LEADERSHIP,
SpecialityConst::STAT_STRENGTH, SpecialityHelper::STAT_STRENGTH,
SpecialityConst::STAT_INTEL SpecialityHelper::STAT_INTEL
]; ];
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
+4 -5
View File
@@ -2,20 +2,19 @@
namespace sammo\ActionSpecialWar; namespace sammo\ActionSpecialWar;
use \sammo\iAction; use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
class che_환술 implements iAction{ class che_환술 extends \sammo\BaseSpecial{
use \sammo\DefaultAction;
protected $id = 42; protected $id = 42;
protected $name = '환술'; protected $name = '환술';
protected $info = '[전투] 계략 성공 확률 +10%p, 계략 성공 시 대미지 +30%'; protected $info = '[전투] 계략 성공 확률 +10%p, 계략 성공 시 대미지 +30%';
static $selectWeightType = SpecialityConst::WEIGHT_PERCENT; static $selectWeightType = SpecialityHelper::WEIGHT_PERCENT;
static $selectWeight = 5; static $selectWeight = 5;
static $type = [ static $type = [
SpecialityConst::STAT_INTEL, SpecialityHelper::STAT_INTEL,
]; ];
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace sammo;
use \sammo\iAction;
use \sammo\General;
abstract class BaseSpecial implements iAction{
use \sammo\DefaultAction;
protected $id = 0;
protected $name = '-';
protected $info = '';
/** @var int */
static $selectWeightType;
/** @var int */
static $selectWeight;
/** @var int[] */
static $type;
}
@@ -38,7 +38,7 @@ class ReqGeneralCrewMargin extends Constraint{
$reqCrewType = GameUnitConst::byID($this->arg); $reqCrewType = GameUnitConst::byID($this->arg);
//XXX: 왜 General -> obj -> General 변환을 하고 있나? //XXX: 왜 General -> obj -> General 변환을 하고 있나?
$generalObj = new General($this->general, null, null, null, false); $generalObj = new General($this->general, null, null, null, null, false);
if($reqCrewType->id != $generalObj->getCrewTypeObj()->id){ if($reqCrewType->id != $generalObj->getCrewTypeObj()->id){
return true; return true;
+14 -7
View File
@@ -148,25 +148,33 @@ class GameConstBase
/** @var array 기본 국가 성향 */ /** @var array 기본 국가 성향 */
public static $neutralNationType = 'che_중립'; public static $neutralNationType = 'che_중립';
/** @var array 기본 내정 특기 */ /** @var string 기본 내정 특기 */
public static $defaultSpecialDomestic = 'None'; public static $defaultSpecialDomestic = 'None';
/** @var array 선택 가능한 장수 내정 특기 */ /** @var array 선택 가능한 장수 내정 특기 */
public static $availableSpecialDomestic = [ public static $availableSpecialDomestic = [
'che_경작', 'che_상재', 'che_발명', 'che_축성', 'che_수비', 'che_통찰', 'che_인덕', 'che_귀모', 'che_경작', 'che_상재', 'che_발명', 'che_축성', 'che_수비', 'che_통찰', 'che_인덕', 'che_귀모',
]; ];
/** @var array 선택할 수 없으나 게임 내에 유효한 장수 내정 특기 */
public static $optionalSpecialDomestic = [
'None',
];
/** @var array 기본 전투 특기 */ /** @var string 기본 전투 특기 */
public static $defaultSpecialWar = 'None'; public static $defaultSpecialWar = 'None';
/** @var array 선택 가능한 장수 내정 특기 */ /** @var array 선택 가능한 장수 전투 특기 */
public static $availableSpecialWar = [ public static $availableSpecialWar = [
'che_귀병', 'che_신산', 'che_환술', 'che_집중', 'che_신중', 'che_반계', 'che_귀병', 'che_신산', 'che_환술', 'che_집중', 'che_신중', 'che_반계',
'che_보병', 'che_궁병', 'che_기병', 'che_공성', 'che_보병', 'che_궁병', 'che_기병', 'che_공성',
'che_돌격', 'che_무쌍', 'che_견고', 'che_위압', 'che_돌격', 'che_무쌍', 'che_견고', 'che_위압',
'che_저격', 'che_필살', 'che_징병', 'che_의술', 'che_격노', 'che_척사', 'che_저격', 'che_필살', 'che_징병', 'che_의술', 'che_격노', 'che_척사',
]; ];
/** @var array 선택할 수 없으나 게임 내에 유효한 장수 전투 특기 */
public static $optionalSpecialWar = [
'None',
];
/** @var array 기본 성향(공용) */ /** @var string 기본 성향(공용) */
public static $neutralPersonality = 'None'; public static $neutralPersonality = 'None';
/** @var array 선택 가능한 성향 */ /** @var array 선택 가능한 성향 */
public static $availablePersonality = [ public static $availablePersonality = [
@@ -174,9 +182,8 @@ class GameConstBase
'che_패권', 'che_의협', 'che_대의', 'che_왕좌' 'che_패권', 'che_의협', 'che_대의', 'che_왕좌'
]; ];
/** @var array 존재하는 모든 성향 */ /** @var array 존재하는 모든 성향 */
public static $allPersonality = [ public static $optionalPersonality = [
'che_안전', 'che_유지', 'che_재간', 'che_출세', 'che_할거', 'che_정복', 'che_은둔', 'None'
'che_패권', 'che_의협', 'che_대의', 'che_왕좌', 'che_은둔', 'None'
]; ];
public static $allItems = [ public static $allItems = [
+7 -4
View File
@@ -83,10 +83,13 @@ class General implements iAction{
* @param int $month 게임 월 * @param int $month 게임 월
* @param bool $fullConstruct iAction, 및 ActionLogger 초기화 여부, false인 경우 no, name, city, nation, officer_level 정도로 초기화 가능 * @param bool $fullConstruct iAction, 및 ActionLogger 초기화 여부, false인 경우 no, name, city, nation, officer_level 정도로 초기화 가능
*/ */
public function __construct(array $raw, ?array $rawRank, ?array $city, ?int $year, ?int $month, bool $fullConstruct=true){ public function __construct(array $raw, ?array $rawRank, ?array $city, ?array $nation, ?int $year, ?int $month, bool $fullConstruct=true){
//TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함. //TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함.
$staticNation = getNationStaticInfo($raw['nation']); if($nation === null){
$nation = getNationStaticInfo($raw['nation']);
}
$this->raw = $raw; $this->raw = $raw;
$this->rawCity = $city; $this->rawCity = $city;
@@ -107,8 +110,8 @@ class General implements iAction{
return; return;
} }
$this->nationType = buildNationTypeClass($staticNation['type']); $this->nationType = buildNationTypeClass($nation['type']);
$this->officerLevelObj = new TriggerOfficerLevel($this->raw, $staticNation['level']); $this->officerLevelObj = new TriggerOfficerLevel($this->raw, $nation['level']);
$this->specialDomesticObj = buildGeneralSpecialDomesticClass($raw['special']); $this->specialDomesticObj = buildGeneralSpecialDomesticClass($raw['special']);
$this->specialWarObj = buildGeneralSpecialWarClass($raw['special2']); $this->specialWarObj = buildGeneralSpecialWarClass($raw['special2']);
+7 -9
View File
@@ -7,7 +7,7 @@ use \sammo\CityHelper;
use \sammo\GameUnitConst; use \sammo\GameUnitConst;
use \sammo\CityConst; use \sammo\CityConst;
use \sammo\GameConst; use \sammo\GameConst;
use \sammo\SpecialityConst; use \sammo\SpecialityHelper;
class NPC{ class NPC{
@@ -101,17 +101,17 @@ class NPC{
$this->charWar = GameConst::$defaultSpecialWar; $this->charWar = GameConst::$defaultSpecialWar;
if($char === '랜덤전특'){ if($char === '랜덤전특'){
$this->charWar = SpecialityConst::pickSpecialWar($general); $this->charWar = SpecialityHelper::pickSpecialWar($general);
} }
else if($char === '랜덤내특'){ else if($char === '랜덤내특'){
$this->charDomestic = SpecialityConst::pickSpecialDomestic($general); $this->charDomestic = SpecialityHelper::pickSpecialDomestic($general);
} }
else if($char === '랜덤'){ else if($char === '랜덤'){
if(Util::randBool(2/3)){ if(Util::randBool(2/3)){
$this->charWar = SpecialityConst::pickSpecialWar($general); $this->charWar = SpecialityHelper::pickSpecialWar($general);
} }
else{ else{
$this->charDomestic = SpecialityConst::pickSpecialDomestic($general); $this->charDomestic = SpecialityHelper::pickSpecialDomestic($general);
} }
} }
else if($char === null){ else if($char === null){
@@ -120,12 +120,10 @@ class NPC{
//TODO: 내특, 전특 구분 필요 //TODO: 내특, 전특 구분 필요
try{ try{
$domesticClass = \sammo\getGeneralSpecialDomesticClass($char); $this->charDomestic = SpecialityHelper::getDomesticClassByName($char);
$this->charDomestic = Util::getClassName($domesticClass);
} }
catch (\Exception $e) { catch (\Exception $e) {
$warClass = \sammo\getGeneralSpecialWarClass($char); $this->charWar = SpecialityHelper::getWarClassByName($char);
$this->charWar = Util::getClassName($warClass);
} }
} }
} }
-262
View File
@@ -1,262 +0,0 @@
<?php
namespace sammo;
//TODO: 나중에는 각 내특, 전특이 클래스로 가야함
class SpecialityConst{
//const GENERIC = 0x0;
const DISABLED = 0x1;
const STAT_LEADERSHIP = 0x2;
const STAT_STRENGTH = 0x4;
const STAT_INTEL = 0x8;
const ARMY_FOOTMAN = 0x100;
const ARMY_ARCHER = 0x200;
const ARMY_CAVALRY = 0x400;
const ARMY_WIZARD = 0x800;
const ARMY_SIEGE = 0x1000;
const REQ_DEXTERITY = 0x4000;
const WEIGHT_NORM = 1;
const WEIGHT_PERCENT = 2;
private $invDomestic = null;
private $invWar = null;
private function __construct(){
}
//음수 : 절대값 %, 양수 : 상대적 비중
const DOMESTIC = [
'che_경작' => ['경작', 1, [self::STAT_INTEL]],
'che_상재' => ['상재', 1, [self::STAT_INTEL]],
'che_발명' => ['발명', 1, [self::STAT_INTEL]],
'che_축성' => ['축성', 1, [self::STAT_STRENGTH]],
'che_수비' => ['수비', 1, [self::STAT_STRENGTH]],
'che_통찰' => ['통찰', 1, [self::STAT_STRENGTH]],
'che_인덕' => ['인덕', 1, [self::STAT_LEADERSHIP]],
'che_귀모' => ['귀모', -2.5, [self::STAT_LEADERSHIP, self::STAT_STRENGTH, self::STAT_INTEL]],
];
const WAR = [
'che_귀병' => ['귀병', 1, [self::STAT_INTEL | self::ARMY_WIZARD | self::REQ_DEXTERITY]],
'che_신산' => ['신산', 1, [self::STAT_INTEL]],
'che_환술' => ['환술', -5, [self::STAT_INTEL]],
'che_집중' => ['집중', 1, [self::STAT_INTEL]],
'che_신중' => ['신중', 1, [self::STAT_INTEL]],
'che_반계' => ['반계', 1, [self::STAT_INTEL]],
'che_보병' => ['보병', 1, [
self::STAT_LEADERSHIP | self::REQ_DEXTERITY | self::ARMY_FOOTMAN,
self::STAT_STRENGTH | self::REQ_DEXTERITY | self::ARMY_FOOTMAN
]],
'che_궁병' => ['궁병', 1, [
self::STAT_LEADERSHIP | self::REQ_DEXTERITY | self::ARMY_ARCHER,
self::STAT_STRENGTH | self::REQ_DEXTERITY | self::ARMY_ARCHER
]],
'che_기병' => ['기병', 1, [
self::STAT_LEADERSHIP | self::REQ_DEXTERITY | self::ARMY_CAVALRY,
self::STAT_STRENGTH | self::REQ_DEXTERITY | self::ARMY_CAVALRY
]],
'che_공성' => ['공성', 1, [
self::STAT_LEADERSHIP | self::REQ_DEXTERITY | self::ARMY_SIEGE,
self::STAT_STRENGTH | self::REQ_DEXTERITY | self::ARMY_SIEGE,
self::STAT_INTEL | self::REQ_DEXTERITY | self::ARMY_SIEGE
]],
'che_돌격' => ['돌격', 1, [self::STAT_LEADERSHIP, self::STAT_STRENGTH]],
'che_무쌍' => ['무쌍', 1, [self::STAT_LEADERSHIP, self::STAT_STRENGTH]],
'che_견고' => ['견고', 1, [self::STAT_LEADERSHIP, self::STAT_STRENGTH]],
'che_위압' => ['위압', 1, [self::STAT_LEADERSHIP, self::STAT_STRENGTH]],
'che_저격' => ['저격', 1, [self::STAT_LEADERSHIP, self::STAT_STRENGTH, self::STAT_INTEL]],
'che_필살' => ['필살', 1, [self::STAT_LEADERSHIP, self::STAT_STRENGTH, self::STAT_INTEL]],
'che_징병' => ['징병', 1, [self::STAT_LEADERSHIP, self::STAT_STRENGTH, self::STAT_INTEL]],
'che_의술' => ['의술', -2, [self::STAT_LEADERSHIP, self::STAT_STRENGTH, self::STAT_INTEL]],
'che_격노' => ['격노', 1, [self::STAT_LEADERSHIP, self::STAT_STRENGTH, self::STAT_INTEL]],
'che_척사' => ['척사', 1, [self::STAT_LEADERSHIP, self::STAT_STRENGTH, self::STAT_INTEL]],
];
public static function getInvDomestic(string $name){
if(static::$invDomestic !== null){
return static::$invDomestic[$name]??null;
}
$invDomestic = [];
foreach(static::DOMESTIC as $key=>$val){
$nameKey = $val[0];
$val[0] = $key;
$invDomestic[$nameKey] = $val;
}
static::$invDomestic = $invDomestic;
return static::$invDomestic[$name]??null;
}
public static function getInvWar(string $name){
if(static::$invWar !== null){
return static::$invWar[$name]??null;
}
$invWar = [];
foreach(static::WAR as $key=>$val){
$nameKey = $val[0];
$val[0] = $key;
$invWar[$nameKey] = $val;
}
static::$invWar = $invWar;
return static::$invWar[$name]??null;
}
private static function calcCondGeneric(array $general) : int {
$myCond = 0;
$leadership = $general['leadership']??50;
$strength = $general['strength']??50;
$intel = $general['intel']??50;
if ($leadership * 0.95 > $strength && $leadership * 0.95 > $intel) {
$myCond |= self::STAT_LEADERSHIP;
}
else if($strength >= $intel){
$myCond |= self::STAT_STRENGTH;
}
else {
$myCond |= self::STAT_INTEL;
}
return $myCond;
}
private static function calcCondDexterity(array $general) : int {
$dex = [
static::ARMY_FOOTMAN => $general['dex1']??0,
static::ARMY_ARCHER => $general['dex2']??0,
static::ARMY_CAVALRY => $general['dex3']??0,
static::ARMY_WIZARD => $general['dex4']??0,
static::ARMY_SIEGE => $general['dex5']??0,
];
$dexSum = array_sum($dex);
$dexBase = Util::round(sqrt($dexSum) / 4);
if(Util::randBool(0.8)){
return 0;
}
if(mt_rand(0, 99) < $dexBase){
return 0;
}
if(!$dexSum){
return array_rand($dex);
}
return array_keys($dex, max($dex))[0];
}
public static function pickSpecialDomestic(array $general) : string{
$pAbs = [];
$pRel = [];
$myCond = static::calcCondGeneric($general);
foreach(self::DOMESTIC as $id=>list($name, $weight, $conds)){
$valid = false;
foreach($conds as $cond){
if($cond === ($cond & $myCond)){
$valid = true;
break;
}
}
if(!$valid){
continue;
}
if($weight < 0){
$pAbs[$id] = -$weight;
}
else{
$pRel[$id] = $weight;
}
}
if($pAbs){
if($pRel){
$pAbs[0] = max(0, 100 - array_sum($pAbs));
}
$id = Util::choiceRandomUsingWeight($pAbs);
if($id){
return $id;
}
}
$id = Util::choiceRandomUsingWeight($pRel);
if($id){
return $id;
}
throw new MustNotBeReachedException();
}
public static function pickSpecialWar(array $general) : string{
$reqDex = [];
$pAbs = [];
$pRel = [];
$myCond = static::calcCondGeneric($general);
$myCond |= static::calcCondDexterity($general);
foreach(self::WAR as $id=>list($name, $weight, $conds)){
$valid = false;
foreach($conds as $cond){
if($cond === ($cond & $myCond)){
$valid = true;
break;
}
}
if(!$valid){
continue;
}
if($cond & self::REQ_DEXTERITY){
$reqDex[$id] = $weight;
}
else if($weight < 0){
$pAbs[$id] = -$weight;
}
else{
$pRel[$id] = $weight;
}
}
if($reqDex){
return Util::choiceRandomUsingWeight($reqDex);
}
if($pAbs){
if($pRel){
$pAbs[0] = max(0, 100 - array_sum($pAbs));
}
$id = Util::choiceRandomUsingWeight($pAbs);
if($id){
return $id;
}
}
$id = Util::choiceRandomUsingWeight($pRel);
if($id){
return $id;
}
throw new MustNotBeReachedException();
}
}
+270
View File
@@ -0,0 +1,270 @@
<?php
namespace sammo;
class SpecialityHelper{
//const GENERIC = 0x0;
const DISABLED = 0x1;
const STAT_LEADERSHIP = 0x2;
const STAT_STRENGTH = 0x4;
const STAT_INTEL = 0x8;
const ARMY_FOOTMAN = 0x100;
const ARMY_ARCHER = 0x200;
const ARMY_CAVALRY = 0x400;
const ARMY_WIZARD = 0x800;
const ARMY_SIEGE = 0x1000;
const REQ_DEXTERITY = 0x4000;
const WEIGHT_NORM = 1;
const WEIGHT_PERCENT = 2;
static $domesticInv = null;
static $warInv = null;
private function __construct(){
}
public static function getDomesticClassByName(?string $type):string{
if($type === null || $type === ''){
$type = GameConst::$defaultSpecialDomestic;
}
if(static::$domesticInv){
if(!key_exists($type, static::$domesticInv)){
throw new \InvalidArgumentException('올바르지 않은 특기명:',$type);
}
return static::$domesticInv[$type];
}
$cache = [];
foreach(static::getSpecialDomesticList(false) as $className=>$classObj){
$cache[$classObj->getName()] = $className;
}
static::$domesticInv = $cache;
return $cache[$type];
}
public static function getWarClassByName(?string $type):string{
if($type === null || $type === ''){
$type = GameConst::$defaultSpecialWar;
}
if(static::$warInv){
if(!key_exists($type, static::$warInv)){
throw new \InvalidArgumentException('올바르지 않은 특기명:',$type);
}
return static::$warInv[$type];
}
$cache = [];
foreach(static::getSpecialWarList(false) as $className=>$classObj){
$cache[$classObj->getName()] = $className;
}
static::$warInv = $cache;
return $cache[$type];
}
private static function calcCondGeneric(array $general) : int {
$myCond = 0;
$leadership = $general['leadership']??50;
$strength = $general['strength']??50;
$intel = $general['intel']??50;
if ($leadership * 0.95 > $strength && $leadership * 0.95 > $intel) {
$myCond |= self::STAT_LEADERSHIP;
}
else if($strength >= $intel){
$myCond |= self::STAT_STRENGTH;
}
else {
$myCond |= self::STAT_INTEL;
}
return $myCond;
}
private static function calcCondDexterity(array $general) : int {
$dex = [
static::ARMY_FOOTMAN => $general['dex1']??0,
static::ARMY_ARCHER => $general['dex2']??0,
static::ARMY_CAVALRY => $general['dex3']??0,
static::ARMY_WIZARD => $general['dex4']??0,
static::ARMY_SIEGE => $general['dex5']??0,
];
$dexSum = array_sum($dex);
$dexBase = Util::round(sqrt($dexSum) / 4);
if(Util::randBool(0.8)){
return 0;
}
if(mt_rand(0, 99) < $dexBase){
return 0;
}
if(!$dexSum){
return array_rand($dex);
}
return array_keys($dex, max($dex))[0];
}
/** @return BaseSpecial[] */
public static function getSpecialDomesticList(bool $onlyAvailable=true):array{
$result = [];
if(!$onlyAvailable){
$specialObj = buildGeneralSpecialDomesticClass(GameConst::$defaultSpecialDomestic);
$result[GameConst::$defaultSpecialDomestic] = $specialObj;
}
foreach(GameConst::$availableSpecialDomestic as $specialID){
$specialObj = buildGeneralSpecialDomesticClass($specialID);
$result[$specialID] = $specialObj;
}
if(!$onlyAvailable){
foreach(GameConst::$availableSpecialDomestic as $specialID){
$specialObj = buildGeneralSpecialDomesticClass($specialID);
$result[$specialID] = $specialObj;
}
}
return $result;
}
/** @return BaseSpecial[] */
public static function getSpecialWarList(bool $onlyAvailable=true):array{
$result = [];
if(!$onlyAvailable){
$specialObj = buildGeneralSpecialDomesticClass(GameConst::$defaultSpecialDomestic);
$result[GameConst::$defaultSpecialDomestic] = $specialObj;
}
foreach(GameConst::$availableSpecialDomestic as $specialID){
$specialObj = buildGeneralSpecialDomesticClass($specialID);
$result[$specialID] = $specialObj;
}
if(!$onlyAvailable){
foreach(GameConst::$availableSpecialDomestic as $specialID){
$specialObj = buildGeneralSpecialDomesticClass($specialID);
$result[$specialID] = $specialObj;
}
}
return $result;
}
public static function pickSpecialDomestic(array $general) : string{
$pAbs = [];
$pRel = [];
$myCond = static::calcCondGeneric($general);
foreach(static::getSpecialDomesticList() as $specialID=>$specialObj){
$conds = $specialObj::$type;
$name = $specialObj->getName();
$weightType = $specialObj::$selectWeightType;
$weight = $specialObj::$selectWeight;
$valid = false;
foreach($conds as $cond){
if($cond === ($cond & $myCond)){
$valid = true;
break;
}
}
if(!$valid){
continue;
}
if($weightType === static::WEIGHT_PERCENT){
$pAbs[$specialID] = $weight;
}
else{
$pRel[$specialID] = $weight;
}
}
if($pAbs){
if($pRel){
$pAbs[0] = max(0, 100 - array_sum($pAbs));
}
$id = Util::choiceRandomUsingWeight($pAbs);
if($id){
return $id;
}
}
$id = Util::choiceRandomUsingWeight($pRel);
if($id){
return $id;
}
throw new MustNotBeReachedException();
}
public static function pickSpecialWar(array $general) : string{
$reqDex = [];
$pAbs = [];
$pRel = [];
$myCond = static::calcCondGeneric($general);
$myCond |= static::calcCondDexterity($general);
foreach(static::getSpecialWarList() as $specialID=>$specialObj){
$conds = $specialObj::$type;
$name = $specialObj->getName();
$weightType = $specialObj::$selectWeightType;
$weight = $specialObj::$selectWeight;
$valid = false;
foreach($conds as $cond){
if($cond === ($cond & $myCond)){
$valid = true;
break;
}
}
if(!$valid){
continue;
}
if($cond & self::REQ_DEXTERITY){
$reqDex[$specialID] = $weight;
}
else if($weightType === static::WEIGHT_PERCENT){
$pAbs[$specialID] = $weight;
}
else{
$pRel[$specialID] = $weight;
}
}
if($reqDex){
return Util::choiceRandomUsingWeight($reqDex);
}
if($pAbs){
if($pRel){
$pAbs[0] = max(0, 100 - array_sum($pAbs));
}
$id = Util::choiceRandomUsingWeight($pAbs);
if($id){
return $id;
}
}
$id = Util::choiceRandomUsingWeight($pRel);
if($id){
return $id;
}
throw new MustNotBeReachedException();
}
}
+8 -9
View File
@@ -37,16 +37,15 @@ $nationList = $db->query('SELECT nation,`name`,color,scout,scoutmsg FROM nation
var specialInfo = var specialInfo =
<?php <?php
$specialAll = []; $specialAll = [];
foreach (GameConst::$availableSpecialDomestic as $id) { foreach(SpecialityHelper::getSpecialDomesticList() as $specialID=>$specialObj){
$domesticClass = buildGeneralSpecialDomesticClass($id); $name = $specialObj->getName();
$name = $domesticClass->getName(); $info = $specialObj->getInfo();
$info = $domesticClass->getInfo();
$specialAll[$name] = $info; $specialAll[$name] = $info;
} }
foreach (SpecialityConst::WAR as $id=>$values) { foreach(SpecialityHelper::getSpecialWarList() as $specialID=>$specialObj){
$name = $values[0]; $name = $specialObj->getName();
$text = getSpecialInfo($id); $info = $specialObj->getInfo();
$specialAll[$name] = $text; $specialAll[$name] = $info;
} }
$specialAll['-'] = '없음'; $specialAll['-'] = '없음';
echo Json::encode($specialAll); echo Json::encode($specialAll);
@@ -55,7 +54,7 @@ echo Json::encode($specialAll);
var characterInfo = var characterInfo =
<?php <?php
$characterAll = []; $characterAll = [];
foreach(getCharacterList() as $id=>[$name, $info]){ foreach(getCharacterList(false) as $id=>[$name, $info]){
$characterAll[$name] = $info; $characterAll[$name] = $info;
} }
echo Json::encode($characterAll); echo Json::encode($characterAll);