1. Go to this page and download the library: Download luminoray/role-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
luminoray / role-php example snippets
interface iCharacter {
public function __construct(iStatus $status);
public function attack(iCharacter $target);
public function skill($name, $level, iCharacter $target);
public function __get($stat_prop);
}
class MY_Character extends LuminoRay\RolePHP\Character\Character {
public function attack(LuminoRay\RolePHP\Character\iCharacter $target) {
$damage = $this->attack - $target->defense;
if ($damage > 0) {
$new_health = $target->health - $damage;
} else {
$new_health = $target->health - 1;
}
$target->status->stat_set('health', $new_health, 0, 'greater_equal', 'set_constraint');
}
public function skill($name, $level, LuminoRay\RolePHP\Character\iCharacter $target) {
echo ('Skills are not yet implemented.\n');
}
}
interface iStatus {
public function __construct(array $stat_array);
public function stat_set($stat_prop, $value, $constraint, $compare, $fallback);
}