forked from devsam/core
회피시도 추가, spl_object_hash를 spl_object_id로 변경
This commit is contained in:
@@ -18,8 +18,8 @@ abstract class ObjectTrigger{
|
||||
abstract public function action(?array $env=null, $arg=null):?array;
|
||||
public function getUniqueID():string{
|
||||
$priority = static::$priority;
|
||||
$hash = spl_object_hash($this->object);
|
||||
$objID = spl_object_id($this->object);
|
||||
$fqn = static::class;
|
||||
return "{$priority}_{$fqn}_{$hash}";
|
||||
return "{$priority}_{$fqn}_{$objID}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace sammo\WarUnitTrigger;
|
||||
use sammo\BaseWarUnitTrigger;
|
||||
use sammo\WarUnitGeneral;
|
||||
use sammo\WarUnitCity;
|
||||
use sammo\WarUnit;
|
||||
use sammo\GameUnitDetail;
|
||||
use sammo\ObjectTrigger;
|
||||
|
||||
class che_회피시도 extends BaseWarUnitTrigger{
|
||||
static protected $priority = ObjectTrigger::PRIORITY_PRE + 200;
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
if(!($self instanceof WarUnitGeneral)){
|
||||
return true;
|
||||
}
|
||||
if($self->hasActivatedSkill('특수')){
|
||||
return true;
|
||||
}
|
||||
if($self->hasActivatedSkill('회피불가')){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!Util::randBool($self->getComputedAvoidRatio())){
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->activateSkill('특수', '회피시도', '회피');
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ class KVStorage{
|
||||
static private $storageList = [];
|
||||
|
||||
static public function getStorage(\MeekroDB $db, string $storNamespace, string $tableName='storage'):self{
|
||||
$obj_id = spl_object_hash($db);
|
||||
$obj_id = spl_object_id($db);
|
||||
$fullKey = $obj_id.','.$storNamespace.','.$tableName;
|
||||
if(key_exists($fullKey, static::$storageList)){
|
||||
return static::$storageList[$fullKey];
|
||||
|
||||
Reference in New Issue
Block a user