forked from devsam/core
아이템 관련 속성 일부 변경, 유니크 획득 코드를 수정
This commit is contained in:
+37
-17
@@ -1505,9 +1505,18 @@ function tryUniqueItemLottery(General $general, string $acquireType='아이템')
|
||||
return false;
|
||||
}
|
||||
|
||||
if($general->getVar('npc') > 6 || $general->getVar('weap') > 6 || $general->getVar('book') > 6 || $general->getVar('item') > 6){
|
||||
if($general->getVar('npc') > 6){
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach($general->getItems() as $item){
|
||||
if(!$item){
|
||||
continue;
|
||||
}
|
||||
if(!$item->isBuyable()){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$scenario = $gameStor->scenario;
|
||||
$genCount = $db->queryFirstField('SELECT count(*) FROM general WHERE npc<2');
|
||||
@@ -1537,24 +1546,35 @@ function tryUniqueItemLottery(General $general, string $acquireType='아이템')
|
||||
|
||||
//아이템 습득 상황
|
||||
$availableUnique = [];
|
||||
$itemTypes = [
|
||||
'horse'=>'getItemName',
|
||||
'weap'=>'getItemName',
|
||||
'book'=>'getItemName',
|
||||
'item'=>'getItemName'
|
||||
];
|
||||
$itemCodeList = range(7, 26); // [7, 26] 20개
|
||||
|
||||
foreach($itemTypes as $itemType=>$itemNameFunc){
|
||||
foreach($itemCodeList as $itemCode){
|
||||
$availableUnique["{$itemType}_{$itemCode}"] = [$itemType, $itemCode];
|
||||
//TODO: 너무 바보 같다. 장기적으로는 유니크 아이템 테이블 같은게 필요하지 않을까?
|
||||
//일단은 '획득' 시에만 동작하므로 이대로 사용하기로...
|
||||
$occupiedUnique = [];
|
||||
|
||||
foreach (array_keys(GameConst::$allItems) as $itemType) {
|
||||
foreach($db->queryAllLists('SELECT %b, count(*) as cnt FROM general GROUP BY %b', $itemType, $itemType) as [$itemCode, $cnt]){
|
||||
$itemClass = buildItemClass($itemCode);
|
||||
if(!$itemClass){
|
||||
continue;
|
||||
}
|
||||
if($itemClass->isBuyable()){
|
||||
continue;
|
||||
}
|
||||
$occupiedUnique[$itemCode] = $cnt;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: 너무 바보 같다. 장기적으로는 유니크 아이템 테이블 같은게 필요하지 않을까?
|
||||
foreach ($itemTypes as $itemType=>$itemNameFunc) {
|
||||
foreach($db->queryFirstColumn('SELECT %b FROM general WHERE %b > 6', $itemType, $itemType) as $itemCode){
|
||||
unset($availableUnique["{$itemType}_{$itemCode}"]);
|
||||
foreach(GameConst::$allItems as $itemType=>$itemCategories){
|
||||
foreach($itemCategories as $itemCode => $cnt){
|
||||
if(!key_exists($itemCode, $occupiedUnique)){
|
||||
$availableUnique[] = [[$itemType, $itemCode], $cnt];
|
||||
continue;
|
||||
}
|
||||
|
||||
$remain = $cnt - $occupiedUnique[$itemCode];
|
||||
if($remain > 0){
|
||||
$availableUnique[] = [[$itemType, $itemCode], $cnt];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1562,12 +1582,12 @@ function tryUniqueItemLottery(General $general, string $acquireType='아이템')
|
||||
return false;
|
||||
}
|
||||
|
||||
[$itemType, $itemCode] = Util::choiceRandom($availableUnique);
|
||||
[$itemType, $itemCode] = Util::choiceRandomUsingWeightPair($availableUnique);
|
||||
|
||||
$nationName = $general->getStaticNation()['name'];
|
||||
$generalName = $general->getNation();
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
$itemName = ($itemTypes[$itemType])($itemCode);
|
||||
$itemName = getItemName($itemCode);
|
||||
$josaUl = JosaUtil::pick($itemName, '을');
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ class che_계략_이추 extends \sammo\BaseItem{
|
||||
protected static $cost = 1000;
|
||||
protected static $consumable = true;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 1000;
|
||||
|
||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||
if($turnType == '계략'){
|
||||
|
||||
@@ -11,6 +11,7 @@ class che_계략_향낭 extends \sammo\BaseItem{
|
||||
protected static $cost = 3000;
|
||||
protected static $consumable = true;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 2000;
|
||||
|
||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||
if($turnType == '계략'){
|
||||
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_명마_01_노기 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 1000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 1000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_명마_02_조랑 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 3000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 2000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_명마_03_노새 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 6000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 3000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_명마_04_나귀 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 10000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 4000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_명마_05_갈색마 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 15000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 5000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_명마_06_흑색마 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 21000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 6000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_무기_01_단도 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 1000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 1000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_무기_02_단궁 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 3000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 2000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_무기_03_단극 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 6000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 3000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_무기_04_목검 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 10000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 4000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_무기_05_죽창 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 15000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 5000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_무기_06_소부 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 21000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 6000;
|
||||
}
|
||||
@@ -12,6 +12,7 @@ class che_사기_탁주 extends \sammo\BaseItem{
|
||||
protected static $cost = 1000;
|
||||
protected static $consumable = true;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 1000;
|
||||
|
||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller(
|
||||
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_서적_01_효경전 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 1000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 1000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_서적_02_회남자 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 3000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 2000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_서적_03_변도론 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 6000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 3000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_서적_04_건상역주 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 10000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 4000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_서적_05_여씨춘추 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 15000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 5000;
|
||||
}
|
||||
@@ -6,4 +6,5 @@ use \sammo\General;
|
||||
class che_서적_06_사민월령 extends \sammo\BaseStatItem{
|
||||
protected static $cost = 21000;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 6000;
|
||||
}
|
||||
@@ -16,6 +16,7 @@ class che_저격_수극 extends \sammo\BaseItem{
|
||||
protected static $cost = 1000;
|
||||
protected static $consumable = true;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 1000;
|
||||
|
||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller(
|
||||
|
||||
@@ -13,6 +13,7 @@ class che_치료_환약 extends \sammo\BaseItem{
|
||||
protected static $cost = 100;
|
||||
protected static $consumable = true;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 0;
|
||||
|
||||
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
|
||||
return new GeneralTriggerCaller(
|
||||
|
||||
@@ -12,6 +12,7 @@ class che_훈련_청주 extends \sammo\BaseItem{
|
||||
protected static $cost = 1000;
|
||||
protected static $consumable = true;
|
||||
protected static $buyable = true;
|
||||
protected static $reqSecu = 1000;
|
||||
|
||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller(
|
||||
|
||||
@@ -13,6 +13,7 @@ class BaseItem implements iAction{
|
||||
protected static $cost = null;
|
||||
protected static $consumable = false;
|
||||
protected static $buyable = false;
|
||||
protected static $reqSecu = 0;
|
||||
|
||||
function getID(){
|
||||
return $this->id;
|
||||
@@ -34,6 +35,10 @@ class BaseItem implements iAction{
|
||||
return $this->buyable;
|
||||
}
|
||||
|
||||
function getReqSecu(){
|
||||
return static::$reqSecu;
|
||||
}
|
||||
|
||||
function isValidTurnItem(string $actionType, string $command):bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,10 @@ class General implements iAction{
|
||||
return $this->itemObjs['item'];
|
||||
}
|
||||
|
||||
function getItems():array{
|
||||
return $this->itemObjs;
|
||||
}
|
||||
|
||||
function getLastTurn():LastTurn{
|
||||
return $this->lastTurn;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user