物品图标
This commit is contained in:
@@ -7,7 +7,7 @@ import { SkillSet } from "../common/config/SkillSet";
|
||||
import { Monster } from "./Monster";
|
||||
import { MonsterModelComp } from "./MonsterModelComp";
|
||||
import { MonsterViewComp } from "./MonsterViewComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { BoxSet, GameSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { HeroModelComp } from "./HeroModelComp";
|
||||
@@ -87,14 +87,28 @@ export class CSkillComp extends CCComp {
|
||||
}
|
||||
add_buff(){
|
||||
let uuid= this.skill_uuid;
|
||||
let eid = 0
|
||||
let group = BoxSet.HERO;
|
||||
let atk:number=smc.Role.RoleView.atk
|
||||
let args:any = {
|
||||
atk:atk*GameSet.ATK_TO_ATK_RATIO,
|
||||
hp:atk*GameSet.ATK_TO_HP_RATIO,
|
||||
shield:atk*GameSet.ATK_TO_SHIELD_RATIO,
|
||||
}
|
||||
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
|
||||
let heros_hp:any=[]
|
||||
if (heros.length > 0) {
|
||||
for (let i = 0; i < heros.length; i++) {
|
||||
let hero = heros[i];
|
||||
hero.MonsterBuff.add_buff(uuid,eid,group);
|
||||
if(SkillSet[uuid].type==92){
|
||||
heros[0].MonsterBuff.add_buff(uuid,args);
|
||||
|
||||
}else{
|
||||
for (let i = 0; i < heros.length; i++) {
|
||||
let hero = heros[i];
|
||||
if(SkillSet[uuid].type==99){
|
||||
hero.MonsterBuff.add_buff(uuid,args);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// oops.message.dispatchEvent("add_buff",{uuid:this.skill_uuid,eid:0,group:BoxSet.HERO})
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export class MonsterBuffComp extends CCComp {
|
||||
|
||||
|
||||
}
|
||||
add_buff(uuid:number=0,eid:number=0,group:number=0){
|
||||
add_buff(uuid:number=0,args:any[]){
|
||||
// console.log("add_buff",smc.skills[uuid]);
|
||||
|
||||
let new_buff={
|
||||
@@ -63,15 +63,9 @@ export class MonsterBuffComp extends CCComp {
|
||||
time:smc.skills[uuid].bsd,
|
||||
bcd:smc.skills[uuid].bcd,
|
||||
sk_uuid:smc.skills[uuid].uuid,
|
||||
args:args
|
||||
}
|
||||
if(eid !=0 && group ==0 ){
|
||||
if(this.mv.ent.eid == eid){
|
||||
this.buff_add(new_buff);
|
||||
}
|
||||
}
|
||||
if(eid ==0 && group == this.group){
|
||||
this.buff_add(new_buff);
|
||||
}
|
||||
this.buff_add(new_buff);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,15 +90,16 @@ export class MonsterBuffComp extends CCComp {
|
||||
if(buff.atk>0){
|
||||
this.node.getChildByName("avatar").setScale(1.2,1.2)
|
||||
this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite).color= new Color().fromHEX("#F16F6F");
|
||||
this.mv.atk+=(buff.atk-b.atk);
|
||||
this.mv.atk+=(buff.atk+buff.args.atk-b.atk);
|
||||
}
|
||||
if(buff.hp>0){
|
||||
this.mv.hp+=(buff.hp-b.hp);
|
||||
this.mv.hp_max+=(buff.hp-b.hp);
|
||||
this.mv.hp+=(buff.hp+buff.args.hp);
|
||||
this.mv.add_hp(buff.hp+buff.args.hp);
|
||||
// this.mv.hp_max+=(buff.hp-b.hp);
|
||||
}
|
||||
if(buff.shield>0){
|
||||
this.mv.shield=buff.shield;
|
||||
this.mv.shield_max=buff.shield;
|
||||
this.mv.shield=(buff.shield+buff.args.shield);
|
||||
// this.mv.shield_max=(buff.shield+buff.args.shield);
|
||||
}
|
||||
|
||||
i=index
|
||||
@@ -114,17 +109,18 @@ export class MonsterBuffComp extends CCComp {
|
||||
if (i==0||this.buffs.length==0) {
|
||||
this.buffs.push(buff);
|
||||
if(buff.atk>0){
|
||||
this.mv.atk+=buff.atk;
|
||||
this.mv.atk+=(buff.atk+buff.args.atk);
|
||||
this.node.getChildByName("avatar").setScale(1.2,1.2)
|
||||
this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite).color= new Color().fromHEX("#F16F6F");
|
||||
}
|
||||
if(buff.hp>0){
|
||||
this.mv.hp+=buff.hp;
|
||||
this.mv.hp_max+=buff.hp;
|
||||
this.mv.hp+=(buff.hp+buff.args.hp);
|
||||
this.mv.add_hp(buff.hp+buff.args.hp);
|
||||
// this.mv.hp_max+=buff.hp;
|
||||
}
|
||||
if(buff.shield>0){
|
||||
this.mv.shield=buff.shield;
|
||||
this.mv.shield_max=buff.shield;
|
||||
this.mv.shield=(buff.shield+buff.args.shield);
|
||||
// this.mv.shield_max=(buff.shield+buff.args.shield);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -132,16 +128,17 @@ export class MonsterBuffComp extends CCComp {
|
||||
}
|
||||
buff_remove(index:number){
|
||||
if(this.buffs[index].atk>0){
|
||||
this.mv.atk-=this.buffs[index].atk;
|
||||
this.mv.atk-=(this.buffs[index].atk+this.buffs[index].args.atk);
|
||||
this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite).color= new Color().fromHEX("#FFFFFF");
|
||||
this.node.getChildByName("avatar").setScale(1,1)
|
||||
}
|
||||
if(this.buffs[index].shield>0){
|
||||
this.mv.shield_max-=this.buffs[index].shield;
|
||||
this.mv.shield=0
|
||||
// this.mv.shield_max-=(this.buffs[index].shield+this.buffs[index].args.shield);
|
||||
}
|
||||
if(this.buffs[index].hp>0){
|
||||
this.mv.hp_max-=this.buffs[index].hp;
|
||||
}
|
||||
// if(this.buffs[index].hp>0){
|
||||
// this.mv.hp_max-=this.buffs[index].hp;
|
||||
// }
|
||||
console.log("buff remove:",this.mv,this.buffs[index]);
|
||||
}
|
||||
buff_update(){
|
||||
|
||||
@@ -70,7 +70,7 @@ export class MonsterViewComp extends CCComp {
|
||||
stop_cd: number = 0.5; /*停止倒计时*/
|
||||
|
||||
shield:number = 0; //护盾量
|
||||
shield_max:number = 0;
|
||||
shield_max:number = 200;
|
||||
shield_time:number = 0; //护盾持续时间
|
||||
|
||||
box_group:number = 2;
|
||||
@@ -222,13 +222,14 @@ export class MonsterViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
in_shield(){
|
||||
if(this.shield <= 0){
|
||||
this.node.getChildByName("shield").active=false
|
||||
}else{
|
||||
this.node.getChildByName("shield").active=true
|
||||
let shield_progress= this.shield/this.shield_max;
|
||||
this.node.getChildByName("shield").getComponent(ProgressBar)!.progress = shield_progress;
|
||||
}
|
||||
let shield_progress= this.shield/this.shield_max;
|
||||
this.node.getChildByName("shield").getComponent(ProgressBar)!.progress = shield_progress;
|
||||
// if(this.shield <= 0){
|
||||
// this.node.getChildByName("shield").active=false
|
||||
// }else{
|
||||
// this.node.getChildByName("shield").active=true
|
||||
|
||||
// }
|
||||
}
|
||||
hp_change(hp: number){
|
||||
if(this.is_dead){
|
||||
@@ -253,6 +254,10 @@ export class MonsterViewComp extends CCComp {
|
||||
}, 15);
|
||||
}
|
||||
}
|
||||
add_hp(hp: number=0){
|
||||
console.log("hero 加血动画");
|
||||
this.tooltip(2,"+"+hp.toString());
|
||||
}
|
||||
shield_change(hp: number){
|
||||
let ls=this.shield - hp;
|
||||
if(ls <= 0){
|
||||
|
||||
Reference in New Issue
Block a user