护盾改为 护甲值
This commit is contained in:
@@ -69,11 +69,26 @@ export class BuffComp extends Component {
|
||||
// this.vmdata_update()
|
||||
}
|
||||
|
||||
show_shield(val:boolean){
|
||||
this.node.getChildByName("shielded").active=val
|
||||
show_shield(shield:number=0,shield_max:number=0){
|
||||
let shield_progress= shield/shield_max;
|
||||
this.node.getChildByName("shielded").active=shield > 0
|
||||
this.node.getChildByName("top").getChildByName("shield").active=shield > 0
|
||||
this.node.getChildByName("top").getChildByName("shield").getComponent(ProgressBar).progress = shield_progress;
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("top").getChildByName("shield").getChildByName("pb").getComponent(ProgressBar).progress = shield_progress;
|
||||
},0.15)
|
||||
}
|
||||
|
||||
|
||||
hp_show(hp:number,hp_max:number){
|
||||
// if(this.node.getComponent(HeroViewComp).fac == 0) return
|
||||
let hp_progress= hp/hp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar).progress = hp_progress;
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("top").getChildByName("hp").getChildByName("hpb").getComponent(ProgressBar).progress = hp_progress;
|
||||
},0.15)
|
||||
// this.node.getChildByName("top").getChildByName("hp").active = (hp == hp_max) ? false : true;
|
||||
}
|
||||
|
||||
|
||||
update_info_lv(){
|
||||
|
||||
@@ -43,10 +43,13 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
speed: number = 100; /** 角色移动速度 */
|
||||
speed_base: number = 100; /** 角色初始速度 */
|
||||
|
||||
power:number=0;
|
||||
power_max:number=100;
|
||||
hp: number = 100; /** 血量 */
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
hp_base:number=0;
|
||||
shield:number=0; //当前护甲值
|
||||
shield_max:number=0; //最大护甲值
|
||||
ap: number = 10; /**攻击力 */
|
||||
ap_base:number=0;
|
||||
// atk_speed: number = 1;
|
||||
@@ -72,7 +75,6 @@ export class HeroViewComp extends CCComp {
|
||||
frost_no:boolean=false; //冰冻免疫
|
||||
knockback:number=0; //击退概率
|
||||
knockback_no:boolean=false; //击退免疫
|
||||
shield:number = 0; //护盾,免伤1次减1
|
||||
reflect:number=0; //反射伤害比率
|
||||
lifesteal:number=0; //吸血比率
|
||||
skill_dmg:number=0
|
||||
@@ -143,6 +145,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
/* 显示角色血量 */
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
this.add_shield(100)
|
||||
}
|
||||
|
||||
update(dt: number){
|
||||
@@ -166,17 +169,6 @@ export class HeroViewComp extends CCComp {
|
||||
this.processDamageQueue();
|
||||
|
||||
}
|
||||
hp_show(){
|
||||
// if(this.node.getComponent(HeroViewComp).fac == 0) return
|
||||
let hp=this.hp;
|
||||
let hp_max=this.Attrs[BuffAttr.HP_MAX];
|
||||
let hp_progress= hp/hp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar).progress = hp_progress;
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("top").getChildByName("hp").getChildByName("hpb").getComponent(ProgressBar).progress = hp_progress;
|
||||
},0.15)
|
||||
// this.node.getChildByName("top").getChildByName("hp").active = (hp == hp_max) ? false : true;
|
||||
}
|
||||
do_fight_end(){
|
||||
this.as.do_buff()
|
||||
}
|
||||
@@ -204,9 +196,8 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
add_shield(shield:number){
|
||||
this.shield =shield
|
||||
if(this.shield>6) this.shield=6
|
||||
if(this.shield>0) this.BUFFCOMP.show_shield(true)
|
||||
this.shield = this.shield_max +=shield
|
||||
if(this.shield>0) this.BUFFCOMP.show_shield(this.shield,this.shield_max)
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +223,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp+=real_hp;
|
||||
this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0));
|
||||
}
|
||||
this.hp_show()
|
||||
this.BUFFCOMP.hp_show(this.hp,this.Attrs[BuffAttr.HP_MAX])
|
||||
// this.update_vm
|
||||
}
|
||||
|
||||
@@ -414,7 +405,7 @@ export class HeroViewComp extends CCComp {
|
||||
if(stun_time>0){
|
||||
this.add_debuff(DebuffAttr.STUN,stun_time,1,stun_ratio)
|
||||
}
|
||||
if(this.check_shield()) return
|
||||
|
||||
if(this.check_dodge()) return
|
||||
let is_crit = this.check_crit(crit)
|
||||
|
||||
@@ -424,8 +415,9 @@ export class HeroViewComp extends CCComp {
|
||||
damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE+crit_d)/100))
|
||||
}
|
||||
console.log(this.hero_name+"[HeroViewComp]:heroview :damage|hp|hp_max",damage,this.hp,this.Attrs[BuffAttr.HP_MAX])
|
||||
damage=this.check_shield(damage)
|
||||
if(damage <= 0) return
|
||||
this.hp -= damage;
|
||||
|
||||
if(this.hp <= 0) {
|
||||
if(this == null) return;
|
||||
this.is_dead=true
|
||||
@@ -470,17 +462,23 @@ export class HeroViewComp extends CCComp {
|
||||
return Math.floor(Math.max(damage,min))
|
||||
}
|
||||
|
||||
check_shield(){
|
||||
if(this.shield>0){
|
||||
this.shield -= 1
|
||||
check_shield(damage:number){
|
||||
if(this.shield <= 0 ) return damage
|
||||
if(this.shield >= damage){
|
||||
this.shield -= damage
|
||||
this.BUFFCOMP.tooltip(TooltipTypes.uskill,"*吸收*");
|
||||
if (this.shield <= 0) {
|
||||
if(this == null) return;
|
||||
this.BUFFCOMP.show_shield(false);
|
||||
if(this.shield <= 0){
|
||||
this.shield=this.shield_max=0
|
||||
}
|
||||
return true
|
||||
damage = 0
|
||||
}
|
||||
return false
|
||||
if(this.shield < damage){
|
||||
damage=damage-this.shield
|
||||
this.shield=0
|
||||
this.shield_max=0
|
||||
}
|
||||
this.BUFFCOMP.show_shield(this.shield,this.shield_max)
|
||||
return damage
|
||||
}
|
||||
|
||||
check_dodge(){
|
||||
@@ -622,7 +620,7 @@ export class HeroViewComp extends CCComp {
|
||||
/** 立即显示伤害效果 */
|
||||
private showDamageImmediate(damage: number, isCrit: boolean,anm:string="atked") {
|
||||
// this.as.atked()
|
||||
this.hp_show()
|
||||
this.BUFFCOMP.hp_show(this.hp,this.Attrs[BuffAttr.HP_MAX])
|
||||
this.BUFFCOMP.in_atked(anm,this.fac==FacSet.HERO?1:-1)
|
||||
this.atked_count++;
|
||||
if (isCrit) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { _decorator, Component, Node, v3, Vec3 } from 'cc';
|
||||
import { _decorator, Component, Node, ProgressBar, v3, Vec3 } from 'cc';
|
||||
import { HeroViewComp } from './HeroViewComp';
|
||||
import { BuffAttr, DTType, SkillSet, SType, TGroup, TType } from '../common/config/SkillSet';
|
||||
import { BuffAttr, CdType, DTType, SKILL_CONST, SkillSet, SType, TGroup, TType } from '../common/config/SkillSet';
|
||||
import { Skill } from '../skills/Skill';
|
||||
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
|
||||
import { oops } from 'db://oops-framework/core/Oops';
|
||||
@@ -11,6 +11,7 @@ import { CCComp } from 'db://oops-framework/module/common/CCComp';
|
||||
import { MonModelComp } from './MonModelComp';
|
||||
import { HeroModelComp } from './HeroModelComp';
|
||||
import { FightSet } from '../common/config/Mission';
|
||||
import { Timer } from 'db://oops-framework/core/common/timer/Timer';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('SkillCon')
|
||||
@@ -35,15 +36,32 @@ export class SkillConComp extends CCComp {
|
||||
|
||||
update(dt: number) {
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
|
||||
if(this.HeroView.DEBUFF_STUN <= 0&&this.HeroView.DEBUFF_FROST <= 0) {
|
||||
for(let i=0;i<this.HeroView.skills.length;i++){
|
||||
this.HeroView.skills[i].cd += dt;
|
||||
if(this.HeroView.skills[i].cd > (i==0?this.HeroView.Attrs[BuffAttr.ATK_CD]:this.HeroView.skills[i].cd_max)){
|
||||
let sc=SkillSet[this.HeroView.skills[i].uuid]
|
||||
if(!sc) return
|
||||
if(sc.SType==SType.damage&&!this.HeroView.is_atking) return
|
||||
this.castSkill(sc)
|
||||
this.HeroView.skills[i].cd = 0
|
||||
let skills=this.HeroView.skills
|
||||
for(let i=0;i<skills.length;i++){
|
||||
if(SkillSet[skills[i].uuid].CdType==CdType.cd) {
|
||||
skills[i].cd += dt;
|
||||
if(skills[i].cd > (i==0?this.HeroView.Attrs[BuffAttr.ATK_CD]:skills[i].cd_max)){
|
||||
if(SkillSet[skills[i].uuid].SType==SType.damage&&this.HeroView.is_atking){
|
||||
this.castSkill(SkillSet[skills[i].uuid])
|
||||
this.HeroView.skills[i].cd = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(skills[1]){
|
||||
if(this.HeroView.fac==FacSet.HERO) {
|
||||
console.log("[SkillConComp] 角色状态:",this.HeroView.hero_name+"=>能量:"+this.HeroView.power+"/"+this.HeroView.power_max,skills)
|
||||
}
|
||||
this.HeroView.power+=(1+this.HeroView.Attrs[BuffAttr.POWER_UP])*dt*SKILL_CONST.POWER_UP
|
||||
let progress=this.HeroView.power/this.HeroView.power_max
|
||||
this.HeroView.node.getChildByName("top").getChildByName("pow").getComponent(ProgressBar).progress=progress
|
||||
if(this.HeroView.power>this.HeroView.power_max){
|
||||
this.HeroView.power=0
|
||||
}
|
||||
}else{
|
||||
if(this.HeroView.fac==FacSet.HERO) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user