游戏化技能树

时间:2014-04-30 02:46:49

标签: php mysql json tree

我正在为自己的网站创建技能树。我在如何创建一个问题上遇到了问题。我有我称之为技能基础的东西。我的想法是添加技能等级或等级,并在解锁之前添加需要掌握的技能。我想要的是像技能树这样的边界。关于如何编写技能树的任何想法?数据可以存储在mysql数据库或json文件中。我只实现了skillnode类,它没有任何方法只是属性。每项技能都属于专业。每项技能都会修改可由用户创建的统计数据。

   // skill for a class, builds skill tree
   class Skill
   {
    const $maxLevels = 5; // sets max levels as an unchangeable value
    private $name; // name of the skill
    private $speciality; // class the skill belongs to
    private $modifiesStat; // stat skill modifies
    private $increase; // array for each tier for the increase in percents needs bound checks against levels
    private $type; // effect type, i.e increase or decrease
    private $icon; // url or path to skill icon
    private $image; // url or path to skill logo
    private $locked; // if skill is unlocked or not
    private $mastered; // if all tiers are unlocked true or false
    private $disabled; // if the skill is active and can be used true or fall
    private $requires; // skill this skill requires to unlock (parent skill for)
    private $conditionalStat; // stat modified stat requires a check on
    private $condition; // method used for check on depended stat, requires condition class
    private $conditions; // list of valid conditions for sanity check on condition
    private $skillType; // type of skill
    private $levels; // number of unlock levels
    private $invested; // number of skills invested in the skill
   }

0 个答案:

没有答案