完成开箱抽卡 和 怪物掉落设置
This commit is contained in:
@@ -23,6 +23,7 @@ import { TimerManager } from "../../../../extensions/oops-plugin-framework/asset
|
||||
import { HeroSet } from "../common/config/heroSet";
|
||||
import { BuffComp } from "./BuffComp";
|
||||
import { MonModelComp } from "./MonModelComp";
|
||||
import { getMonsterDrops, MonsterType } from "../common/config/RewardSet";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 角色显示组件 */
|
||||
@@ -53,6 +54,7 @@ export class HeroViewComp extends CCComp {
|
||||
is_stop:boolean = false;
|
||||
is_atking:boolean = false;
|
||||
is_boss:boolean = false;
|
||||
is_big_boss:boolean = false;
|
||||
|
||||
hp: number = 100; /** 血量 */
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
@@ -848,8 +850,35 @@ export class HeroViewComp extends CCComp {
|
||||
this.BUFFCOMP.dead()
|
||||
this.exp_add(this.dexp)
|
||||
this.power_add(this.dpw)
|
||||
this.to_drop()
|
||||
}
|
||||
//掉落物品
|
||||
to_drop(){
|
||||
let Drops = getMonsterDrops(1, MonsterType.Normal, 1.2);
|
||||
if(this.is_boss) Drops =getMonsterDrops(1, MonsterType.Elite, 1.2);
|
||||
if(this.is_big_boss) Drops =getMonsterDrops(1, MonsterType.Boss, 1.2);
|
||||
console.log("掉落物品:",Drops);
|
||||
//根据掉落类型和uuid 写入用户数据文件SingletonModuleComp =smc,英雄碎片对应smc.heros[uuid].num,smc.heros[uuid].x1 记录本局掉落的数量,也需要添加对应值
|
||||
//金币uuid=9001 对应smc.vmdata.gold.num,宝箱uuid1003,对应smc.vmdata.box.num ,smc.itmes[9001].x1,smc.itmes[1003].x1 记录本局
|
||||
for (let i = 0; i < Drops.length; i++) {
|
||||
const drop = Drops[i];
|
||||
if(drop.type == 1 ){ //英雄碎片
|
||||
smc.heros[drop.uuid].num += drop.num
|
||||
smc.heros[drop.uuid].x1 += drop.num
|
||||
}
|
||||
if(drop.type==2){
|
||||
if(drop.uuid == 9001){
|
||||
smc.vmdata.gold.num+=drop.num
|
||||
smc.items[9001].x1+=drop.num
|
||||
}
|
||||
if(drop.uuid == 1003){
|
||||
smc.vmdata.box.num+=drop.num
|
||||
smc.items[1003].x1+=drop.num
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//进入墓地
|
||||
to_grave(){
|
||||
let pos =v3(-999,this.node.position.y)
|
||||
|
||||
Reference in New Issue
Block a user