스킬 안 쓰는 버그 해결

This commit is contained in:
2020-04-26 23:52:17 +09:00
parent 724c7388af
commit 34a863a6ea
25 changed files with 178 additions and 25 deletions
+1 -1
View File
@@ -359,7 +359,7 @@ function getWarUnitTriggerClass(string $type){
}
function buildWarUnitTriggerClass(?string $type, WarUnit $unit, ?array $args = null):BaseWarUnitTrigger{
$classPath = getNationCommandClass($type);
$classPath = getWarUnitTriggerClass($type);
if(!$args){
return new $classPath($unit);
}
-2
View File
@@ -31,8 +31,6 @@ if($query === null){
]);
}
LogText('simulate', $query);
$defaultCheck = [
'required'=>[
'attackerGeneral', 'attackerCity', 'attackerNation',
-1
View File
@@ -769,7 +769,6 @@ jQuery(function($){
type:'post',
url:'j_simulate_battle.php',
dataType:'json',
contentType: "application/json",
data:{
action:'reorder',
query:JSON.stringify(data),
+1 -1
View File
@@ -53,6 +53,6 @@ function MessageBox($str)
function LogText($prefix, $variable)
{
$text = sprintf('%s : %s'."\r\n", $prefix, var_export($variable, true));
$text = sprintf('%s : %s'."\r\n", $prefix, TVarDumper::dump($variable));
file_put_contents(ROOT.'/d_log/dbg_logs.txt', $text, FILE_APPEND);
}
+2 -2
View File
@@ -29,8 +29,8 @@ class che_보병 extends \sammo\BaseSpecial{
public function getWarPowerMultiplier(WarUnit $unit):array{
if($unit->isAttacker()){
return [0, 0.9];
return [1, 0.9];
}
return [0, 0.8];
return [1, 0.8];
}
}
+8 -2
View File
@@ -18,7 +18,13 @@ abstract class BaseWarUnitTrigger extends ObjectTrigger{
public function getUniqueID():string{
$priority = $this->priority;
$fqn = static::class;
return "{$priority}_{$fqn}_{$this->raiseType}";
if($this->object === null){
$objID = '';
}
else{
$objID = spl_object_id($this->object);
}
return "{$priority}_{$fqn}_{$objID}_{$this->raiseType}";
}
public function action(?array $env=null, $arg=null):?array{
@@ -53,7 +59,7 @@ abstract class BaseWarUnitTrigger extends ObjectTrigger{
$env['e_attacker'] = $isAttacker?$selfEnv:$opposeEnv;
$env['e_defender'] = $isAttacker?$opposeEnv:$selfEnv;
if($callNextAction){
if(!$callNextAction){
$env['stopNextAction'] = true;
}
+7 -1
View File
@@ -25,6 +25,12 @@ abstract class ObjectTrigger{
public function getUniqueID():string{
$priority = $this->priority;
$fqn = static::class;
return "{$priority}_{$fqn}";
if($this->object === null){
$objID = '';
}
else{
$objID = spl_object_id($this->object);
}
return "{$priority}_{$fqn}_{$objID}";
}
}
+7 -7
View File
@@ -127,7 +127,7 @@ class SpecialityHelper{
}
if(!$onlyAvailable){
foreach(GameConst::$availableSpecialDomestic as $specialID){
foreach(GameConst::$optionalSpecialDomestic as $specialID){
$specialObj = buildGeneralSpecialDomesticClass($specialID);
$result[$specialID] = $specialObj;
}
@@ -140,18 +140,18 @@ class SpecialityHelper{
public static function getSpecialWarList(bool $onlyAvailable=true):array{
$result = [];
if(!$onlyAvailable){
$specialObj = buildGeneralSpecialDomesticClass(GameConst::$defaultSpecialDomestic);
$result[GameConst::$defaultSpecialDomestic] = $specialObj;
$specialObj = buildGeneralSpecialWarClass(GameConst::$defaultSpecialWar);
$result[GameConst::$defaultSpecialWar] = $specialObj;
}
foreach(GameConst::$availableSpecialDomestic as $specialID){
$specialObj = buildGeneralSpecialDomesticClass($specialID);
foreach(GameConst::$availableSpecialWar as $specialID){
$specialObj = buildGeneralSpecialWarClass($specialID);
$result[$specialID] = $specialObj;
}
if(!$onlyAvailable){
foreach(GameConst::$availableSpecialDomestic as $specialID){
$specialObj = buildGeneralSpecialDomesticClass($specialID);
foreach(GameConst::$optionalSpecialWar as $specialID){
$specialObj = buildGeneralSpecialWarClass($specialID);
$result[$specialID] = $specialObj;
}
}
+1 -1
View File
@@ -119,7 +119,7 @@ abstract class TriggerCaller{
}
function fire(?array $env = null, $arg = null):?array{
foreach($this->triggerListByPriority as $subTriggerList){
foreach($this->triggerListByPriority as $priority=>$subTriggerList){
/** @var ObjectTrigger[] $subTriggerList */
foreach($subTriggerList as $trigger){
$env = $trigger->action($env, $arg);
@@ -7,6 +7,7 @@ use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
use sammo\ActionLogger;
class che_격노발동 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_POST + 600;
@@ -7,6 +7,7 @@ use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
use sammo\ActionLogger;
class che_계략발동 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_POST + 100;
@@ -28,7 +29,7 @@ class che_계략발동 extends BaseWarUnitTrigger{
$damage = $general->onCalcStat($general, 'warMagicFailDamage', $damage, $magic);
$josaUl = \sammo\JosaUtil::pick($magic, '을');
$general->pushGeneralBattleDetailLog("<D>{$magic}</>{$josaUl} <C>성공</>했다!", ActionLogger::PLAIN);
$general->getLogger()->pushGeneralBattleDetailLog("<D>{$magic}</>{$josaUl} <C>성공</>했다!", ActionLogger::PLAIN);
$oppose->getLogger()->pushGeneralBattleDetailLog("<D>{$magic}</>에 당했다!", ActionLogger::PLAIN);
$self->multiplyWarPowerMultiply($damage);
@@ -6,6 +6,7 @@ use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\ObjectTrigger;
use sammo\Util;
class che_계략시도 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_PRE + 300;
@@ -49,7 +50,7 @@ class che_계략시도 extends BaseWarUnitTrigger{
$magicSuccessProb = 0.7;
$magicSuccessProb = $general->onCalcStat($general, 'warMagicSuccessProb', $magicSuccessProb);
if($this->hasActivatedSkill('계략약화')){
if($self->hasActivatedSkill('계략약화')){
$magicSuccessProb -= 0.1; //NOTE: 앞으로 이건 oppose의 onCalcStat에 들어가야하지 않을까?
}
@@ -7,6 +7,7 @@ use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
use sammo\ActionLogger;
class che_계략실패 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_POST + 200;
@@ -28,7 +29,7 @@ class che_계략실패 extends BaseWarUnitTrigger{
$damage = $general->onCalcStat($general, 'warMagicFailDamage', $damage, $magic);
$josaUl = \sammo\JosaUtil::pick($magic, '을');
$general->pushGeneralBattleDetailLog("<D>{$magic}</>{$josaUl} <R>실패</>했다!", ActionLogger::PLAIN);
$general->getLogger()->pushGeneralBattleDetailLog("<D>{$magic}</>{$josaUl} <R>실패</>했다!", ActionLogger::PLAIN);
$oppose->getLogger()->pushGeneralBattleDetailLog("<D>{$magic}</>{$josaUl} 간파했다!", ActionLogger::PLAIN);
$self->multiplyWarPowerMultiply(1/$damage);
@@ -7,6 +7,7 @@ use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
use sammo\ActionLogger;
class che_반계발동 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_POST + 150;
@@ -23,7 +24,7 @@ class che_반계발동 extends BaseWarUnitTrigger{
$josaUl = \sammo\JosaUtil::pick($opposeMagic, '을');
$general->pushGeneralBattleDetailLog("<C>반계</>로 상대의 <D>{$opposeMagic}</>{$josaUl} 되돌렸다!", ActionLogger::PLAIN);
$general->getLogger()->pushGeneralBattleDetailLog("<C>반계</>로 상대의 <D>{$opposeMagic}</>{$josaUl} 되돌렸다!", ActionLogger::PLAIN);
$oppose->getLogger()->pushGeneralBattleDetailLog("<D>{$opposeMagic}</>{$josaUl} <R>역으로</> 당했다!", ActionLogger::PLAIN);
$self->multiplyWarPowerMultiply($damage);
@@ -5,6 +5,7 @@ use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_반계시도 extends BaseWarUnitTrigger{
@@ -7,6 +7,7 @@ use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
use sammo\ActionLogger;
class che_위압발동 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_POST + 700;
@@ -7,6 +7,7 @@ use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
use sammo\ActionLogger;
class che_저격발동 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_POST + 100;
@@ -7,6 +7,7 @@ use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
use sammo\ActionLogger;
class che_저지발동 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_POST; //최우선 순위
@@ -24,8 +25,8 @@ class che_저지발동 extends BaseWarUnitTrigger{
$self->getLogger()->pushGeneralBattleDetailLog("상대를 <C>저지</>했다!", ActionLogger::PLAIN);
$oppose->getLogger()->pushGeneralBattleDetailLog("저지</>당했다!", ActionLogger::PLAIN);
$self->addDex($oppose->getCrewType(), $oppose->getWarPower() * 0.9);
$self->addDex($self->getCrewType(), $self->getWarPower() * 0.9);
$self->getGeneral()->addDex($oppose->getCrewType(), $oppose->getWarPower() * 0.9);
$self->getGeneral()->addDex($self->getCrewType(), $self->getWarPower() * 0.9);
$self->setWarPowerMultiply(0);
$oppose->setWarPowerMultiply(0);
@@ -5,6 +5,7 @@ use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_저지시도 extends BaseWarUnitTrigger{
@@ -7,6 +7,7 @@ use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
use sammo\ActionLogger;
class che_전투치료발동 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_POST + 300;
@@ -24,7 +25,7 @@ class che_전투치료발동 extends BaseWarUnitTrigger{
$oppose->getLogger()->pushGeneralBattleDetailLog("상대가 <C>치료</>했다!", ActionLogger::PLAIN);
$self->getLogger()->pushGeneralBattleDetailLog("<C>치료</>했다!", ActionLogger::PLAIN);
$oppose->getGeneral()->multiplyWarPowerMultiply(1/1.5);
$oppose->multiplyWarPowerMultiply(1/1.5);
$this->processConsumableItem();
@@ -5,6 +5,7 @@ use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_전투치료시도 extends BaseWarUnitTrigger{
@@ -7,6 +7,7 @@ use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
use sammo\ActionLogger;
class che_필살발동 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_POST + 400;
@@ -7,6 +7,7 @@ use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
use sammo\ActionLogger;
class che_회피발동 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_POST + 500;
@@ -6,6 +6,7 @@ use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\ObjectTrigger;
use sammo\Util;
class che_회피시도 extends BaseWarUnitTrigger{
protected $priority = ObjectTrigger::PRIORITY_PRE + 200;
+129
View File
@@ -0,0 +1,129 @@
<?php
namespace sammo;
/**
* TVarDumper class file
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2013 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Util
*/
/**
* TVarDumper class.
*
* TVarDumper is intended to replace the buggy PHP function var_dump and print_r.
* It can correctly identify the recursively referenced objects in a complex
* object structure. It also has a recursive depth control to avoid indefinite
* recursive display of some peculiar variables.
*
* TVarDumper can be used as follows,
* <code>
* echo TVarDumper::dump($var);
* </code>
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id$
* @package System.Util
* @since 3.0
*/
class TVarDumper
{
private static $_objects;
private static $_output;
private static $_depth;
/**
* Converts a variable into a string representation.
* This method achieves the similar functionality as var_dump and print_r
* but is more robust when handling complex objects such as PRADO controls.
* @param mixed variable to be dumped
* @param integer maximum depth that the dumper should go into the variable. Defaults to 10.
* @return string the string representation of the variable
*/
public static function dump($var,$depth=10,$highlight=false)
{
self::$_output='';
self::$_objects=array();
self::$_depth=$depth;
self::dumpInternal($var,0);
if($highlight)
{
$result=highlight_string("<?php\n".self::$_output,true);
return preg_replace('/&lt;\\?php<br \\/>/','',$result,1);
}
else
return self::$_output;
}
private static function dumpInternal($var,$level)
{
switch(gettype($var))
{
case 'boolean':
self::$_output.=$var?'true':'false';
break;
case 'integer':
self::$_output.="$var";
break;
case 'double':
self::$_output.="$var";
break;
case 'string':
self::$_output.="'$var'";
break;
case 'resource':
self::$_output.='{resource}';
break;
case 'NULL':
self::$_output.="null";
break;
case 'unknown type':
self::$_output.='{unknown}';
break;
case 'array':
if(self::$_depth<=$level)
self::$_output.='array(...)';
else if(empty($var))
self::$_output.='array()';
else
{
$keys=array_keys($var);
$spaces=str_repeat(' ',$level*4);
self::$_output.="array\n".$spaces.'(';
foreach($keys as $key)
{
self::$_output.="\n".$spaces." [$key] => ";
self::$_output.=self::dumpInternal($var[$key],$level+1);
}
self::$_output.="\n".$spaces.')';
}
break;
case 'object':
if(($id=array_search($var,self::$_objects,true))!==false)
self::$_output.=get_class($var).'#'.($id+1).'(...)';
else if(self::$_depth<=$level)
self::$_output.=get_class($var).'(...)';
else
{
$id=array_push(self::$_objects,$var);
$className=get_class($var);
$members=(array)$var;
$keys=array_keys($members);
$spaces=str_repeat(' ',$level*4);
self::$_output.="$className#$id\n".$spaces.'(';
foreach($keys as $key)
{
$keyDisplay=strtr(trim($key),array("\0"=>':'));
self::$_output.="\n".$spaces." [$keyDisplay] => ";
self::$_output.=self::dumpInternal($members[$key],$level+1);
}
self::$_output.="\n".$spaces.')';
}
break;
}
}
}