| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555 |
- // Learn cc.Class:
- // - https://docs.cocos.com/creator/manual/en/scripting/class.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
- cc.Class({
- extends: cc.Component,
- properties: {
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad() {},
- start() {
- },
- // update (dt) {},
- //各品级生成随机属性
- /**
-
-
-
-
-
- * 左手武器:主属性加攻击 0
- * 右手武器:主属性加连击率 1
- * 衣服:主属性加防御 2
- * 裤子:主属性加血 3
- * 腰带:主属性加蓝 4
- * 头盔:主属性加格挡回血量 5
- * 项链:主属性加暴击率 6
- * 鞋子:主属性加闪避回蓝量 7
- * 手套:主属性被动回蓝 8
- * 护膝:主属性被动回血 9
- */
- //装备类型、、品级、、属性/
- //
- generate_properties(item_type, gradetype) {
- if (item_type == 0) {
- this.item_name = "左手拳套";
- this.item_grade = 0;
- this.item_master_type = "攻击"; //主属性类型
- //白 * (白色装备:主属性1)
- if (gradetype == 0) {
- this.spriteFrame_name = "left_gloves1";
- this.item_master_value = 1;
- this.item_Attached_num = 0; //附属属性数量
- if (this.item_Attached_num == 0) return;
- else {
- for (let i = 0; i < this.item_Attached_num; i++) {
- this.item_Attached_type[i] = 0; //10种类型附属属性
- this.item_Attached_value[i] = 0; //附属属性类型值
- }
- }
- }
- //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
- //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
- if (gradetype == 1) {
- this.spriteFrame_name = "left_gloves2";
- this.item_master_value = this.random_num(1, 2); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
- }
- //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
- if (gradetype == 2) {
- this.spriteFrame_name = "left_gloves3";
- this.item_master_value = this.random_num(1, 3); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
- }
- //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
- if (gradetype == 3) {
- this.spriteFrame_name = "left_gloves4";
- this.item_master_value = this.random_num(1, 4); //主属性值
- this.item_Attached_num = this.random_num(2, 2); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
- }
- //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
- if (gradetype == 4) {
- this.item_master_value = this.random_num(1, 5); //主属性值
- this.item_Attached_num = this.random_num(3, 3); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
- this.spriteFrame_name = "left_gloves5";
- }
- }
- if (item_type == 1) {
- this.item_name = "右手拳套";
- this.item_grade = 0;
- this.item_master_type = "连击率"; //主属性类型
- //白 * (白色装备:主属性1)
- if (gradetype == 0) {
- this.item_master_value = 1;
- this.item_Attached_num = 0; //附属属性数量
- this.item_Attached_type = 0; //10种类型附属属性
- this.item_Attached_value = 0; //附属属性类型值
- this.spriteFrame_name = "right_gloves1";
- }
- //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
- //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
- if (gradetype == 1) {
- this.item_master_value = this.random_num(1, 2); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
- this.spriteFrame_name = "right_gloves2";
- }
- //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
- if (gradetype == 2) {
- this.item_master_value = this.random_num(1, 3); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
- this.spriteFrame_name = "right_gloves3";
- }
- //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
- if (gradetype == 3) {
- this.item_master_value = this.random_num(1, 4); //主属性值
- this.item_Attached_num = this.random_num(2, 2); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
- this.spriteFrame_name = "right_gloves4";
- }
- //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
- if (gradetype == 4) {
- this.item_master_value = this.random_num(1, 5); //主属性值
- this.item_Attached_num = this.random_num(3, 3); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
- this.spriteFrame_name = "right_gloves5";
- }
- }
- if (item_type == 2) {
- this.item_name = "衣服";
- this.item_grade = 0;
- this.item_master_type = "防御"; //主属性类型
- //白 * (白色装备:主属性1)
- if (gradetype == 0) {
- this.item_master_value = 1;
- this.item_Attached_num = 0; //附属属性数量
- this.item_Attached_type = 0; //10种类型附属属性
- this.item_Attached_value = 0; //附属属性类型值
- this.spriteFrame_name = "clothes1";
- }
- //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
- //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
- if (gradetype == 1) {
- this.item_master_value = this.random_num(1, 2); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
- this.spriteFrame_name = "clothes2";
- }
- //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
- if (gradetype == 2) {
- this.item_master_value = this.random_num(1, 3); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
- this.spriteFrame_name = "clothes3";
- }
- //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
- if (gradetype == 3) {
- this.item_master_value = this.random_num(1, 4); //主属性值
- this.item_Attached_num = this.random_num(2, 2); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
- this.spriteFrame_name = "clothes4";
- }
- //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
- if (gradetype == 4) {
- this.item_master_value = this.random_num(1, 5); //主属性值
- this.item_Attached_num = this.random_num(3, 3); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
- this.spriteFrame_name = "clothes5";
- }
- }
- if (item_type == 3) {
- this.item_name = "裤子";
- this.item_grade = 0;
- this.item_master_type = "血量"; //主属性类型
- //白 * (白色装备:主属性1)
- if (gradetype == 0) {
- this.item_master_value = 1;
- this.item_Attached_num = 0; //附属属性数量
- this.item_Attached_type = 0; //10种类型附属属性
- this.item_Attached_value = 0; //附属属性类型值
- this.spriteFrame_name = "trousers1";
- }
- //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
- //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
- if (gradetype == 1) {
- this.item_master_value = this.random_num(1, 2); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
- this.spriteFrame_name = "trousers2";
- }
- //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
- if (gradetype == 2) {
- this.item_master_value = this.random_num(1, 3); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
- this.spriteFrame_name = "trousers3";
- }
- //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
- if (gradetype == 3) {
- this.item_master_value = this.random_num(1, 4); //主属性值
- this.item_Attached_num = this.random_num(2, 2); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
- this.spriteFrame_name = "trousers4";
- }
- //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
- if (gradetype == 4) {
- this.item_master_value = this.random_num(1, 5); //主属性值
- this.item_Attached_num = this.random_num(3, 3); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
- this.spriteFrame_name = "trousers5";
- }
- }
- if (item_type == 4) {
- this.item_name = "腰带";
- this.item_grade = 0;
- this.item_master_type = "蓝量"; //主属性类型
- //白 * (白色装备:主属性1)
- if (gradetype == 0) {
- this.item_master_value = 1;
- this.item_Attached_num = 0; //附属属性数量
- this.item_Attached_type = 0; //10种类型附属属性
- this.item_Attached_value = 0; //附属属性类型值
- this.spriteFrame_name = "belt1";
- }
- //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
- //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
- if (gradetype == 1) {
- this.item_master_value = this.random_num(1, 2); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
- this.spriteFrame_name = "belt2";
- }
- //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
- if (gradetype == 2) {
- this.item_master_value = this.random_num(1, 3); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
- this.spriteFrame_name = "belt3";
- }
- //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
- if (gradetype == 3) {
- this.item_master_value = this.random_num(1, 4); //主属性值
- this.item_Attached_num = this.random_num(2, 2); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
- this.spriteFrame_name = "belt4";
- }
- //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
- if (gradetype == 4) {
- this.item_master_value = this.random_num(1, 5); //主属性值
- this.item_Attached_num = this.random_num(3, 3); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
- this.spriteFrame_name = "belt5";
- }
- }
- if (item_type == 5) {
- this.item_name = "头盔";
- this.item_grade = 0;
- this.item_master_type = "格挡回血量"; //主属性类型
- //白 * (白色装备:主属性1)
- if (gradetype == 0) {
- this.item_master_value = 1;
- this.item_Attached_num = 0; //附属属性数量
- this.item_Attached_type = 0; //10种类型附属属性
- this.item_Attached_value = 0; //附属属性类型值
- this.spriteFrame_name = "helmet1";
- }
- //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
- //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
- if (gradetype == 1) {
- this.item_master_value = this.random_num(1, 2); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
- this.spriteFrame_name = "helmet2";
- }
- //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
- if (gradetype == 2) {
- this.item_master_value = this.random_num(1, 3); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
- this.spriteFrame_name = "helmet3";
- }
- //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
- if (gradetype == 3) {
- this.item_master_value = this.random_num(1, 4); //主属性值
- this.item_Attached_num = this.random_num(2, 2); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
- this.spriteFrame_name = "helmet4";
- }
- //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
- if (gradetype == 4) {
- this.item_master_value = this.random_num(1, 5); //主属性值
- this.item_Attached_num = this.random_num(3, 3); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
- this.spriteFrame_name = "helmet5";
- }
- }
- if (item_type == 6) {
- this.item_name = "项链";
- this.item_grade = 0;
- this.item_master_type = "暴击率"; //主属性类型
- //白 * (白色装备:主属性1)
- if (gradetype == 0) {
- this.item_master_value = 1;
- this.item_Attached_num = 0; //附属属性数量
- this.item_Attached_type = 0; //10种类型附属属性
- this.item_Attached_value = 0; //附属属性类型值
- this.spriteFrame_name = "necklace1";
- }
- //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
- //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
- if (gradetype == 1) {
- this.item_master_value = this.random_num(1, 2); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
- this.spriteFrame_name = "necklace2";
- }
- //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
- if (gradetype == 2) {
- this.item_master_value = this.random_num(1, 3); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
- this.spriteFrame_name = "necklace3";
- }
- //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
- if (gradetype == 3) {
- this.item_master_value = this.random_num(1, 4); //主属性值
- this.item_Attached_num = this.random_num(2, 2); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
- this.spriteFrame_name = "necklace4";
- }
- //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
- if (gradetype == 4) {
- this.item_master_value = this.random_num(1, 5); //主属性值
- this.item_Attached_num = this.random_num(3, 3); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
- this.spriteFrame_name = "necklace5";
- }
- }
- if (item_type == 7) {
- this.item_name = "鞋子";
- this.item_grade = 0;
- this.item_master_type = "闪避回蓝量"; //主属性类型
- //白 * (白色装备:主属性1)
- if (gradetype == 0) {
- this.item_master_value = 1;
- this.item_Attached_num = 0; //附属属性数量
- this.item_Attached_type = 0; //10种类型附属属性
- this.item_Attached_value = 0; //附属属性类型值
- this.spriteFrame_name = "shoe1";
- }
- //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
- //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
- if (gradetype == 1) {
- this.item_master_value = this.random_num(1, 2); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
- this.spriteFrame_name = "shoe2";
- }
- //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
- if (gradetype == 2) {
- this.item_master_value = this.random_num(1, 3); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
- this.spriteFrame_name = "shoe3";
- }
- //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
- if (gradetype == 3) {
- this.item_master_value = this.random_num(1, 4); //主属性值
- this.item_Attached_num = this.random_num(2, 2); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
- this.spriteFrame_name = "shoe4";
- }
- //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
- if (gradetype == 4) {
- this.item_master_value = this.random_num(1, 5); //主属性值
- this.item_Attached_num = this.random_num(3, 3); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
- this.spriteFrame_name = "shoe5";
- }
- }
- if (item_type == 8) {
- this.item_name = "手套";
- this.item_grade = 0;
- this.item_master_type = "被动回蓝"; //主属性类型
- //白 * (白色装备:主属性1)
- if (gradetype == 0) {
- this.item_master_value = 1;
- this.item_Attached_num = 0; //附属属性数量
- this.item_Attached_type = 0; //10种类型附属属性
- this.item_Attached_value = 0; //附属属性类型值
- this.spriteFrame_name = "wristsupport1";
- }
- //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
- //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
- if (gradetype == 1) {
- this.item_master_value = this.random_num(1, 2); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
- this.spriteFrame_name = "wristsupport2";
- }
- //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
- if (gradetype == 2) {
- this.item_master_value = this.random_num(1, 3); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
- this.spriteFrame_name = "wristsupport3";
- }
- //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
- if (gradetype == 3) {
- this.item_master_value = this.random_num(1, 4); //主属性值
- this.item_Attached_num = this.random_num(2, 2); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
- this.spriteFrame_name = "wristsupport4";
- }
- //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
- if (gradetype == 4) {
- this.item_master_value = this.random_num(1, 5); //主属性值
- this.item_Attached_num = this.random_num(3, 3); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
- this.spriteFrame_name = "wristsupport5";
- }
- }
- if (item_type == 9) {
- this.item_name = "护膝";
- this.item_grade = 0;
- this.item_master_type = "被动回血"; //主属性类型
- //白 * (白色装备:主属性1)
- if (gradetype == 0) {
- this.item_master_value = 1;
- this.item_Attached_num = 0; //附属属性数量
- this.item_Attached_type = 0; //10种类型附属属性
- this.item_Attached_value = 0; //附属属性类型值
- this.spriteFrame_name = "kneecap1";
- }
- //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
- //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
- if (gradetype == 1) {
- this.item_master_value = this.random_num(1, 2); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 1); //附属属性类型值
- this.spriteFrame_name = "kneecap2";
- }
- //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
- if (gradetype == 2) {
- this.item_master_value = this.random_num(1, 3); //主属性值
- this.item_Attached_num = this.random_num(1, 1); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 2); //附属属性类型值
- this.spriteFrame_name = "kneecap3";
- }
- //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
- if (gradetype == 3) {
- this.item_master_value = this.random_num(1, 4); //主属性值
- this.item_Attached_num = this.random_num(2, 2); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 3); //附属属性类型值
- this.spriteFrame_name = "kneecap4";
- }
- //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
- if (gradetype == 4) {
- this.item_master_value = this.random_num(1, 5); //主属性值
- this.item_Attached_num = this.random_num(3, 3); //附属属性数量
- this.item_Attached_type = this.random_num(0, 9); //10种类型附属属性
- this.item_Attached_value = this.random_num(1, 4); //附属属性类型值
- this.spriteFrame_name = "kneecap5";
- }
- }
- },
- //return Math.floor(Math.random() * (max - min + 1)) + min;[min max];
- //随机物品类型
- random_num(minnum, maxnum) {
- return Math.floor(Math.random() * (maxnum - minnum + 1)) + minnum;
- },
- _item_name(itemnum) { //物品名字
- if (itemnum == 0) return "左手拳套";
- if (itemnum == 1) return "右手拳套";
- if (itemnum == 2) return "衣服";
- if (itemnum == 3) return "裤子";
- if (itemnum == 4) return "腰带";
- if (itemnum == 5) return "头盔";
- if (itemnum == 6) return "项链";
- if (itemnum == 7) return "鞋子";
- if (itemnum == 8) return "手套";
- if (itemnum == 9) return "护膝";
- }
- // //随机品级
- // random_grade(maxnum) { //max 5
- // return Math.floor(Math.random() * maxnum); //[0-4]
- // },
- // //随机属性条数
- // random_argu(maxnum) { //max 4
- // return Math.floor(Math.random() * maxnum + 1); //[1-3]
- // },
- // //随机属性类型
- // random_argu_type() {
- // return Math.floor(Math.random() * 10); //[0-9]
- // },
- // //随机值[0-(maxnum-1)]+1 [1,maxnum]
- // random_Num(maxnum) { //max 5
- // return Math.floor(Math.random() * maxnum + 1); //[1-5]
- // },
- });
|