전투 구현 반영
This commit is contained in:
@@ -156,7 +156,7 @@ class GameUnitDetail{
|
|||||||
$ratio = max($mainstat - 65, 0);
|
$ratio = max($mainstat - 65, 0);
|
||||||
$ratio *= $coef;
|
$ratio *= $coef;
|
||||||
|
|
||||||
return min(50, $ratio);
|
return min(50, $ratio) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid($ownCities, $ownRegions, $relativeYear, $tech){
|
public function isValid($ownCities, $ownRegions, $relativeYear, $tech){
|
||||||
|
|||||||
@@ -260,7 +260,11 @@ class WarUnit{
|
|||||||
return GameConst::$maxAtmosByCommand;
|
return GameConst::$maxAtmosByCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getComputedAvoidRatio(){
|
function getComputedCriticalRatio():float{
|
||||||
|
return $this->getCrewType()->getCriticalRatio($this->getRaw());
|
||||||
|
}
|
||||||
|
|
||||||
|
function getComputedAvoidRatio():float{
|
||||||
return $this->getCrewType()->avoid / 100;
|
return $this->getCrewType()->avoid / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-20
@@ -2,43 +2,33 @@
|
|||||||
namespace sammo;
|
namespace sammo;
|
||||||
|
|
||||||
class WarUnitCity extends WarUnit{
|
class WarUnitCity extends WarUnit{
|
||||||
protected $logger;
|
|
||||||
protected $crewType;
|
|
||||||
|
|
||||||
protected $hp;
|
protected $hp;
|
||||||
|
|
||||||
protected $rice = 0;
|
protected $cityRate;
|
||||||
public $cityRate;
|
|
||||||
|
|
||||||
protected $updatedVar = [];
|
|
||||||
|
|
||||||
protected $year;
|
|
||||||
protected $month;
|
|
||||||
|
|
||||||
function __construct($raw, $rawNation, $year, $month, $cityRate){
|
function __construct($raw, $rawNation, $year, $month, $cityRate){
|
||||||
$this->raw = $raw;
|
$this->raw = $raw;
|
||||||
$this->rawNation = $rawNation;
|
$this->rawNation = $rawNation;
|
||||||
|
|
||||||
$this->year = $year;
|
|
||||||
$this->month = $month;
|
|
||||||
|
|
||||||
$this->isAttacker = false;
|
$this->isAttacker = false;
|
||||||
$this->cityRate = $cityRate;
|
$this->cityRate = $cityRate;
|
||||||
|
|
||||||
$this->logger = new ActionLogger(0, $raw['nation'], $year, $month, false);
|
$this->logger = new ActionLogger(
|
||||||
$this->crewType = GameUnitConst::byID($raw['crewtype']);
|
0,
|
||||||
|
$this->getVar('nation'),
|
||||||
$this->rice = $this->getNationVar('rice');
|
$year,
|
||||||
|
$month,
|
||||||
|
false
|
||||||
|
);
|
||||||
$this->crewType = GameUnitConst::byID(GameUnitConst::T_CASTLE);
|
$this->crewType = GameUnitConst::byID(GameUnitConst::T_CASTLE);
|
||||||
|
|
||||||
$this->hp = $this->getVar('def') * 10;
|
$this->hp = $this->getVar('def') * 10;
|
||||||
|
|
||||||
//수비자 보정
|
//수비자 보정
|
||||||
if($raw['level'] == 1){
|
if($this->getCityVar('level') == 1){
|
||||||
$this->trainBonus += 5;
|
$this->trainBonus += 5;
|
||||||
}
|
}
|
||||||
else if($raw['level'] == 3){
|
else if($this->getCityVar('level') == 3){
|
||||||
$this->trainBonus += 5;
|
$this->trainBonus += 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,6 +37,10 @@ class WarUnitCity extends WarUnit{
|
|||||||
return $this->getVar('name');
|
return $this->getVar('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCityVar(string $key){
|
||||||
|
return $this->raw[$key];
|
||||||
|
}
|
||||||
|
|
||||||
function calcDamage():int{
|
function calcDamage():int{
|
||||||
$warPower = $this->getWarPower();
|
$warPower = $this->getWarPower();
|
||||||
$warPower *= Util::randRange(0.9, 1.1);
|
$warPower *= Util::randRange(0.9, 1.1);
|
||||||
@@ -94,6 +88,7 @@ class WarUnitCity extends WarUnit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addLose(){
|
function addLose(){
|
||||||
|
//NOTE: 도시 정복은 외부에서 처리함
|
||||||
}
|
}
|
||||||
|
|
||||||
function heavyDecreseWealth(){
|
function heavyDecreseWealth(){
|
||||||
|
|||||||
@@ -4,13 +4,6 @@ namespace sammo;
|
|||||||
class WarUnitGeneral extends WarUnit{
|
class WarUnitGeneral extends WarUnit{
|
||||||
protected $rawCity;
|
protected $rawCity;
|
||||||
|
|
||||||
protected $logger;
|
|
||||||
protected $crewType;
|
|
||||||
|
|
||||||
protected $win = 0;
|
|
||||||
|
|
||||||
protected $updatedVar = [];
|
|
||||||
|
|
||||||
function __construct($raw, $rawCity, $rawNation, $isAttacker, $year, $month){
|
function __construct($raw, $rawCity, $rawNation, $isAttacker, $year, $month){
|
||||||
setLeadershipBonus($raw, $rawNation['level']);
|
setLeadershipBonus($raw, $rawNation['level']);
|
||||||
|
|
||||||
@@ -107,17 +100,49 @@ class WarUnitGeneral extends WarUnit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getComputedAtmos(){
|
function getComputedAtmos(){
|
||||||
return GameConst::$maxAtmosByCommand;
|
$train = $this->getVar('atmos');
|
||||||
|
$train += $this->trainBonus;
|
||||||
|
|
||||||
|
return $train;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getComputedAvoidRatio(){
|
function getComputedCriticalRatio():float{
|
||||||
|
$critialRatio = $this->getCrewType()->getCriticalRatio($this->getRaw());
|
||||||
|
|
||||||
|
$specialWar = $this->getSpecialWar();
|
||||||
|
$item = $this->getItem();
|
||||||
|
|
||||||
|
if($this->isAttacker && $specialWar == 61){
|
||||||
|
$critialRatio += 0.1;
|
||||||
|
}
|
||||||
|
if($specialWar == 71){
|
||||||
|
$critialRatio += 0.2;
|
||||||
|
}
|
||||||
|
return $critialRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getComputedAvoidRatio():float{
|
||||||
|
$specialWar = $this->getSpecialWar();
|
||||||
|
$item = $this->getItem();
|
||||||
|
|
||||||
$avoidRatio = $this->getCrewType()->avoid / 100;
|
$avoidRatio = $this->getCrewType()->avoid / 100;
|
||||||
|
$avoidRatio *= $this->getComputedTrain() / 100;
|
||||||
|
|
||||||
|
//특기보정 : 궁병
|
||||||
|
if($specialWar == 51){
|
||||||
|
$avoidRatio += 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//도구 보정 : 둔갑천서, 태평요술
|
||||||
|
if($item == 26 || $item == 25){
|
||||||
|
$avoidRatio += 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $avoidRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addWin(){
|
function addWin(){
|
||||||
$this->win += 1;
|
|
||||||
$this->increaseVar('killnum', 1);
|
$this->increaseVar('killnum', 1);
|
||||||
|
|
||||||
$this->multiplyVarWithLimit('atmos', 1.1, null, GameConst::$maxAtmosByWar);
|
$this->multiplyVarWithLimit('atmos', 1.1, null, GameConst::$maxAtmosByWar);
|
||||||
|
|
||||||
$this->addStatExp(1);
|
$this->addStatExp(1);
|
||||||
@@ -425,15 +450,61 @@ class WarUnitGeneral extends WarUnit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkPreActiveSkill():bool{
|
function checkPreActiveSkill():bool{
|
||||||
return false;
|
$activated = false;
|
||||||
|
|
||||||
|
$oppose = $this->getOppose();
|
||||||
|
$specialWar = $this->getSpecialWar();
|
||||||
|
$item = $this->getItem();
|
||||||
|
|
||||||
|
return $activated;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkActiveSkill():bool{
|
function checkActiveSkill():bool{
|
||||||
return false;
|
$activated = false;
|
||||||
|
|
||||||
|
$oppose = $this->getOppose();
|
||||||
|
$specialWar = $this->getSpecialWar();
|
||||||
|
$item = $this->getItem();
|
||||||
|
|
||||||
|
return $activated;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPostActiveSkill():bool{
|
function checkPostActiveSkill():bool{
|
||||||
return false;
|
$activated = false;
|
||||||
|
|
||||||
|
$oppose = $this->getOppose();
|
||||||
|
$specialWar = $this->getSpecialWar();
|
||||||
|
$item = $this->getItem();
|
||||||
|
|
||||||
|
if(
|
||||||
|
!$this->hasActivatedSkill('특수') &&
|
||||||
|
Util::randBool($this->getComputedCriticalRatio())
|
||||||
|
){
|
||||||
|
$this->activateSkill('특수');
|
||||||
|
$this->activateSkill('필살');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(
|
||||||
|
!$this->hasActivatedSkill('특수') &&
|
||||||
|
Util::randBool($this->getComputedAvoidRatio())
|
||||||
|
){
|
||||||
|
$this->activateSkill('특수');
|
||||||
|
$this->activateSkill('회피');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(
|
||||||
|
$specialWar == 63 &&
|
||||||
|
$this->getPhase() == 0 &&
|
||||||
|
$this->getHP() >= 1000 &&
|
||||||
|
$this->getComputedAtmos() >= 90 &&
|
||||||
|
$this->getComputedTrain() >= 90
|
||||||
|
){
|
||||||
|
$this->activateSkill('위압');
|
||||||
|
$activated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $activated;
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyActiveSkill():bool{
|
function applyActiveSkill():bool{
|
||||||
|
|||||||
Reference in New Issue
Block a user