game,feat: 소비형 아이템 효율 상승, 환약 3회용으로 변경

This commit is contained in:
2022-02-23 01:41:24 +09:00
parent 5f36143b44
commit 9f84eb8d4d
9 changed files with 45 additions and 18 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ class che_계략_이추 extends \sammo\BaseItem{
return $value;
}
function isConsumableNow(string $actionType, string $command):bool{
function tryConsumeNow(General $general, string $actionType, string $command):bool{
if($actionType == 'GeneralCommand' && $command == '계략'){
return true;
}
+1 -1
View File
@@ -21,7 +21,7 @@ class che_계략_향낭 extends \sammo\BaseItem{
return $value;
}
function isConsumableNow(string $actionType, string $command):bool{
function tryConsumeNow(General $general, string $actionType, string $command):bool{
if($actionType == 'GeneralCommand' && $command == '계략'){
return true;
}
+3 -2
View File
@@ -3,6 +3,7 @@ namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
use \sammo\BaseWarUnitTrigger;
use sammo\GameConst;
use \sammo\WarUnit;
use \sammo\WarUnitTriggerCaller;
use \sammo\WarUnitTrigger\능력치변경;
@@ -11,7 +12,7 @@ class che_사기_탁주 extends \sammo\BaseItem{
protected $rawName = '탁주';
protected $name = '탁주(사기)';
protected $info = '[전투] 사기 +6. 1회용';
protected $info = '[전투] 사기 +30(한도 내). 1회용';
protected $cost = 1000;
protected $consumable = true;
protected $buyable = true;
@@ -19,7 +20,7 @@ class che_사기_탁주 extends \sammo\BaseItem{
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new 능력치변경($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 'atmos', '+', 6)
new 능력치변경($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 'atmos', '+', 30, null, GameConst::$maxAtmosByWar)
);
}
}
+3 -3
View File
@@ -12,7 +12,7 @@ class che_저격_수극 extends \sammo\BaseItem{
protected $rawName = '수극';
protected $name = '수극(저격)';
protected $info = '[전투] 전투 개시 전 50% 확률로 저격 시도. 1회용';
protected $info = '[전투] 전투 개시 시 저격. 1회용';
protected $cost = 1000;
protected $consumable = true;
protected $buyable = true;
@@ -20,12 +20,12 @@ class che_저격_수극 extends \sammo\BaseItem{
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_저격시도($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 0.5, 20, 40),
new che_저격시도($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 1, 20, 40),
new che_저격발동($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM)
);
}
function isConsumableNow(string $actionType, string $command):bool{
function tryConsumeNow(General $general, string $actionType, string $command):bool{
if($actionType == 'GeneralTrigger' && $command == 'che_아이템치료'){
return true;
}
+31 -6
View File
@@ -9,22 +9,47 @@ class che_치료_환약 extends \sammo\BaseItem{
protected $rawName = '환약';
protected $name = '환약(치료)';
protected $info = '[군사] 턴 실행 전 부상 회복. 1회용';
protected $cost = 100;
protected $info = '[군사] 턴 실행 전 부상 회복. 3회용';
protected $cost = 200;
protected $consumable = true;
protected $buyable = true;
protected $reqSecu = 0;
const REMAIN_KEY = 'remain환약';
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
return new GeneralTriggerCaller(
new GeneralTrigger\che_아이템치료($general, $general->getAuxVar('use_treatment')??10)
);
}
function isConsumableNow(string $actionType, string $command):bool{
if($actionType == 'GeneralTrigger' && $command == 'che_아이템치료'){
return true;
function onArbitraryAction(General $general, string $actionType, ?string $phase = null, $aux = null): ?array
{
if($actionType != '장비매매'){
return $aux;
}
return false;
if($phase != '구매'){
return $aux;
}
$general->setAuxVar(static::REMAIN_KEY, 3);
return $aux;
}
function tryConsumeNow(General $general, string $actionType, string $command):bool{
if($actionType != 'GeneralTrigger'){
return false;
}
if($command != 'che_아이템치료'){
return false;
}
$remainCnt = $general->getAuxVar(static::REMAIN_KEY)??1;
if($remainCnt > 1){
$general->setAuxVar(static::REMAIN_KEY, $remainCnt - 1);
return false;
}
$general->setAuxVar(static::REMAIN_KEY, null);
return true;
}
}
+3 -2
View File
@@ -3,6 +3,7 @@ namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
use \sammo\BaseWarUnitTrigger;
use sammo\GameConst;
use \sammo\WarUnit;
use \sammo\WarUnitTriggerCaller;
use \sammo\WarUnitTrigger\능력치변경;
@@ -11,7 +12,7 @@ class che_훈련_청주 extends \sammo\BaseItem{
protected $rawName = '청주';
protected $name = '청주(훈련)';
protected $info = '[전투] 훈련 +6. 1회용';
protected $info = '[전투] 훈련 +40(한도 내). 1회용';
protected $cost = 1000;
protected $consumable = true;
protected $buyable = true;
@@ -19,7 +20,7 @@ class che_훈련_청주 extends \sammo\BaseItem{
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new 능력치변경($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 'train', '+', 6)
new 능력치변경($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 'train', '+', 40, null, GameConst::$maxTrainByWar)
);
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ class BaseItem implements iAction{
return $this->reqSecu;
}
function isConsumableNow(string $actionType, string $command):bool{
function tryConsumeNow(General $general, string $actionType, string $command):bool{
return false;
}
}
+1 -1
View File
@@ -312,7 +312,7 @@ class che_화계 extends Command\GeneralCommand
$this->affectDestCity($injuryCount);
$itemObj = $general->getItem();
if ($itemObj->isConsumableNow('GeneralCommand', '계략') && $itemObj->isConsumableNow('GeneralCommand', '계략')) {
if ($itemObj->tryConsumeNow($general, 'GeneralCommand', '계략')) {
$itemName = $itemObj->getName();
$itemRawName = $itemObj->getRawName();
$josaUl = JosaUtil::pick($itemRawName, '을');
@@ -34,7 +34,7 @@ class che_아이템치료 extends BaseGeneralTrigger{
$josaUl = JosaUtil::pick($itemRawName, '을');
$general->getLogger()->pushGeneralActionLog("<C>{$itemName}</>{$josaUl} 사용하여 치료합니다!", ActionLogger::PLAIN);
if($itemObj->isConsumableNow('GeneralTrigger', 'che_아이템치료')){
if($itemObj->tryConsumeNow($general, 'GeneralTrigger', 'che_아이템치료')){
$general->deleteItem();
}
}