예제 #1
0
파일: Skill.php 프로젝트: reillo/ninjawars
 /**
  * Returns the list fo all skills available to a ninja.
  **/
 public function skills($char_id = null)
 {
     if (!$char_id) {
         $char_id = self_char_id();
     }
     $char = new Player($char_id);
     $char_name = $char->name();
     if ($char->isAdmin()) {
         // Admins get access to all skills.
         $skills = $this->skill_map['crane'] + $this->skill_map['dragon'] + $this->skill_map['tiger'] + $this->skill_map['viper'] + $this->skill_map['all'];
         return $skills;
     }
     $class = char_class_identity($char_id);
     $class_skills = array();
     if ($class) {
         $class_skills = $this->skill_map[$class];
     }
     return $class_skills + $this->skill_map['all'];
 }
예제 #2
0
function getClass($who)
{
    $char_id = get_char_id($who);
    return char_class_identity($char_id);
    // Note that classes now have identity/name(for display)/theme, so this function should be deprecated.
}
예제 #3
0
 public function class_identity()
 {
     return char_class_identity($this->id());
 }
예제 #4
0
파일: dojo.php 프로젝트: reillo/ninjawars
 // *** End of Dim Mak Code. ***
 // Class Change Buy
 $class_change_error = null;
 if ($classChangeSequence == 2 && $current_class_untrusted == $userClass && $destination_class_identity) {
     // Class change requested, not a page refresh, and requested class is existant.
     if (!$class_change_requirement_error) {
         // Class change conditions are ok, so:
         // subtract the cost in turns
         // ...and change the class.
         $class_change_error = set_class($char_id, $destination_class_identity);
         if (!$class_change_error) {
             $char->changeTurns(-1 * $class_change_cost);
         }
     }
 }
 $possibly_changed_class = char_class_identity($char_id);
 $possibly_changed_class_name = char_class_name($char_id);
 $possibly_changed_class_theme = class_theme($possibly_changed_class);
 $upgrade_requested = $in_upgrade && $in_upgrade == 1;
 $levelled = false;
 if ($upgrade_requested) {
     // Try to level up.
     $levelled = level_up_if_possible($char_id);
     $char = $player = new Player($char_id);
     $userLevel = $char->level();
     $char_data = $char->data();
     // Get the info for the next level, especially if that has changed.
     $nextLevel = min($userLevel + 1, $max_level);
     $userKills = char_kills($char_id);
     $required_kills = required_kills_to_level($userLevel);
 }