db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); $this->id = $r["id"]; $this->com2us_id = $r["com2us_id"]; if (strlen($r["monster"]) > 0){ $this->monster = new K_Monster($this->db, $r["monster"]); } $this->stars = $r["stars"]; $this->level = $r["level"]; $this->skill_1_level = $r["skill_1_level"]; $this->skill_2_level = $r["skill_2_level"]; $this->skill_3_level = $r["skill_3_level"]; $this->skill_4_level = $r["skill_4_level"]; $this->base_hp = $r["base_hp"]; $this->base_attack = $r["base_attack"]; $this->base_defense = $r["base_defense"]; $this->base_speed = $r["base_speed"]; $this->base_crit_rate = $r["base_crit_rate"]; $this->base_crit_damage = $r["base_crit_damage"]; $this->base_resistance = $r["base_resistance"]; $this->base_accuracy = $r["base_accuracy"]; $this->rune_hp = $r["rune_hp"]; $this->rune_attack = $r["rune_attack"]; $this->rune_defense = $r["rune_defense"]; $this->rune_speed = $r["rune_speed"]; $this->rune_crit_rate = $r["rune_crit_rate"]; $this->rune_crit_damage = $r["rune_crit_damage"]; $this->rune_resistance = $r["rune_resistance"]; $this->rune_accuracy = $r["rune_accuracy"]; $this->avg_rune_efficiency = $r["avg_rune_efficiency"]; $this->fodder = $r["fodder"]; $this->in_storage = $r["in_storage"]; $this->ignore_for_fusion = $r["ignore_for_fusion"]; $this->priority = $r["priority"]; $this->notes = $r["notes"]; $s = "SELECT rune " . "FROM monster_rune " . "WHERE monster = '$this->id'; "; $q = $this->db->query($s); while ($r = $q->fetchArray(SQLITE3_ASSOC)){ array_push($this->rune, new Rune($this->db, $r["rune"])); } } /** * TODO: UNUSED * Gets a stat increase from rune monsters. * * @param $stat Stat name ("ATK", "DEF", "HP", "SPD", "CRR", "CRD", "RES", "ACC"). * @return Value of the base stat (floored integer), -1 if wrong stat. */ public function get_rune_stat($stat){ switch ($stat){ case "ATK": $base = $this->atk; $name_flat = 'ATK flat'; $name_perc = 'ATK%'; break; case "DEF": $base = $this->def; $name_flat = 'DEF flat'; $name_perc = 'DEF%'; break; case "HP": $base = $this->hp; $name_flat = 'HP flat'; $name_perc = 'HP%'; break; case "SPD": $base = $this->hp; $name_flat = 'SPD'; $name_perc = '-'; break; case "CRR": $base = $this->crr; $name_flat = 'CRate'; $name_perc = '-'; break; case "CRD": $base = $this->crd; $name_flat = 'CDmg'; $name_perc = '-'; break; case "RES": $base = $this->res; $name_flat = 'RES'; $name_perc = '-'; break; case "ACC": $base = $this->acc; $name_flat = 'ACC'; $name_perc = '-'; break; default: return -1; } $s = "SELECT sum(value) AS v FROM ( " . " SELECT m_v AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND m_t = '" . $name_flat . "' " . " UNION " . " SELECT cast(m_v * " . $base . " / 100 AS int) AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND m_t = '" . $name_perc . "' " . " UNION " . " SELECT i_v AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND i_t = '" . $name_flat . "' " . " UNION " . " SELECT cast(i_v * " . $base . " / 100 AS int) AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND i_t = '" . $name_perc . "' " . " UNION " . " SELECT s1_v AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND s1_t = '" . $name_flat . "' " . " UNION " . " SELECT cast(s1_v * " . $base . " / 100 AS int) AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND s1_t = '" . $name_perc . "' " . " UNION " . " SELECT s2_v AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND s2_t = '" . $name_flat . "' " . " UNION " . " SELECT cast(s2_v * " . $base . " / 100 AS int) AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND s2_t = '" . $name_perc . "' " . " UNION " . " SELECT s3_v AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND s3_t = '" . $name_flat . "' " . " UNION " . " SELECT cast(s3_v * " . $base . " / 100 AS int) AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND s3_t = '" . $name_perc . "' " . " UNION " . " SELECT s4_v AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND s4_t = '" . $name_flat . "' " . " UNION " . " SELECT cast(s4_v * " . $base . " / 100 AS int) AS value FROM rune, monster_rune WHERE rune = id AND monster = " . $this->id . " AND s4_t = '" . $name_perc . "' " . ");"; $q = $this->db->query($s); $r = $q->fetchArray(SQLITE3_ASSOC); return $r["v"]; } } ?>