diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index 56c1d9c5..36ee4ef0 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -462,9 +462,42 @@ class Hero extends BaseModel { public static function abilityInfoAddition($baseAbility, $row){ $attr = array(); + $chipPageDb = ChipPage::find($row['idx']); + if ($row['quality'] > 1 && $chipPageDb) { + $data = emptyReplace(json_decode($chipPageDb['data'], true), array()); + foreach ($data as $value) { + $chipDb = Chip::find($value['chip_id']); + if (!empty($chipDb)) { + self::mergeAttr($attr, emptyReplace(json_decode($chipDb['rand_attr'], true), array())); + } + } + } + if ($row['quality'] > 1 && $row['skin_id']) { + $skinDb = HeroSkin::find($row['skin_id']); + if (!empty($skinDb)) { + self::mergeAttr($attr, emptyReplace(json_decode($skinDb['rand_attr'], true), array())); + } + } return self::calcAbility($row['hero_id'], $attr); } + public static function mergeAttr(&$tarAttrs, $srcAttrs) + { + foreach ($srcAttrs as $srcAttr) { + $found = false; + foreach ($tarAttrs as &$tarAttr) { + if ($tarAttr['attr_id'] == $srcAttr['attr_id']) { + $tarAttr['val'] += $srcAttr['val']; + $found = true; + break; + } + }//end for tarAttrs + if (!$found) { + array_push($tarAttrs, $srcAttr); + } + } + } + public static function calcAbility($heroId, $attr) { $info = array( 'hp' => 0,