* @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3 * @package SWDB */ require_once(PATH::ENTITY . "Entity.php"); /** * Skill effect. * * Represents an effect a skill can induce. * * @category Entity */ class Effect extends Entity{ /** * @var int Effect ID. */ private $id; /** * @var string Effect name. */ private $name; /** * @var bool Indicates if the effect is a buff. */ private $is_buff; /** * @var string Effect description. */ private $description; /** * Constructor. * * Searches the database and retrieves the information about the * skill level, populating it and it's items. * * @param int $id Effect identifier. */ public function __construct($id){ $statement = get_context()->get_db()->prepare(" SELECT id, name, is_buff, description FROM effect WHERE id = :id; "); $statement->bindValue(':id', $id, SQLITE3_TEXT); $r = $statement->execute()->fetchArray(SQLITE3_ASSOC); if ($r){ $this->id = $r["id"]; $this->name = HTML::e($r["name"]); $this->is_buff = $r["is_buff"]; $this->description = HTML::e($r["description"]); } } /** * Retrieves the effect identifier. * * @return int Effect ID. */ public function get_id(){ return $this->id; } /** * Retrieves the effect name. * * @return string Effect name. */ public function get_name(){ return $this->name; } /** * Checks if the effect is a a buff (a good effect). * * @return bool True if buff, false if not. */ public function is_buff(){ return $this->is_buff; } /** * Checks if the efect is a a debuff (a bad effect). * * @return bool True if buff, false if not. */ public function is_debuff(){ return ! $this->is_buff; } /** * Retrieves the effect description. * * @return string Effect description. */ public function get_description(){ return $this->description; } /** * Gets the pathto the monster image. * @return string Image URL, or a fixed unknown image. */ public function get_image(){ return APPLICATION::img("EFFECT", $this->id); } }