Explorar o código

Better stat calculation. Effective HP and DMG. Minor CSS improvements.

Iñigo Valentin %!s(int64=5) %!d(string=hai) anos
pai
achega
e62b52feab

+ 257 - 43
application/entity/Unit.php

@@ -176,6 +176,136 @@
          */
         public $rune_accuracy = 0;
 
+        /**
+         * @var int Unit artifact HP stat.
+         */
+        public $artifact_hp = 0;
+
+        /**
+         * @var int Unit artifact ATK stat.
+         */
+        public $artifact_attack = 0;
+
+        /**
+         * @var int Unit artifact DEF stat.
+         */
+        public $artifact_defense = 0;
+
+        /**
+         * @var int Unit artifact SPD stat.
+         */
+        public $artifact_speed = 0;
+
+        /**
+         * @var int Unit artifact CRR stat.
+         */
+        public $artifact_crit_rate = 0;
+
+        /**
+         * @var int Unit artifact CRD stat.
+         */
+        public $artifact_crit_damage = 0;
+
+        /**
+         * @var int Unit artifact RES stat.
+         */
+        public $artifact_resistance = 0;
+
+        /**
+         * @var int Unit artifact ACC stat.
+         */
+        public $artifact_accuracy = 0;
+
+        /**
+         * @var int Unit building HP stat.
+         */
+        public $building_hp = 0;
+
+        /**
+         * @var int Unit building ATK stat.
+         */
+        public $building_attack = 0;
+
+        /**
+         * @var int Unit building DEF stat.
+         */
+        public $building_defense = 0;
+
+        /**
+         * @var int Unit building SPD stat.
+         */
+        public $building_speed = 0;
+
+        /**
+         * @var int Unit building CRR stat.
+         */
+        public $building_crit_rate = 0;
+
+        /**
+         * @var int Unit building CRD stat.
+         */
+        public $building_crit_damage = 0;
+
+        /**
+         * @var int Unit building RES stat.
+         */
+        public $building_resistance = 0;
+
+        /**
+         * @var int Unit building ACC stat.
+         */
+        public $building_accuracy = 0;
+
+        /**
+         * @var int Unit total HP stat.
+         */
+        public $total_hp = 0;
+
+        /**
+         * @var int Unit total ATK stat.
+         */
+        public $total_attack = 0;
+
+        /**
+         * @var int Unit total DEF stat.
+         */
+        public $total_defense = 0;
+
+        /**
+         * @var int Unit total SPD stat.
+         */
+        public $total_speed = 0;
+
+        /**
+         * @var int Unit total CRR stat.
+         */
+        public $total_crit_rate = 0;
+
+        /**
+         * @var int Unit total CRD stat.
+         */
+        public $total_crit_damage = 0;
+
+        /**
+         * @var int Unit total RES stat.
+         */
+        public $total_resistance = 0;
+
+        /**
+         * @var int Unit total ACC stat.
+         */
+        public $total_accuracy = 0;
+
+        /**
+         * @var int Unit effective HP
+         */
+        public $effective_hp = 0;
+
+        /**
+         * @var int Unit effective damage
+         */
+        public $effective_dmg = 0;
+
         /**
          * @var float Average rune efficiency.
          */
@@ -301,8 +431,7 @@
                 $this->create_time = date_create($r["create_time"]);
                 $this->homunculus_name = $r["homunculus_name"];
                 if ($complete){
-                    $this->load_runes();
-                    $this->load_artifacts();
+                    $this->load_stats();
                     $this->load_teams();
                     $this->check_storage();
                     $this->lock = $r["lock"];
@@ -370,42 +499,20 @@
             }
         }
 
+
         /**
-         * Loads the {@see teams} array, with the teams the unit is on.
+         * Calculates the stats gained from runes, artifacts and buildings.
+         * Calculates the totalls and the effective stats.
          *
-         * @global int Player ID.
+         * @gobal int User ID.
          * @global resource Database connection.
          */
-        public function load_teams(){
+        public function load_stats(){
+
             global $UID;
             global $db;
-            $this->teams = [];
-            $s = "
-              SELECT DISTINCT team.id AS id
-              FROM
-                team,
-                team_unit
-              WHERE
-                team.uid = '$UID' AND
-                team.id = team_unit.team AND
-                team_unit.unit = '" . $this->id . "';
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                array_push($this->teams, new Team($r["id"], false));
-            }
-        }
 
-        /**
-         * Loads the information about the equiped runes. 
-         * It is autoatically called at construction time if the
-         * $complete parameter is true (by default). No point in calling it
-         * twice.
-         *
-         * @global resource Database connection.
-         */
-        public function load_runes(){
-            global $db;
+            // Runes
             $this->rune = [];
             $s =
               "SELECT id " .
@@ -426,18 +533,8 @@
             $this->rune_attack = ceil($this->rune_attack);
             $this->rune_defense = ceil($this->rune_defense);
             $this->rune_hp = ceil($this->rune_hp);
-        }
 
-        /**
-         * Loads the information about the equiped artifacts. 
-         * It is autoatically called at construction time if the
-         * $complete parameter is true (by default). No point in calling it
-         * twice.
-         *
-         * @global resource Database connection.
-         */
-        public function load_artifacts(){
-            global $db;
+            // Artifacts
             $s =
               "SELECT id " .
               "FROM artifact " .
@@ -451,10 +548,127 @@
                 else{
                     $this->artifact_element = $artifact;
                 }
-                $this->sum_rune_stat($artifact->main_stat, $artifact->main_stat_value);
+                switch($artifact->main_stat){
+                    case ARTIFACT_STAT_ID::ATK:
+                        $this->artifact_attack += $artifact->main_stat_value;
+                        break;
+                    case ARTIFACT_STAT_ID::DEF:
+                        $this->artifact_defense += $artifact->main_stat_value;
+                        break;
+                    case ARTIFACT_STAT_ID::HP:
+                        $this->artifact_hp += $artifact->main_stat_value;
+                        break;
+                }
+            }
+
+            // Buildings
+            $s = "
+              SELECT
+                affected_stat,
+                bonus,
+                element
+              FROM
+                k_decoration,
+                k_decoration_level,
+                decoration
+              WHERE
+                decoration.uid = '$UID' AND
+                k_decoration.id = decoration.decoration AND
+                decoration.decoration = k_decoration_level.decoration AND
+                decoration.level = k_decoration_level.level AND
+                area = " . EFFECT_AREA_ID::GENERAL . " AND
+                affected_stat IN (" . STAT_ID::ATK . ", " . STAT_ID::DEF . ", " . STAT_ID::HP . ", " . STAT_ID::SPD . ", " . STAT_ID::CRIT_DMG . ");
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                switch($r["affected_stat"]){
+                    case STAT_ID::DEF:
+                        $this->building_defense += ($this->defense * $r["bonus"] / 100);
+                        break;
+                    case STAT_ID::HP:
+                        $this->building_hp += ($this->hp * $r["bonus"] / 100);
+                        break;
+                    case STAT_ID::SPD:
+                        $this->building_speed += ($this->speed * $r["bonus"] / 100);
+                        break;
+                    case STAT_ID::CRIT_DMG:
+                        $this->building_crit_damage += $r["bonus"];
+                        break;
+                    case STAT_ID::ATK:
+                        if(strlen($r["element"]) > 0 && $r["element"] == $this->unit->element){
+                            $this->building_attack += ($this->attack * $r["bonus"] / 100);
+                        }
+                        else{
+                            $this->building_attack += ($this->attack * $r["bonus"] / 100);
+                        }
+                        break;
+                }
             }
+            $this->building_attack = ceil($this->building_attack);
+            $this->building_defense = ceil($this->building_defense);
+            $this->building_hp = ceil($this->building_hp);
+            $this->building_speed = ceil($this->building_speed);
+            $this->building_crit_damage = ceil($this->building_crit_damage);
+
+            // Totals
+            $this->total_hp = $this->hp + $this->rune_hp + $this->building_hp + $this->artifact_hp;
+            $this->total_attack = $this->attack + $this->rune_attack + $this->building_attack + $this->artifact_attack;
+            $this->total_defense = $this->defense + $this->rune_defense + $this->building_defense + $this->artifact_defense;
+            $this->total_speed = $this->speed + $this->rune_speed + $this->building_speed;
+            $this->total_crit_rate = $this->crit_rate + $this->rune_crit_rate + $this->building_crit_rate;
+            $this->total_crit_damage = $this->crit_damage + $this->rune_crit_damage + $this->building_crit_damage;
+            $this->total_accuracy = $this->accuracy + $this->rune_accuracy + $this->building_accuracy;
+            $this->total_resistance = $this->resistance + $this->rune_resistance + $this->building_resistance;
+            
+            // Effective stats
+            $ehp = 0;
+            $edmg = 0;
+            
+            // Calculate effective_hp
+            $hp = $this->total_hp;
+            $def = $this->total_defense;
+            $ehp = ceil(((($def * 3.5) + 1140) * $hp) / 1000);
+            $this->effective_hp = $ehp;
+
+            // Calculate effective_dmg
+            $atk = $this->total_attack;
+            $crr = $this->total_crit_rate;
+            if ($crr > 100){
+                $crr = 100;
+            }
+            $crd = $this->total_crit_damage;
+            $edmg = ceil(($atk * (100 - $crr) / 100) + (($atk + ($atk * $crd / 100)) * $crr / 100));
+            $this->effective_dmg = $edmg;
         }
 
+
+        /**
+         * Loads the {@see teams} array, with the teams the unit is on.
+         *
+         * @global int Player ID.
+         * @global resource Database connection.
+         */
+        public function load_teams(){
+            global $UID;
+            global $db;
+            $this->teams = [];
+            $s = "
+              SELECT DISTINCT team.id AS id
+              FROM
+                team,
+                team_unit
+              WHERE
+                team.uid = '$UID' AND
+                team.id = team_unit.team AND
+                team_unit.unit = '" . $this->id . "';
+            ";
+            $q = $db->query($s);
+            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
+                array_push($this->teams, new Team($r["id"], false));
+            }
+        }
+
+
         /**
          * Calculates the stat increase by a rune property.
          * 

+ 0 - 71
application/page/Monster_Page.php

@@ -25,23 +25,6 @@
          */
         public $unit;
 
-        /**
-         * @var mixed[] Stats gained by building.
-         */
-        public $building_stats = [
-            "atk" => 0,
-            "def" => 0,
-            "hp" => 0,
-            "spd" => 0,
-            "crd" => 0,
-            "elm" => [
-                1 => 0,
-                2 => 0,
-                3 => 0,
-                4 => 0,
-                5 => 0
-            ]
-        ];
 
         /**
          * Constructor.
@@ -54,65 +37,11 @@
         public function __construct($id){
             global $db;
             $this->view = PATH::VIEW . "monster.php";
-            $this->calculate_buildings();
             $this->unit = new Unit($id);
             $this->title = $this->unit->unit->name ." - SWDB";
             $this->description = "Owned " . $this->unit->unit->name;
             $this->canonical = URL::BASE . "monster/" . $id;
         }
 
-        /**
-         * Calculates the stats gained from bulding upgrades and populates the
-         * $building_stats array.
-         *
-         * @gobal int User ID.
-         * @global resource Database connection.
-         */
-        private function calculate_buildings(){
-            global $UID;
-            global $db;
-            $s = "
-              SELECT
-                affected_stat,
-                bonus,
-                element
-              FROM
-                k_decoration,
-                k_decoration_level,
-                decoration
-              WHERE
-                decoration.uid = '$UID' AND
-                k_decoration.id = decoration.decoration AND
-                decoration.decoration = k_decoration_level.decoration AND
-                decoration.level = k_decoration_level.level AND
-                area = " . EFFECT_AREA_ID::GENERAL . " AND
-                affected_stat IN (" . STAT_ID::ATK . ", " . STAT_ID::DEF . ", " . STAT_ID::HP . ", " . STAT_ID::SPD . ", " . STAT_ID::CRIT_DMG . ");
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                switch($r["affected_stat"]){
-                    case STAT_ID::DEF:
-                        $this->building_stats["def"] += $r["bonus"];
-                        break;
-                    case STAT_ID::HP:
-                        $this->building_stats["hp"] += $r["bonus"];
-                        break;
-                    case STAT_ID::SPD:
-                        $this->building_stats["spd"] += $r["bonus"];
-                        break;
-                    case STAT_ID::CRIT_DMG:
-                        $this->building_stats["crd"] += $r["bonus"];
-                        break;
-                    case STAT_ID::ATK:
-                        if(strlen($r["element"]) > 0){
-                            $this->building_stats["elm"][$r["element"]] += $r["bonus"];
-                        }
-                        else{
-                            $this->building_stats["atk"] += $r["bonus"];
-                        }
-                        break;
-                }
-            }
-        }
     }
 ?>

+ 0 - 72
application/page/Monsters_Page.php

@@ -25,24 +25,6 @@
          */
         public $monsters = [];
 
-        /**
-         * @var mixed[] Stats gained by buildings.
-         */
-        public $building_stats = [
-            "atk" => 0,
-            "def" => 0,
-            "hp" => 0,
-            "spd" => 0,
-            "crd" => 0,
-            "elm" => [
-                1 => 0,
-                2 => 0,
-                3 => 0,
-                4 => 0,
-                5 => 0,
-            ]
-        ];
-
         /**
          * Constructor.
          *
@@ -54,7 +36,6 @@
             global $db;
             $this->view = PATH::VIEW . "monsters.php";
             $this->parse_filters();
-            $this->calculate_buildings();
             $s_mon = $this->build_query();
             $q_mon = $db->query($s_mon);
             while ($r_mon = $q_mon->fetchArray(SQLITE3_ASSOC)){
@@ -141,58 +122,5 @@
             return $s;
         }
 
-        /**
-         * Calculates the stats gained from bulding upgrades and populates the
-         * $building_stats array.
-         *
-         * @global int Player ID.
-         * @global resource Database connection.
-         */
-        private function calculate_buildings(){
-            global $UID;
-            global $db;
-            $s = "
-              SELECT
-                affected_stat,
-                bonus,
-                element
-              FROM
-                k_decoration,
-                k_decoration_level,
-                decoration
-              WHERE
-                decoration.uid = '$UID' AND
-                k_decoration.id = decoration.decoration AND
-                decoration.decoration = k_decoration_level.decoration AND
-                decoration.level = k_decoration_level.level AND
-                area = " . EFFECT_AREA_ID::GENERAL . " AND
-                affected_stat IN (" . STAT_ID::ATK . ", " . STAT_ID::DEF . ", " . STAT_ID::HP . ", " . STAT_ID::SPD . ", " . STAT_ID::CRIT_DMG . ");
-            ";
-            $q = $db->query($s);
-            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
-                switch($r["affected_stat"]){
-                    case STAT_ID::DEF:
-                        $this->building_stats["def"] += $r["bonus"];
-                        break;
-                    case STAT_ID::HP:
-                        $this->building_stats["hp"] += $r["bonus"];
-                        break;
-                    case STAT_ID::SPD:
-                        $this->building_stats["spd"] += $r["bonus"];
-                        break;
-                    case STAT_ID::CRIT_DMG:
-                        $this->building_stats["crd"] += $r["bonus"];
-                        break;
-                    case STAT_ID::ATK:
-                        if(strlen($r["element"]) > 0){
-                            $this->building_stats["elm"][$r["element"]] += $r["bonus"];
-                        }
-                        else{
-                            $this->building_stats["atk"] += $r["bonus"];
-                        }
-                        break;
-                }
-            }
-        }
     }
 ?>

+ 123 - 41
application/view/monster.php

@@ -69,7 +69,8 @@
 ?>
                     <div id='monster_details'>
                         <div id='exp'>
-                            <span id='exp_bar' style='width:<?=$exp_pct?>%;'>
+                            <span id='exp_bar' style='width:<?=$exp_pct?>
+                            <span class='percent'>%</span>;'>
                             </span>
                             <span id='exp_text'>
                                 <?=$exp_txt?>
@@ -102,16 +103,6 @@
 ?>
                     </div>
                 </div>
-<?php
-                $building_attack = floor(($page->unit->attack * $page->building_stats["atk"] / 100) + ($page->unit->attack * $page->building_stats["elm"][$page->unit->unit->element] / 100));
-                $building_defense = floor($page->building_stats["def"] * $page->unit->defense / 100);
-                $building_hp = floor($page->building_stats["hp"] * $page->unit->hp / 100);
-                $building_speed = $page->building_stats["spd"];
-                $building_crit_rate = 0;
-                $building_crit_damage = $page->building_stats["crd"];
-                $building_accuracy = 0;
-                $building_resistance = 0;
-?>
                 <table id='stats'>
                     <tr>
                         <th>
@@ -123,6 +114,9 @@
                         <th>
                             Runes
                         </th>
+                        <th>
+                            Artifacts
+                        </th>
                         <th>
                             Buildings
                         </th>
@@ -136,15 +130,23 @@
                         </th>
                         <td class='base'>
                             <?=$page->unit->attack?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='extra'>
                             +<?=$page->unit->rune_attack?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_attack?>
+                            +<?=$page->unit->artifact_attack?>
+                            <span class='percent'>&nbsp;</span>
+                        </td>
+                        <td class='extra'>
+                            +<?=$page->unit->building_attack?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->attack + $page->unit->rune_attack + $building_attack?>
+                            <?=$page->unit->total_attack?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                     </tr>
                     <tr>
@@ -153,15 +155,23 @@
                         </th>
                         <td class='base'>
                             <?=$page->unit->defense?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='extra'>
                             +<?=$page->unit->rune_defense?>
+                            <span class='percent'>&nbsp;</span>
+                        </td>
+                        <td class='extra'>
+                            +<?=$page->unit->artifact_defense?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_defense?>
+                            +<?=$page->unit->building_defense?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->defense + $page->unit->rune_defense + $building_defense?>
+                            <?=$page->unit->total_defense?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                     </tr>
                     <tr>
@@ -170,15 +180,23 @@
                         </th>
                         <td class='base'>
                             <?=$page->unit->hp?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='extra'>
                             +<?=$page->unit->rune_hp?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_hp?>
+                            +<?=$page->unit->artifact_hp?>
+                            <span class='percent'>&nbsp;</span>
+                        </td>
+                        <td class='extra'>
+                            +<?=$page->unit->building_hp?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->hp + $page->unit->rune_hp + $building_hp?>
+                            <?=$page->unit->total_hp?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                     </tr>
                     <tr>
@@ -187,15 +205,23 @@
                         </th>
                         <td class='base'>
                             <?=$page->unit->speed?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='extra'>
                             +<?=$page->unit->rune_speed?>
+                            <span class='percent'>&nbsp;</span>
+                        </td>
+                        <td class='extra'>
+                            +<?=$page->unit->artifact_speed?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_speed?>
+                            +<?=$page->unit->building_speed?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->speed + $page->unit->rune_speed + $building_speed?>
+                            <?=$page->unit->total_speed?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                     </tr>
                     <tr>
@@ -203,16 +229,24 @@
                             CRR
                         </th>
                         <td class='base'>
-                            <?=$page->unit->crit_rate?>%
+                            <?=$page->unit->crit_rate?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$page->unit->rune_crit_rate?>%
+                            +<?=$page->unit->rune_crit_rate?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_crit_rate?>%
+                            +<?=$page->unit->artifact_crit_rate?>
+                            <span class='percent'>%</span>
+                        </td>
+                        <td class='extra'>
+                            +<?=$page->unit->building_crit_rate?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->crit_rate + $page->unit->rune_crit_rate + $building_crit_rate?>%
+                            <?=$page->unit->total_crit_rate?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                     <tr>
@@ -220,16 +254,24 @@
                             CRD
                         </th>
                         <td class='base'>
-                            <?=$page->unit->crit_damage?>%
+                            <?=$page->unit->crit_damage?>
+                            <span class='percent'>%</span>
+                        </td>
+                        <td class='extra'>
+                            +<?=$page->unit->rune_crit_damage?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$page->unit->rune_crit_damage?>%
+                            +<?=$page->unit->artifact_crit_damage?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_crit_damage?>%
+                            +<?=$page->unit->building_crit_damage?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->crit_damage + $page->unit->rune_crit_damage + $building_crit_damage?>%
+                            <?=$page->unit->total_crit_damage?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                     <tr>
@@ -237,16 +279,24 @@
                             ACC
                         </th>
                         <td class='base'>
-                            <?=$page->unit->accuracy?>%
+                            <?=$page->unit->accuracy?>
+                            <span class='percent'>%</span>
+                        </td>
+                        <td class='extra'>
+                            +<?=$page->unit->rune_accuracy?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$page->unit->rune_accuracy?>%
+                            +<?=$page->unit->artifact_accuracy?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_accuracy?>%
+                            +<?=$page->unit->building_accuracy?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='total'>
-                            <?=$page->unit->accuracy + $page->unit->rune_accuracy + $building_accuracy?>%
+                            <?=$page->unit->total_accuracy?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                     <tr>
@@ -254,16 +304,42 @@
                             RES
                         </th>
                         <td class='base'>
-                            <?=$page->unit->resistance?>%
+                            <?=$page->unit->resistance?>
+                            <span class='percent'>%</span>
+                        </td>
+                        <td class='extra'>
+                            +<?=$page->unit->rune_resistance?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$page->unit->rune_resistance?>%
+                            +<?=$page->unit->artifact_resistance?>
+                            <span class='percent'>%</span>
                         </td>
                         <td class='extra'>
-                            +<?=$building_resistance?>%
+                            +<?=$page->unit->building_resistance?>
+                            <span class='percent'>%</span>
+                        </td>
+                        <td class='total'>
+                            <?=$page->unit->total_resistance?>
+                            <span class='percent'>%</span>
                         </td>
+                    </tr>
+                    <tr>
+                        <th colspan='5'>
+                            Effective HP
+                        </th>
+                        <td class='total'>
+                            <?=$page->unit->effective_hp?>
+                            <span class='percent'>&nbsp;</span>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th colspan='5'>
+                            Effective DMG
+                        </th>
                         <td class='total'>
-                            <?=$page->unit->resistance + $page->unit->rune_resistance + $building_resistance?>%
+                            <?=$page->unit->effective_dmg?>
+                            <span class='percent'>&nbsp;</span>
                         </td>
                     </tr>
                 </table>
@@ -286,7 +362,8 @@
                             <td class='skill'>
                                 <img class='skill_img' src='<?=$page->unit->unit->leader_skill->get_image()?>'/>
                                 <span class='skill_level'>
-                                    &nbsp;
+                                    
+                            <span class='percent'>&nbsp;</span>
                                 </span>
                             </td>
 <?php
@@ -434,9 +511,11 @@
                     </tr>
                     <tr>
                         <td colspan='<?=$colspan?>' id='skill_averages'>
-                            Absolute skill-ups: <?=number_format($absolute_level * 100 / $absolute_max_level, 2)?>%
+                            Absolute skill-ups: <?=number_format($absolute_level * 100 / $absolute_max_level, 2)?>
+                            <span class='percent'>%</span>
                             <br/>
-                            Ponderated skill-ups: <?=number_format($ponderated_level * 100 / $ponderated_max_level, 2)?>%
+                            Ponderated skill-ups: <?=number_format($ponderated_level * 100 / $ponderated_max_level, 2)?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                 </table>
@@ -516,7 +595,8 @@
                             Avg. efficiency:
                         </td>
                         <td class='value'>
-                            <?=number_format($total_efficiency / $total_runes, 2)?>%
+                            <?=number_format($total_efficiency / $total_runes, 2)?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                     <tr>
@@ -524,7 +604,8 @@
                             Avg. max. efficiency:
                         </td>
                         <td class='value'>
-                            <?=number_format($total_max_efficiency / $total_runes, 2)?>%
+                            <?=number_format($total_max_efficiency / $total_runes, 2)?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                     <tr>
@@ -532,7 +613,8 @@
                             Avg. reached efficiency:
                         </td>
                         <td class='value'>
-                            <?=number_format($total_reached_efficiency / $total_runes, 2)?>%
+                            <?=number_format($total_reached_efficiency / $total_runes, 2)?>
+                            <span class='percent'>%</span>
                         </td>
                     </tr>
                 </table>

+ 110 - 35
application/view/monsters.php

@@ -92,16 +92,6 @@
                             <h4>
                                 <?=$mon->title?>
                             </h4>
-<?php
-                            $building_attack = floor(($mon->attack * $page->building_stats["atk"] / 100) + ($mon->attack * $page->building_stats["elm"][$mon->unit->element] / 100));
-                            $building_defense = floor($page->building_stats["def"] * $mon->defense / 100);
-                            $building_hp = floor($page->building_stats["hp"] * $mon->hp / 100);
-                            $building_speed = $page->building_stats["spd"];
-                            $building_crit_rate = 0;
-                            $building_crit_damage = $page->building_stats["crd"];
-                            $building_accuracy = 0;
-                            $building_resistance = 0;
-?>
                             <table class='stats'>
                                 <tr>
                                     <th>
@@ -114,7 +104,10 @@
                                         Runes
                                     </th>
                                     <th>
-                                        Buildings
+                                        Artif.
+                                    </th>
+                                    <th>
+                                        Bldg.
                                     </th>
                                     <th>
                                         Total
@@ -126,15 +119,23 @@
                                     </th>
                                     <td class='base'>
                                         <?=$mon->attack?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='extra'>
                                         +<?=$mon->rune_attack?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_attack?>
+                                        +<?=$mon->artifact_attack?>
+                                        <span class='percent'>&nbsp;</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->building_attack?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->attack + $mon->rune_attack + $building_attack?>
+                                        <?=$mon->total_attack?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -143,15 +144,23 @@
                                     </th>
                                     <td class='base'>
                                         <?=$mon->defense?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='extra'>
                                         +<?=$mon->rune_defense?>
+                                        <span class='percent'>&nbsp;</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->artifact_defense?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_defense?>
+                                        +<?=$mon->building_defense?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->defense + $mon->rune_defense + $building_defense?>
+                                        <?=$mon->total_defense?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -160,15 +169,23 @@
                                     </th>
                                     <td class='base'>
                                         <?=$mon->hp?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='extra'>
                                         +<?=$mon->rune_hp?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_hp?>
+                                        +<?=$mon->artifact_hp?>
+                                        <span class='percent'>&nbsp;</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->building_hp?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->hp + $mon->rune_hp + $building_hp?>
+                                        <?=$mon->total_hp?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -177,15 +194,23 @@
                                     </th>
                                     <td class='base'>
                                         <?=$mon->speed?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='extra'>
                                         +<?=$mon->rune_speed?>
+                                        <span class='percent'>&nbsp;</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->artifact_speed?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_speed?>
+                                        +<?=$mon->building_speed?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->speed + $mon->rune_speed + $building_speed?>
+                                        <?=$mon->total_speed?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -193,16 +218,24 @@
                                         CRR
                                     </th>
                                     <td class='base'>
-                                        <?=$mon->crit_rate?>%
+                                        <?=$mon->crit_rate?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$mon->rune_crit_rate?>%
+                                        +<?=$mon->rune_crit_rate?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_crit_rate?>%
+                                        +<?=$mon->artifact_crit_rate?>
+                                        <span class='percent'>%</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->building_crit_rate?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->crit_rate + $mon->rune_crit_rate + $building_crit_rate?>%
+                                        <?=$mon->total_crit_rate?>
+                                        <span class='percent'>%</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -210,16 +243,24 @@
                                         CRD
                                     </th>
                                     <td class='base'>
-                                        <?=$mon->crit_damage?>%
+                                        <?=$mon->crit_damage?>
+                                        <span class='percent'>%</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->rune_crit_damage?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$mon->rune_crit_damage?>%
+                                        +<?=$mon->artifact_crit_damage?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_crit_damage?>%
+                                        +<?=$mon->building_crit_damage?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->crit_damage + $mon->rune_crit_damage + $building_crit_damage?>%
+                                        <?=$mon->total_crit_damage?>
+                                        <span class='percent'>%</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -227,16 +268,24 @@
                                         ACC
                                     </th>
                                     <td class='base'>
-                                        <?=$mon->accuracy?>%
+                                        <?=$mon->accuracy?>
+                                        <span class='percent'>%</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->rune_accuracy?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$mon->rune_accuracy?>%
+                                        +<?=$mon->artifact_accuracy?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_accuracy?>%
+                                        +<?=$mon->building_accuracy?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='total'>
-                                        <?=$mon->accuracy + $mon->rune_accuracy + $building_accuracy?>%
+                                        <?=$mon->total_accuracy?>
+                                        <span class='percent'>%</span>
                                     </td>
                                 </tr>
                                 <tr>
@@ -244,16 +293,42 @@
                                         RES
                                     </th>
                                     <td class='base'>
-                                        <?=$mon->resistance?>%
+                                        <?=$mon->resistance?>
+                                        <span class='percent'>%</span>
+                                    </td>
+                                    <td class='extra'>
+                                        +<?=$mon->rune_resistance?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$mon->rune_resistance?>%
+                                        +<?=$mon->artifact_resistance?>
+                                        <span class='percent'>%</span>
                                     </td>
                                     <td class='extra'>
-                                        +<?=$building_resistance?>%
+                                        +<?=$mon->building_resistance?>
+                                        <span class='percent'>%</span>
+                                    </td>
+                                    <td class='total'>
+                                        <?=$mon->total_resistance?>
+                                        <span class='percent'>%</span>
                                     </td>
+                                </tr>
+                                <tr>
+                                    <th colspan='5'>
+                                        Effective HP
+                                    </th>
+                                    <td class='total'>
+                                        <?=$mon->effective_hp?>
+                                        <span class='percent'>&nbsp;</span>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th colspan='5'>
+                                        Effective DMG
+                                    </th>
                                     <td class='total'>
-                                        <?=$mon->resistance + $mon->rune_resistance + $building_resistance?>%
+                                        <?=$mon->effective_dmg?>
+                                        <span class='percent'>&nbsp;</span>
                                     </td>
                                 </tr>
                             </table>

+ 0 - 4
public/css/fusion.css

@@ -60,11 +60,9 @@ div.owned span.owned{
 div.owned div.monster_panel{
     display: inline-block;
     font-size: 60%;
-    margin: -0.2em;
 }
 @media screen and (max-width : 990px){
     div.owned div.monster_panel{
-        margin: -0.2em -0.2em -2em -0.2em;
     }
 }
 
@@ -194,7 +192,6 @@ div.f4.extra > div.product{
 div.f4 > div.product > a > div.unawakened{
     display: inline-block;
     vertical-align: top;
-    width: 6em;
 }
 @media screen and (max-width : 990px){
     div.f4 > div.product > a > div.unawakened{
@@ -229,7 +226,6 @@ div.f4.extra > div.product > div.essences{
 div.f4 > div.product > a > div.awakened{
     display: inline-block;
     vertical-align: top;
-    width: 6em;
 }
 div.f4.extra > div.product > a > div.awakened{
     vertical-align: middle;

+ 8 - 1
public/css/monster.css

@@ -24,7 +24,6 @@ section#monster article#profile div#monster_info{
 section#monster article#profile div#monster_info div#monster_details{
     display: block;
     font-size: 70%;
-    margin-top: -3em;
 }
 
 section#monster article#profile div#monster_info div#monster_details div#teams{
@@ -77,6 +76,14 @@ section#monster article#profile table#stats th{
 section#monster article#profile table#stats td{
     font-weight: bold;
     background-color: #ffffff33;
+    text-align: right;
+    font-family: monospace;
+    font-size: 120%;
+}
+
+section#monster article#profile table#stats td span.percent{
+    margin: 0 0 0 -0.7em;
+    font-size: 80%;
 }
 
 section#monster article#profile table#stats td, th{

+ 11 - 0
public/css/monsters.css

@@ -50,8 +50,18 @@ section.list div.monster div.monster_tooltip table.stats tr{
 }
 
 section.list div.monster div.monster_tooltip table.stats td{
+    border: 0.1em solid #00000055;
     border-bottom: 0.1em solid black;
     color: #cccccc;
+    text-align: right;
+    font-family: monospace;
+    font-size: 120%;
+    min-width: 4.5em;
+}
+
+section.list div.monster div.monster_tooltip table.stats td span.percent{
+    margin: 0 0 0 -0.7em;
+    font-size: 80%;
 }
 
 section.list div.monster div.monster_tooltip table.stats td.extra{
@@ -61,6 +71,7 @@ section.list div.monster div.monster_tooltip table.stats td.extra{
 section.list div.monster div.monster_tooltip table.stats td.total{
     color: #f2c920;
     font-weight: bold;
+    min-width: 4.5em;
 }
 
 section.list div.monster div.monster_tooltip div.skills{

+ 1 - 0
public/css/ui.css

@@ -587,6 +587,7 @@ div.monster_panel{
     margin: 0.5em;
     position: relative;
     border-radius: 15%;
+    overflow: hidden;
 }
 
 @media screen and (max-width : 990px){