game: 이민족 발동 관련 변경
- 이민족 멸망 후 타국가 임관 - 이민족 발동 시 명성을 평균치로
This commit is contained in:
@@ -55,6 +55,11 @@ class AllowJoinDestNation extends Constraint{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(($this->general['npc'] != 9) && \str_starts_with($this->destNation['name'], 'ⓞ')){
|
||||
$this->reason = "이민족 국가에 임관할 수 없습니다.";
|
||||
return false;
|
||||
}
|
||||
|
||||
$joinedNations = $this->general['auxVar']['joinedNations']??[];
|
||||
if(in_array($this->destNation['nation'], $joinedNations)){
|
||||
$this->reason = "이미 임관했었던 국가입니다.";
|
||||
|
||||
@@ -14,9 +14,9 @@ class AutoDeleteInvader extends \sammo\Event\Action{
|
||||
public function run(array $env){
|
||||
$db = DB::db();
|
||||
if(getNationStaticInfo($this->nationID)===null){
|
||||
$db->update('general', [
|
||||
/*$db->update('general', [
|
||||
'killturn'=>5
|
||||
], 'nation = 0 AND npc = 9');
|
||||
], 'nation = 0 AND npc = 9');*/
|
||||
$eventID = Util::array_get($env['currentEventID']);
|
||||
$db->delete('event', 'id = %i', $eventID);
|
||||
return [__CLASS__, "Not Exists"];
|
||||
@@ -33,14 +33,14 @@ class AutoDeleteInvader extends \sammo\Event\Action{
|
||||
'arg'=>'[]',
|
||||
'brief'=>"이민족 방랑"
|
||||
], 'general_id = %i', $rulerID);
|
||||
$db->update('general', [
|
||||
/*$db->update('general', [
|
||||
'killturn'=>5
|
||||
], 'nation = %i', $this->nationID);
|
||||
], 'nation = %i', $this->nationID);*/
|
||||
|
||||
$eventID = Util::array_get($env['currentEventID']);
|
||||
$db->delete('event', 'id = %i', $eventID);
|
||||
|
||||
return [__CLASS__, 'Deleted'];
|
||||
return [__CLASS__, 'Deleted'];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,12 +16,12 @@ use function sammo\refreshNationStaticInfo;
|
||||
|
||||
/**
|
||||
* 이민족 침입을 모사
|
||||
*
|
||||
*
|
||||
* 양수 : 정해진 값. [절대값]
|
||||
* 음수 : 합산(장수 등), 혹은 평균(기술 등)을 곱해 적용한 값 [상대값]
|
||||
*
|
||||
* event_1.php, 센 이민족 : npcEachCount = -0.5, specAvg = 195, tech = 15000, dex = 450000
|
||||
* event_2.php, 약한 이민족 : npcEachCount = -0.5, specAvg = 150, tech = -1, dex = 0
|
||||
*
|
||||
* event_1.php, 센 이민족 : npcEachCount = -2, specAvg = 195, tech = 15000, dex = 450000
|
||||
* event_2.php, 약한 이민족 : npcEachCount = -2, specAvg = 150, tech = -1, dex = 0
|
||||
* event_3.php, 엄청 약한 이민족 : npcEachCount = 100, specAvg = 50, tech = 0, dex = 0
|
||||
*/
|
||||
class RaiseInvader extends \sammo\Event\Action
|
||||
@@ -105,10 +105,10 @@ class RaiseInvader extends \sammo\Event\Action
|
||||
|
||||
$specAvg = $this->specAvg;
|
||||
if ($specAvg < 0) {
|
||||
$specAvg = $db->queryFirstField('SELECT avg((`leadership` + `strength` + `intel`)/3) from general where npc < 4');
|
||||
$specAvg = $db->queryFirstField('SELECT avg((`leadership` + `strength` + `intel`)) from general where npc < 4');
|
||||
$specAvg *= -1 * $this->specAvg;
|
||||
}
|
||||
$specAvg = Util::toInt($specAvg);
|
||||
$specAvg = Util::toInt($specAvg / 3);
|
||||
|
||||
$tech = $this->tech;
|
||||
if ($tech < 0) {
|
||||
@@ -131,6 +131,8 @@ class RaiseInvader extends \sammo\Event\Action
|
||||
$db->queryFirstField("SELECT max(`nation`) FROM `ng_old_nations` WHERE server_id = %s", $serverID),
|
||||
);
|
||||
|
||||
$exp = $db->queryFirstField("SELECT avg(experience) from general where npc < 6");
|
||||
|
||||
|
||||
$db->update('general', [
|
||||
'gold' => 999999,
|
||||
@@ -163,9 +165,10 @@ class RaiseInvader extends \sammo\Event\Action
|
||||
->setNPCType(9)
|
||||
->setStat(Util::toInt($specAvg * 1.8), Util::toInt($specAvg * 1.8), Util::toInt($specAvg * 1.2))
|
||||
->setAffinity(999)
|
||||
->setExpDed($exp * 1.2, null)
|
||||
->setGoldRice(99999, 99999);
|
||||
$ruler->build($env);
|
||||
|
||||
|
||||
$nationObj->addGeneral($ruler);
|
||||
|
||||
foreach (Util::range(1, $npcEachCount) as $invaderGenIdx) {
|
||||
@@ -176,6 +179,7 @@ class RaiseInvader extends \sammo\Event\Action
|
||||
->setCityID($cityObj->id)
|
||||
->setNPCType(9)
|
||||
->setAffinity(999)
|
||||
->setExpDed($exp, null)
|
||||
->setGoldRice(99999, 99999);
|
||||
|
||||
$leadership = Util::randRangeInt(Util::toInt($specAvg * 1.2), Util::toInt($specAvg * 1.4));
|
||||
@@ -196,23 +200,20 @@ class RaiseInvader extends \sammo\Event\Action
|
||||
$gen->build($env);
|
||||
$nationObj->addGeneral($gen);
|
||||
}
|
||||
|
||||
|
||||
$nationObj->postBuild($env);
|
||||
refreshNationStaticInfo();
|
||||
$db->insert('event', [
|
||||
'condition' => Json::encode(true),
|
||||
'action' => Json::encode([["AutoDeleteInvader", $invaderNationID]]),
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
$db->insert('event', [
|
||||
'condition' => Json::encode(true),
|
||||
'action' => Json::encode([["InvaderEnding"]]),
|
||||
]);
|
||||
|
||||
$db->update('nation', [
|
||||
'scout' => 1
|
||||
], 'nation IN %li', $invaderNationIDList);
|
||||
$db->update('diplomacy', [
|
||||
'state' => 1,
|
||||
'term' => 24,
|
||||
|
||||
Reference in New Issue
Block a user