버그 수정

This commit is contained in:
2020-04-27 02:07:34 +09:00
parent ad8acaf296
commit e0036ca32b
18 changed files with 186 additions and 100 deletions
@@ -17,9 +17,7 @@ class che_격노 extends \sammo\BaseSpecial{
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH,
SpecialityHelper::STAT_INTEL
];
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
@@ -17,7 +17,6 @@ class che_견고 extends \sammo\BaseSpecial{
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH
];
@@ -17,8 +17,6 @@ class che_공성 extends \sammo\BaseSpecial{
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_SIEGE,
SpecialityHelper::STAT_STRENGTH | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_SIEGE,
SpecialityHelper::STAT_INTEL | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_SIEGE,
];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
@@ -17,7 +17,6 @@ class che_돌격 extends \sammo\BaseSpecial{
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH
];
@@ -14,7 +14,6 @@ class che_무쌍 extends \sammo\BaseSpecial{
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH
];
@@ -17,7 +17,6 @@ class che_위압 extends \sammo\BaseSpecial{
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH
];
+1 -1
View File
@@ -97,7 +97,7 @@ abstract class BaseWarUnitTrigger extends ObjectTrigger{
$self->activateSkill('아이템소모');
$josaUl = JosaUtil::pick($itemRawName, '을');
$self->getLogger()->pushGeneralActionLog("<C>{$itemName}</>{$josaUl} 사용!", ActionLogger::PLAIN);
$self->general->deleteItem();
$self->getGeneral()->deleteItem();
return true;
}
+1
View File
@@ -208,6 +208,7 @@ class che_징병 extends Command\GeneralCommand{
$general->increaseVar('leadership_exp', 1);
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
$general->setAuxVar('armType', $currCrewType->armType);
tryUniqueItemLottery($general);
$general->applyDB($db);
+32 -38
View File
@@ -2120,13 +2120,30 @@ class GeneralAI
$db = DB::db();
$dex = [
GameUnitConst::T_FOOTMAN => sqrt($general->getVar('dex1') + 500),
GameUnitConst::T_ARCHER => sqrt($general->getVar('dex2') + 500),
GameUnitConst::T_CAVALRY => sqrt($general->getVar('dex3') + 500),
GameUnitConst::T_WIZARD => sqrt($general->getVar('dex4') + 500),
GameUnitConst::T_SIEGE => sqrt($general->getVar('dex5') + 500),
];
$armType =$general->getAuxVar('armType');
if(!$armType){
$dex = [
GameUnitConst::T_FOOTMAN => sqrt($general->getVar('dex1') + 500),
GameUnitConst::T_ARCHER => sqrt($general->getVar('dex2') + 500),
GameUnitConst::T_CAVALRY => sqrt($general->getVar('dex3') + 500),
GameUnitConst::T_WIZARD => sqrt($general->getVar('dex4') + 500),
GameUnitConst::T_SIEGE => sqrt($general->getVar('dex5') + 500),
];
$availableArmType = [];
if($genType & self::t무장){
$availableArmType[GameUnitConst::T_FOOTMAN] = $dex[GameUnitConst::T_FOOTMAN] * $this->fullStrength;
$availableArmType[GameUnitConst::T_ARCHER] = $dex[GameUnitConst::T_ARCHER] * $this->fullStrength;
$availableArmType[GameUnitConst::T_CAVALRY] = $dex[GameUnitConst::T_CAVALRY] * $this->fullStrength;
}
if($genType & self::t지장){
$availableArmType[GameUnitConst::T_WIZARD] = $dex[GameUnitConst::T_WIZARD] * $this->fullIntel * 3;
}
$armType = Util::choiceRandomUsingWeight($availableArmType);
}
$cities = [];
@@ -2139,38 +2156,15 @@ class GeneralAI
$relYear = Util::valueFit($env['year'] - $env['startyear'], 0);
$typesAll = [];
if ($genType & self::t무장) {
$types = [];
$unitType = Util::getKeyOfMaxValue([
GameUnitConst::T_FOOTMAN => $dex[GameUnitConst::T_FOOTMAN] + Util::randRangeInt(0, 50),
GameUnitConst::T_ARCHER => $dex[GameUnitConst::T_ARCHER] + Util::randRangeInt(0, 50),
GameUnitConst::T_CAVALRY => $dex[GameUnitConst::T_CAVALRY] + Util::randRangeInt(0, 50),
]);
foreach (GameUnitConst::byType($unitType) as $crewtype) {
if ($crewtype->isValid($cities, $regions, $relYear, $tech)) {
$score = $dex[$unitType] * $crewtype->pickScore($tech);
$types[] = [$crewtype->id, $score];
}
$types = [];
foreach (GameUnitConst::byType($armType) as $crewtype) {
if ($crewtype->isValid($cities, $regions, $relYear, $tech)) {
$score = $crewtype->pickScore($tech);
$types[] = [$crewtype->id, $score];
}
}
if ($genType & self::t지장) {
$types = [];
foreach (GameUnitConst::byType(GameUnitConst::T_WIZARD) as $crewtype) {
if ($crewtype->isValid($cities, $regions, $relYear, $tech)) {
$score = $dex[GameUnitConst::T_WIZARD] * $crewtype->pickScore($tech);
$types[] = [$crewtype->id, $score];
}
}
foreach ($types as [$crewtype, $score]) {
$typesAll[$crewtype] = [$crewtype, $score / count($types)];
}
}
if ($typesAll) {
if ($types) {
$type = Util::choiceRandomUsingWeightPair($types);
} else {
$type = GameUnitConst::DEFAULT_CREWTYPE;
@@ -2178,7 +2172,7 @@ class GeneralAI
if($this->generalPolicy->can고급병종){
$currType = $general->getCrewTypeObj()->id;
if(key_exists($currType, $typesAll) && $typesAll[$currType][1] >= $typesAll[$type][1]){
if(key_exists($currType, $types) && $types[$currType][1] >= $types[$type][1]){
$type = $currType;
}
}
@@ -2212,7 +2206,7 @@ class GeneralAI
'amount' => $crew
]);
}
else if($gold < $cost){
else if($gold < $cost && $gold * 2 >= $cost){
$crew *= $gold / $cost;
$crew = Util::round($crew-49, -2);
$cmd = buildGeneralCommandClass('che_징병', $general, $env, [
+20 -5
View File
@@ -78,17 +78,31 @@ class SpecialityHelper{
$leadership = $general['leadership']??50;
$strength = $general['strength']??50;
$intel = $general['intel']??50;
if ($leadership * 0.95 > $strength && $leadership * 0.95 > $intel) {
if($leadership > GameConst::$chiefStatMin){
$myCond |= self::STAT_LEADERSHIP;
}
else if($strength >= $intel){
if($strength >= $intel * 0.95 && $strength > GameConst::$chiefStatMin){
$myCond |= self::STAT_STRENGTH;
}
else {
if($intel >= $strength * 0.95 && $intel > GameConst::$chiefStatMin){
$myCond |= self::STAT_INTEL;
}
if($myCond === 0){
if ($leadership * 0.9 > $strength && $leadership * 0.9 > $intel) {
$myCond |= self::STAT_LEADERSHIP;
}
else if($strength >= $intel){
$myCond |= self::STAT_STRENGTH;
}
else {
$myCond |= self::STAT_INTEL;
}
}
return $myCond;
}
@@ -116,7 +130,7 @@ class SpecialityHelper{
return array_rand($dex);
}
return array_keys($dex, max($dex))[0];
return Util::choiceRandom(array_keys($dex, max($dex)));
}
/** @return BaseSpecial[] */
@@ -222,6 +236,7 @@ class SpecialityHelper{
$myCond = static::calcCondGeneric($general);
$myCond |= static::calcCondDexterity($general);
$myCond |= static::REQ_DEXTERITY;
foreach(static::getSpecialWarList() as $specialID=>$specialObj){
$conds = $specialObj::$type;
+4
View File
@@ -56,6 +56,10 @@ class WarUnitGeneral extends WarUnit{
}
}
function addBonusPhase(int $cnt){
$this->bonusPhase += $cnt;
}
function getMaxPhase():int{
$phase = $this->getCrewType()->speed;
$phase = $this->general->onCalcStat($this->general, 'initWarPhase', $phase);
@@ -17,6 +17,8 @@ class che_격노발동 extends BaseWarUnitTrigger{
return true;
}
/** @var WarUnitGeneral $self */
$targetAct = $oppose->hasActivatedSkill('필살')?'필살 공격':'회피 시도';
$is진노 = $self->hasActivatedSkill('진노');
$reaction = $is진노?'진노':'격노';
@@ -25,7 +27,7 @@ class che_격노발동 extends BaseWarUnitTrigger{
$oppose->getLogger()->pushGeneralBattleDetailLog("{$targetAct}에 상대가 <R>{$reaction}</>했다!</>", ActionLogger::PLAIN);
if($is진노){
$self->bonusPhase += 1;
$self->addBonusPhase(1);
}
$self->multiplyWarPowerMultiply($self->criticalDamage());
@@ -22,7 +22,7 @@ class che_저격발동 extends BaseWarUnitTrigger{
}
$selfEnv['저격발동'] = true;
$general = $self->general;
$general = $self->getGeneral();
$oppose->getLogger()->pushGeneralActionLog("상대를 <C>저격</>했다!", ActionLogger::PLAIN);
$oppose->getLogger()->pushGeneralBattleDetailLog("상대를 <C>저격</>했다!", ActionLogger::PLAIN);