game: 충차 도구 추가

This commit is contained in:
2024-09-18 16:08:37 +00:00
parent 749e8f673b
commit cfd0a2d26f
3 changed files with 158 additions and 2 deletions
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\GameUnitConst;
use \sammo\WarUnit;
use \sammo\WarUnitCity;
use sammo\RandUtil;
use \sammo\WarUnitTriggerCaller;
use \sammo\BaseWarUnitTrigger;
use sammo\WarUnitTrigger\event_충차아이템소모;
class event_충차 extends \sammo\BaseItem{
protected $rawName = '충차';
protected $name = '충차';
protected $info = '[전투] 성벽 공격 시 대미지 +50%, 2회용';
protected $cost = 2000;
protected $consumable = true;
protected $buyable = true;
protected $reqSecu = 4000;
const REMAIN_KEY = 'remain충차';
function onArbitraryAction(General $general, RandUtil $rng, string $actionType, ?string $phase = null, $aux = null): ?array
{
if($actionType != '장비매매'){
return $aux;
}
if($phase != '구매'){
return $aux;
}
$general->setAuxVar(static::REMAIN_KEY, 2);
return $aux;
}
public function getWarPowerMultiplier(WarUnit $unit):array{
if($unit->getOppose() instanceof WarUnitCity){
return [1.5, 1];
}
return [1, 1];
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new event_충차아이템소모($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM)
);
}
}
@@ -0,0 +1,47 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\ActionItem\event_충차;
use sammo\BaseWarUnitTrigger;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\ObjectTrigger;
use sammo\Util;
use sammo\ActionLogger;
class event_충차아이템소모 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_PRE + 200;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
if($self->hasActivatedSkillOnLog('충차공격') && $self->getPhase() == $self->getMaxPhase() - 1){
//TODO: 전투 종료시 소모를 예약하는 기능이 있으면 매우 좋을 것 같다.
$general = $self->getGeneral();
$remain = $general->getAuxVar(event_충차::REMAIN_KEY) ?? 0;
if($remain <= 0){
$this->processConsumableItem();
}
return true;
}
if(!($self instanceof WarUnitGeneral)){
return true;
}
if(!($oppose instanceof WarUnitCity)){
return true;
}
if($self->hasActivatedSkillOnLog('충차공격')){
return true;
}
$self->getLogger()->pushGeneralBattleDetailLog("<C>충차</>로 성벽을 공격합니다.", ActionLogger::PLAIN);
$general = $self->getGeneral();
$remain = $general->getAuxVar(event_충차::REMAIN_KEY) ?? 0;
$self->activateSkill('충차공격');
$general->setAuxVar(event_충차::REMAIN_KEY, $remain - 1);
return true;
}
}
+59 -2
View File
@@ -1,5 +1,5 @@
{
"title":"【이벤트】 축지",
"title":"【공백지】 축지",
"startYear":180,
"map":{
"mapName":"miniche",
@@ -22,7 +22,64 @@
},
"incDefSettingChange": 10,
"maxDefSettingChange": 30,
"refreshLimitCoef": 20
"refreshLimitCoef": 20,
"allItems": {
"horse" : {
"che_명마_01_노기" : 0, "che_명마_02_조랑" : 0, "che_명마_03_노새" : 0,
"che_명마_04_나귀" : 0, "che_명마_05_갈색마" : 0, "che_명마_06_흑색마" : 0,
"che_명마_07_백마" : 2, "che_명마_07_기주마" : 2, "che_명마_07_오환마" : 2, "che_명마_07_백상" : 2,
"che_명마_08_양주마" : 2, "che_명마_08_흉노마" : 2, "che_명마_09_과하마" : 2, "che_명마_09_의남백마" : 2,
"che_명마_10_대완마" : 2, "che_명마_10_옥추마" : 2, "che_명마_11_서량마" : 2, "che_명마_11_화종마" : 2,
"che_명마_12_사륜거" : 2, "che_명마_12_옥란백용구": 2, "che_명마_13_절영" : 2, "che_명마_13_적로" : 2,
"che_명마_14_적란마" : 2, "che_명마_14_조황비전" : 2, "che_명마_15_한혈마" : 2, "che_명마_15_적토마" : 2
},
"weapon" : {
"che_무기_01_단도" : 0, "che_무기_02_단궁" : 0, "che_무기_03_단극" : 0,
"che_무기_04_목검" : 0, "che_무기_05_죽창" : 0, "che_무기_06_소부" : 0,
"che_무기_07_동추" : 2, "che_무기_07_철편" : 2, "che_무기_07_철쇄" : 2, "che_무기_07_맥궁" : 2,
"che_무기_08_유성추" : 2, "che_무기_08_철질여골" : 2, "che_무기_09_쌍철극" : 2, "che_무기_09_동호비궁" : 2,
"che_무기_10_삼첨도" : 2, "che_무기_10_대부" : 2, "che_무기_11_고정도" : 2, "che_무기_11_이광궁" : 2,
"che_무기_12_철척사모" : 2, "che_무기_12_칠성검" : 2, "che_무기_13_사모" : 2, "che_무기_13_양유기궁" : 2,
"che_무기_14_언월도" : 2, "che_무기_14_방천화극" : 2, "che_무기_15_청홍검" : 2, "che_무기_15_의천검" : 2
},
"book" : {
"che_서적_01_효경전" : 0, "che_서적_02_회남자" : 0, "che_서적_03_변도론" : 0,
"che_서적_04_건상역주" : 0, "che_서적_05_여씨춘추" : 0, "che_서적_06_사민월령" : 0,
"che_서적_07_위료자" : 2, "che_서적_07_사마법" : 2, "che_서적_07_한서" : 2, "che_서적_07_논어" : 2,
"che_서적_08_전론" : 2, "che_서적_08_사기" : 2, "che_서적_09_장자" : 2, "che_서적_09_역경" : 2,
"che_서적_10_시경" : 2, "che_서적_10_구국론" : 2, "che_서적_11_상군서" : 2, "che_서적_11_춘추전" : 2,
"che_서적_12_산해경" : 2, "che_서적_12_맹덕신서" : 2, "che_서적_13_관자" : 2, "che_서적_13_병법24편" : 2,
"che_서적_14_한비자" : 2, "che_서적_14_오자병법" : 2, "che_서적_15_노자" : 2, "che_서적_15_손자병법" : 2
},
"item" : {
"che_치료_환약" : 0, "che_저격_수극" : 0, "che_사기_탁주" : 0,
"che_훈련_청주" : 0, "che_계략_이추" : 0, "che_계략_향낭" : 0,
"event_충차": 0,
"che_의술_정력견혈산" : 1, "che_의술_청낭서" : 1, "che_의술_태평청령" : 1, "che_의술_상한잡병론" : 1,
"che_보물_도기" : 1, "che_조달_주판" : 1,
"che_내정_납금박산로" : 1, "che_전략_평만지장도" : 1, "che_숙련_동작" : 1, "che_명성_구석" : 1,
"che_척사_오악진형도" : 1, "che_격노_구정신단경" : 1, "che_징병_낙주" : 1,
"che_저격_매화수전" : 1, "che_저격_비도":1, "che_위압_조목삭" : 1, "che_공성_묵자" : 1,
"che_집중_전국책" : 1, "che_환술_논어집해" : 1,
"che_진압_박혁론" : 1, "che_부적_태현청생부" : 1, "che_저지_삼황내문" : 1,
"che_행동_서촉지형도" : 1, "che_간파_노군입산부" : 1, "che_불굴_상편" : 1,
"che_약탈_옥벽" : 1,
"che_농성_주서음부" : 1, "che_농성_위공자병법" : 1,
"che_계략_육도" : 1, "che_계략_삼략" : 1,
"che_상성보정_과실주" : 1,
"che_능력치_지력_이강주" : 1, "che_능력치_무력_두강주" : 1, "che_능력치_통솔_보령압주" : 1,
"che_훈련_철벽서" : 1, "che_훈련_단결도" : 1, "che_사기_춘화첩" : 1, "che_사기_초선화" : 1,
"che_회피_태평요술" : 1, "che_필살_둔갑천서" : 1
}
}
},
"events":[
[