코드 병합

This commit is contained in:
2018-09-29 22:37:30 +09:00
38 changed files with 831 additions and 150 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ class GameConstBase
/** @var float 훈련시 사기 감소율*/
public static $atmosSideEffectByTraining = 1;
/** @var float 계략 기본 성공률*/
public static $sabotageDefaultProb = 0.15;
public static $sabotageDefaultProb = 0.35;
/** @var int 계략시 확률 가중치(수치가 클수록 변화가 적음 : (지력차/$firing + $basefiring)*/
public static $sabotageProbCoefByStat = 300;
/** @var int 계략시 최소 수치 감소량*/
+1 -1
View File
@@ -38,7 +38,7 @@ class GameUnitConstBase{
100, 100, 7, 0, 0, 99, 9,
999999, null, null, 999999,
[],//성벽은 공격할 수 없다.
[],
[self::T_FOOTMAN=>1.2],
['성벽입니다.','생성할 수 없습니다.']
],
+16 -1
View File
@@ -8,6 +8,9 @@ use \sammo\GameUnitConst;
class NPC{
public $generalID = null;
public $realName = null;
public $affinity;
public $name;
public $picturePath;
@@ -24,6 +27,16 @@ class NPC{
public $charWar = 0;
public $npc = 2;
public $text;
static $prefixList = [
1 => 'ⓝ', //빙의 NPC
2 => 'ⓝ', //NPC
3 => 'ⓜ', //인탐 장수
4 => 'ⓖ', //의병장(전략)
5 => '㉥', //부대장
6 => 'ⓤ', //unselectable npc, 빙의 불가 npc
9 => 'ⓞ', //오랑캐?
];
//[ 1, "헌제",1002, 1, null, 17, 13, 61, 0, 170, 250, "안전", null, "산 넘어 산이로구나..."],
public function __construct(
@@ -162,7 +175,8 @@ class NPC{
$charDomestic = GameConst::$defaultSpecialDomestic;
}
$name = ''.$this->name;
$name = (static::$prefixList[$this->npc]?:'').$this->name;
$this->realName = $name;
$picturePath = $this->picturePath;
if($env['show_img_level'] < 3){
@@ -266,6 +280,7 @@ class NPC{
'bornyear'=>$this->birth,
'deadyear'=>$this->death
]);
$this->generalID = $db->insertId();
return true; //생성되었다.
}
+15 -8
View File
@@ -271,8 +271,8 @@ class WarUnit{
$this->computeWarPower();
}
function checkBattleBeginSkill():bool{
return false;
function checkBattleBeginSkill(){
yield true;
}
function checkBattleBeginItem():bool{
@@ -287,6 +287,13 @@ class WarUnit{
return $this->activatedSkill[$skillName] ?? false;
}
function hasActivatedSkillOnLog(string $skillName):bool{
if(key_exists($skillName, $this->logActivatedSkill)){
return true;
}
return $this->hasActivatedSkill($skillName);
}
function activateSkill(... $skillNames){
foreach($skillNames as $skillName){
$this->activatedSkill[$skillName] = true;
@@ -299,16 +306,16 @@ class WarUnit{
}
}
function checkPreActiveSkill():bool{
return false;
function checkPreActiveSkill(){
yield true;
}
function checkActiveSkill():bool{
return false;
function checkActiveSkill(){
yield true;
}
function checkPostActiveSkill():bool{
return false;
function checkPostActiveSkill(){
yield true;
}
function applyActiveSkill(){
+60 -33
View File
@@ -219,6 +219,9 @@ class WarUnitGeneral extends WarUnit{
else if($specialWar == 61){
$myWarPowerMultiply *= 1.10;
}
else if($specialWar == 62){
$opposeWarPowerMultiply *= 0.95;
}
else if($specialWar == 50){
if($this->isAttacker){
$opposeWarPowerMultiply *= 0.9;
@@ -346,22 +349,35 @@ class WarUnitGeneral extends WarUnit{
}
///전투 개시 시에 작동하여 매 장수마다 작동하는 스킬
function checkBattleBeginSkill():bool{
$skillResult = false;
function checkBattleBeginSkill(){
$oppose = $this->getOppose();
$specialWar = $this->getSpecialWar();
if(
$this->getCrewType()->armType == GameUnitConst::T_SIEGE &&
$oppose->getCrewType()->armType == GameUnitConst::T_CASTLE
){
$this->activateSkill('부상무효');
}
yield true;
if($specialWar == 62){
$oppose->activateSkill('저격불가');
$this->activateSkill('부상무효');
}
yield true;
if (
$specialWar == 70 &&
$this->oppose instanceof WarUnitGeneral &&
!$this->hasActivatedSkill('저격') &&
!$this->hasActivatedSkill('저격불가') &&
Util::randBool(1/3)
) {
$this->activateSkill('저격');
$skillResult = true;
}
return $skillResult;
yield true;
}
///전투 개시 시에 작동하여 매 장수마다 작동하는 아이템
@@ -380,6 +396,7 @@ class WarUnitGeneral extends WarUnit{
$item == 2 &&
$this->oppose instanceof WarUnitGeneral &&
!$this->hasActivatedSkill('저격') &&
!$this->hasActivatedSkill('저격불가') &&
Util::randBool(1/5)
){
//수극
@@ -491,7 +508,7 @@ class WarUnitGeneral extends WarUnit{
return $this->killed;
}
function checkPreActiveSkill():bool{
function checkPreActiveSkill(){
$activated = false;
$oppose = $this->getOppose();
@@ -499,34 +516,33 @@ class WarUnitGeneral extends WarUnit{
$item = $this->getItem();
$crewType = $this->getCrewType();
if($specialWar == 62){
$oppose->activateSkill('필살불가');
$oppose->activateSkill('위압불가');
$oppose->activateSkill('격노불가');
$oppose->activateSkill('계략약화');
}
yield true;
if(
$specialWar == 63 &&
$this->getPhase() == 0 &&
$this->getHP() >= 1000 &&
$this->getComputedAtmos() >= 90 &&
$this->getComputedTrain() >= 90
$this->getComputedTrain() >= 90 &&
!$this->hasActivatedSkill('위압불가')
){
$this->activateSkill('위압');
$activated = true;
}
if($specialWar == 62){
$oppose->activateSkill('필살불가');
$oppose->activateSkill('계략약화');
$activated = true;
}
yield true;
if($specialWar == 60){
$oppose->activateSkill('회피불가');
$oppose->activateSkill('저지불가');
}
return $activated;
yield true;
}
function checkActiveSkill():bool{
$activated = false;
function checkActiveSkill(){
$oppose = $this->getOppose();
$specialWar = $this->getSpecialWar();
$item = $this->getItem();
@@ -542,9 +558,9 @@ class WarUnitGeneral extends WarUnit{
$ratio = $this->getComputedAtmos() + $this->getComputedTrain();
if(Util::randBool($ratio / 400)){
$this->activateSkill('특수', '저지');
$activated = true;
}
}
yield true;
if(
!$this->hasActivatedSkill('특수') &&
@@ -552,8 +568,8 @@ class WarUnitGeneral extends WarUnit{
Util::randBool($this->getComputedCriticalRatio())
){
$this->activateSkill('특수', '필살시도', '필살');
$activated = true;
}
yield true;
if(
!$this->hasActivatedSkill('특수') &&
@@ -561,8 +577,8 @@ class WarUnitGeneral extends WarUnit{
Util::randBool($this->getComputedAvoidRatio())
){
$this->activateSkill('특수', '회피시도', '회피');
$activated = true;
}
yield true;
//계략
if($crewType->magicCoef){
@@ -607,17 +623,16 @@ class WarUnitGeneral extends WarUnit{
}
}
}
yield true;
//의술
if($specialWar == 73 && Util::randBool(0.2)){
$this->activateSkill('치료');
$activated = true;
}
return $activated;
yield true;
}
function checkPostActiveSkill():bool{
function checkPostActiveSkill(){
$activated = false;
$oppose = $this->getOppose();
@@ -625,7 +640,11 @@ class WarUnitGeneral extends WarUnit{
$item = $this->getItem();
$crewType = $this->getCrewType();
if($specialWar == 74 && $oppose->hasActivatedSkill('필살')){
if(
$specialWar == 74 &&
$oppose->hasActivatedSkill('필살') &&
!$this->hasActivatedSkill('격노불가')
){
if($this->isAttacker){
if(Util::randBool(1/3)){
$this->activateSkill('진노', '격노');
@@ -643,10 +662,12 @@ class WarUnitGeneral extends WarUnit{
}
}
}
yield true;
if(
$specialWar == 74 &&
$oppose->hasActivatedSkill('회피')
$oppose->hasActivatedSkill('회피') &&
!$this->hasActivatedSkill('격노불가')
){
if($this->isAttacker){
if(Util::randBool(1/3)){
@@ -668,6 +689,7 @@ class WarUnitGeneral extends WarUnit{
}
}
}
yield true;
if(
($item == 23 || $item == 24) &&
@@ -677,6 +699,7 @@ class WarUnitGeneral extends WarUnit{
$this->activateSkill('치료');
$activated = true;
}
yield true;
//계략
if(
@@ -688,6 +711,7 @@ class WarUnitGeneral extends WarUnit{
$oppose->deactivateSkill('계략');
$activated = true;
}
yield true;
if(
$specialWar == 42 &&
@@ -695,6 +719,7 @@ class WarUnitGeneral extends WarUnit{
){
$this->warPowerMultiply *= 1.3;
}
yield true;
if(
$specialWar == 43 &&
@@ -702,8 +727,7 @@ class WarUnitGeneral extends WarUnit{
){
$this->warPowerMultiply *= 1.5;
}
return $activated;
yield true;
}
function applyActiveSkill(){
@@ -717,8 +741,8 @@ class WarUnitGeneral extends WarUnit{
if($this->hasActivatedSkill('저지')){
$this->addDex($oppose->getCrewType(), $oppose->getWarPower() * 0.5 * 0.9);
$this->addDex($this->getCrewType(), $this->getWarPower() * 0.5 * 0.9);
$this->addDex($oppose->getCrewType(), $oppose->getWarPower() * 0.9);
$this->addDex($this->getCrewType(), $this->getWarPower() * 0.9);
$this->setWarPowerMultiply(0);
$oppose->setWarPowerMultiply(0);
@@ -894,6 +918,9 @@ class WarUnitGeneral extends WarUnit{
}
function tryWound():bool{
if($this->hasActivatedSkillOnLog('부상무효')){
return false;
}
if(!Util::randBool(0.05)){
return false;
}