涨能量需要再处理下, 怪物被攻击算命中 如何涨

This commit is contained in:
2025-07-24 00:05:11 +08:00
parent 690f0547cd
commit af89bb7707
8 changed files with 8602 additions and 7557 deletions

View File

@@ -1741,7 +1741,7 @@
"__id__": 7
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 73

File diff suppressed because it is too large Load Diff

View File

@@ -64,6 +64,10 @@ export enum FightSet {
SHIELD_LV=3,//护盾等级
ARMOR_LV=4,//防具等级
ACCESSORY_LV=5,//饰品等级
ATKED_TO_POWER=1,//被攻击涨能量
ATK_TO_POWER=1,//攻击涨能量
CRIT_TO_POWER=1,//暴击涨能量
DODGE_TO_POWER=1,//闪避涨能量
// ATK_TO_ATK_RATIO=0.1,
// ATK_TO_HP_RATIO=0.2,
// ATK_TO_SHIELD_RATIO=2,
@@ -106,6 +110,8 @@ export const VmInfo = {
lv:1,
exp:0,
next_exp:100,
power:0,
power_max:100,
cd:3,
skill_cd_buff:0,//技能cd修正
damage:0,

View File

@@ -121,6 +121,10 @@ export enum BuffAttr {
STUN_RATTO = 26, //击晕概率
FROST_TIME = 27, //冰冻时间
HP_MAX = 28, //最大生命值数值
ATK_TO_POWER = 29, //攻击涨能量
ATKED_TO_POWER = 30, //被攻击涨能量
CRIT_TO_POWER = 31, //暴击涨能量
DODGE_TO_POWER = 32, //闪避涨能量
}
export const geDebuffNum=()=>{
@@ -172,6 +176,10 @@ export const getBuffNum=()=>{
STUN_RATTO:0,
FROST_TIME:0,
HP_MAX:0,//最大生命值数值
ATK_TO_POWER:0,
ATKED_TO_POWER:0,
CRIT_TO_POWER:0,
DODGE_TO_POWER:0,
}
}

View File

@@ -11,6 +11,7 @@ import { FriendModelComp } from "./FriendModel";
import { MasterModelComp } from "./MasterModel";
import { GameEvent } from "../common/config/GameEvent";
import { BuffAttr } from "../common/config/SkillSet";
import { FightSet } from "../common/config/Mission";
/** 角色实体 */
@ecs.register(`Hero`)
@@ -51,6 +52,7 @@ export class Hero extends ecs.Entity {
hv.scale = 1;
hv.is_master=true;
hv.lv=1
console.log("hero load",hv.ATK_TO_POWER,hv.ATKED_TO_POWER,hv.CRIT_TO_POWER,hv.DODGE_TO_POWER)
this.add(hv);
this.addComponents<ecs.Comp>(MasterModelComp)
oops.message.dispatchEvent(GameEvent.MasterCalled,{uuid:uuid})
@@ -92,6 +94,10 @@ export class Hero extends ecs.Entity {
hv.hp= hv.hp_max = hv.hp_base=hero.hp+info.hp
hv.ap = hero.ap+info.ap;
hv.ap_base=hero.ap+info.ap;
hv.ATK_TO_POWER=FightSet.ATK_TO_POWER
hv.ATKED_TO_POWER=FightSet.ATKED_TO_POWER
hv.CRIT_TO_POWER=FightSet.CRIT_TO_POWER
hv.DODGE_TO_POWER=FightSet.DODGE_TO_POWER
hero.buff.forEach((buff:any)=>{
switch(buff.buff_type){
case BuffAttr.CRITICAL:
@@ -148,6 +154,18 @@ export class Hero extends ecs.Entity {
case BuffAttr.FROST_TIME:
hv.frost_time=buff.value
break
case BuffAttr.ATK_TO_POWER:
hv.ATK_TO_POWER+=buff.value
break
case BuffAttr.ATKED_TO_POWER:
hv.ATKED_TO_POWER+=buff.value
break
case BuffAttr.CRIT_TO_POWER:
hv.CRIT_TO_POWER+=buff.value
break
case BuffAttr.DODGE_TO_POWER:
hv.DODGE_TO_POWER+=buff.value
break
}
})
hv.atk_skill=hero.skills[0]

View File

@@ -1,7 +1,6 @@
import { _decorator, CCClass, Component, sp,Animation} from "cc";
import { FightSet } from "../common/config/Mission";
import { FacSet } from "../common/config/BoxSet";
import { _decorator, CCClass, Component, sp } from "cc";
import { HeroViewComp } from "./HeroViewComp";
import { FacSet } from "../common/config/BoxSet";
const { ccclass, property } = _decorator;
@ccclass('HeroAnmComp')
@@ -9,72 +8,63 @@ export default class HeroAnmComp extends Component{
mixTime:number= 0.2;
private spine: sp.Skeleton;
private spine?: sp.Skeleton;
private _hasStop = true;
private anm:Animation
private is_spine:boolean=false
onLoad () {
if(this.getComponent('sp.Skeleton')){
this.is_spine=true
this.spine=this.getComponent('sp.Skeleton') as sp.Skeleton;
var spine = this.spine = this.getComponent('sp.Skeleton') as sp.Skeleton;
// if(this.node.parent.getComponent(HeroViewComp).fac==FacSet.HERO){
// console.log('hero parent',this.node.parent.getComponent(HeroViewComp))
// this._setMix('Walking', 'Idle');
// this._setMix('Walking', 'Attacking');
// this._setMix('Walking', 'Taunt');
// this._setMix('Idle', 'Attacking');
// this._setMix('Idle', 'Taunt');
// this._setMix('Idle', 'Walking');
// this._setMix('Attacking', 'Idle');
// this._setMix('Attacking', 'Walking');
// this._setMix('Taunt', 'Walking');
// this._setMix('Taunt', 'Idle');
// }
spine.setCompleteListener((trackEntry) => {
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
if (animationName === 'Attacking'||animationName==='Taunt'||animationName==='Hurt') {
this.idle()
var spine = this.spine = this.getComponent('sp.Skeleton') as sp.Skeleton;
this._setMix('Walking', 'Idle');
this._setMix('Walking', 'Attacking');
this._setMix('Walking', 'Taunt');
this._setMix('Idle', 'Attacking');
this._setMix('Idle', 'Taunt');
this._setMix('Idle', 'Walking');
this._setMix('Attacking', 'Idle');
this._setMix('Attacking', 'Walking');
this._setMix('Attacking', 'Hurt');
this._setMix('Taunt', 'Walking');
this._setMix('Taunt', 'Idle');
this._setMix('Hurt', 'Idle');
this._setMix('Hurt', 'Attacking');
this._setMix('Hurt', 'Taunt');
spine.setCompleteListener((trackEntry) => {
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
if (animationName === 'Attacking'||animationName==='Taunt'||animationName==='Hurt') {
this.spine!.clearTrack(1);
if(this.node.parent.getComponent(HeroViewComp).fac==FacSet.HERO){
this.spine?.setAnimation(0, 'Idle', false);
}
var loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
// console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex, animationName, loopCount);
});
spine.setEventListener(((trackEntry:any, event:any) => {
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
// console.log("[track %s][animation %s] event: %s, %s, %s, %s", trackEntry.trackIndex, animationName, event.data.name, event.intValue, event.floatValue, event.stringValue);
}) as any);
}else{
this.is_spine=false
this.anm=this.getComponent(Animation)
}
}
var loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
// console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex, animationName, loopCount);
});
spine.setEventListener(((trackEntry:any, event:any) => {
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
// console.log("[track %s][animation %s] event: %s, %s, %s, %s", trackEntry.trackIndex, animationName, event.data.name, event.intValue, event.floatValue, event.stringValue);
}) as any);
this._hasStop = false;
}
// OPTIONS
toggleDebugSlots () {
if(!this.is_spine) return
this.spine!.debugSlots = !this.spine?.debugSlots;
}
toggleDebugBones () {
if(!this.is_spine) return
this.spine!.debugBones = !this.spine?.debugBones;
}
toggleDebugMesh () {
if(!this.is_spine) return
this.spine!.debugMesh = !this.spine?.debugMesh;
}
toggleUseTint () {
if(!this.is_spine) return
this.spine!.useTint = !this.spine?.useTint;
}
toggleTimeScale () {
if(!this.is_spine) return
if (this.spine!.timeScale === 1.0) {
this.spine!.timeScale = 0.3;
}
@@ -91,49 +81,25 @@ export default class HeroAnmComp extends Component{
}
move () {
if(!this.is_spine) {
this.anm?.play('move')
}else{
if (this._hasStop) {
this.spine?.setToSetupPose();
}
this.spine?.setAnimation(0, 'Walking', true);
this._hasStop = false;
if (this._hasStop) {
this.spine?.setToSetupPose();
}
this.spine?.setAnimation(0, 'Walking', true);
this._hasStop = false;
}
atk () {
if(!this.is_spine) {
this.anm?.play('atk')
}else{
this.spine?.setAnimation(0, 'Attacking', false);
}
this.spine?.setAnimation(1, 'Attacking', false);
}
max () {
if(!this.is_spine) {
this.anm?.play('atk')
}else{
this.spine?.setAnimation(0, 'Taunt', false);
}
this.spine?.setAnimation(1, 'Taunt', false);
}
atked () {
if(!this.is_spine) {
this.anm?.play('move')
}else{
this.spine?.setAnimation(0, 'Hurt', false);
}
if(this.spine.animation==='Hurt') return
this.spine?.setAnimation(1, 'Hurt', false);
}
idle () {
if(!this.is_spine) {
this.anm?.play('move')
}else{
this.spine?.setToSetupPose();
if(this.node.parent.getComponent(HeroViewComp).fac==FacSet.HERO){
this.spine?.setAnimation(0, 'Idle', true);
}else{
this.spine?.setAnimation(0, 'Walking', true);
}
}
this.spine?.setToSetupPose();
this.spine?.setAnimation(0, 'Idle', true);
}
_setMix (anim1: string, anim2: string) {

View File

@@ -111,7 +111,12 @@ export class HeroViewComp extends CCComp {
DEBUFF_COUNT:number=0; //debuff 持续次数
DEBUFF_UP:number=0; //debuff 概率提升
ATK_TO_POWER:number=0;
ATKED_TO_POWER:number=0;
CRIT_TO_POWER:number=0;
DODGE_TO_POWER:number=0;
private damageQueue: Array<{
damage: number,
isCrit: boolean,
@@ -461,8 +466,12 @@ export class HeroViewComp extends CCComp {
let damage = this.count_damage(remainingDamage)
if(is_crit) {
damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE+crit_d)/100))
if(this.fac==FacSet.MON) smc.vmdata.hero.power+=this.CRIT_TO_POWER //暴击涨能量 怪物被暴击,因为只有一个英雄 直接处理
}
this.hp -= damage;
if(this.fac==FacSet.HERO) {smc.vmdata.hero.power+=this.ATKED_TO_POWER;console.log("被攻击涨能量",this)} //被攻击涨能量
if(this.fac==FacSet.MON) {smc.vmdata.hero.power+=this.ATK_TO_POWER;console.log("攻击命中涨能量",this)} //攻击命中涨能量 因为是只有1个英雄 直接处理
if(this.hp <= 0) {
if(this == null) return;
this.is_dead=true
@@ -527,6 +536,7 @@ export class HeroViewComp extends CCComp {
}
check_dodge(){
if(this.fac==FacSet.HERO) smc.vmdata.hero.power+=this.DODGE_TO_POWER //闪避涨能量
if(this.dod > 0){
let random = Math.random()*100
if(random < this.dod) {
@@ -538,6 +548,7 @@ export class HeroViewComp extends CCComp {
}
check_crit(crit:number=0){
if(this.crit_no) return false
if(crit > 0){
let random = Math.random()*100
@@ -574,10 +585,9 @@ export class HeroViewComp extends CCComp {
to_grave(){
tween(this.node).to(0.5, { position:v3(-900,this.node.position.y+300,0)},{
onComplete: (target?: object) => {
this.node.setPosition(-900,this.node.position.y-300,0)
}
}
).start()
this.node.setPosition(-900,this.node.position.y-300,0)
}
}).start()
}
// to_alive(){
// this.is_dead=false
@@ -681,7 +691,8 @@ export class HeroViewComp extends CCComp {
/** 立即显示伤害效果 */
private showDamageImmediate(damage: number, isCrit: boolean) {
this.BUFFCOMP.in_atked();
this.as.atked()
// this.BUFFCOMP.in_atked()
this.atked_count++;
if (isCrit) {
this.BUFFCOMP.tooltip(TooltipTypes.crit, damage.toFixed(0), damage);

View File

@@ -16,7 +16,6 @@ const { ccclass, property } = _decorator;
export class EquipSkillComp extends CCComp {
skill1:any=null
skill2:any=null
skill3:any=null
boxs:Node=null
skill1_cd_bar_progress:any=null
skill2_cd_bar_progress:any=null
@@ -29,7 +28,6 @@ export class EquipSkillComp extends CCComp {
this.boxs=this.node.getChildByName("boxs")
this.skill1_cd_bar_progress=this.boxs.getChildByName("skill1").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)
this.skill2_cd_bar_progress=this.boxs.getChildByName("skill2").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)
this.skill3_cd_bar_progress=this.boxs.getChildByName("skill3").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)
}
start(){
this.fight_ready()
@@ -42,15 +40,7 @@ export class EquipSkillComp extends CCComp {
this.get_skill(null,{slot:"skill2",uuid:hero.skills[2]})
}
}
skill_stone_up(e:GameEvent,data:any){
console.log("[EquipSkillComp]: skill_stone_up",data)
smc.vmdata.mission_data.skill_stone+=data
if(smc.vmdata.mission_data.skill_stone >= smc.vmdata.mission_data.skill_stone_max){
this.show_skill_get("skill1")
this.show_skill_get("skill2")
this.show_skill_get("skill3")
}
}
fight_ready(){
this.boxs=this.node.getChildByName("boxs")
console.log("[EquipSkillComp]: fight_ready",this.node)
@@ -71,6 +61,7 @@ export class EquipSkillComp extends CCComp {
quality:0,
cd:0,
cd_time:0,
active:false,
}
this.skill2={
uuid:0,
@@ -80,16 +71,9 @@ export class EquipSkillComp extends CCComp {
quality:0,
cd:0,
cd_time:0,
active:false,
}
this.skill3={
uuid:0,
name:"skill3",
type:0,//
level:0,
quality:0,
cd:0,
cd_time:0,
}
}
update(dt: number): void {
if(!smc.mission.play||smc.mission.pause) return
@@ -104,28 +88,11 @@ export class EquipSkillComp extends CCComp {
}
this.skill1_cd_bar_progress.progress=(1-this.skill1.cd_time/cd)
}
if(this.skill2.uuid!=0){
let cd=this.skill2.cd*(100-smc.vmdata.hero.skill_cd_buff)/100
if(this.skill2.cd_time < cd){
this.skill2.cd_time+=dt
}else{
if(this.skill2.type==1){
this.do_skill2()
}
}
this.skill2_cd_bar_progress.progress=(1-this.skill2.cd_time/cd)
if(this.skill2.uuid!=0&&smc.vmdata.hero.power>=smc.vmdata.hero.power_max){
this.do_skill2()
smc.vmdata.hero.power=0
}
if(this.skill3.uuid!=0){
let cd=this.skill3.cd*(100-smc.vmdata.hero.skill_cd_buff)/100
if(this.skill3.cd_time < cd){
this.skill3.cd_time+=dt
}else{
if(this.skill3.type==1){
// this.do_skill3()
}
}
this.skill3_cd_bar_progress.progress=(1-this.skill3.cd_time/cd)
}
}
do_skill1(){
console.log("do_skill1")
@@ -135,28 +102,15 @@ export class EquipSkillComp extends CCComp {
}}).start()
this.do_skill(this.skill1.uuid)
}
do_skill2(){
console.log("do_skill2")
this.skill2.cd_time=0
tween(this.boxs.getChildByName("skill2")).to(0.1, {scale:v3(1.2,1.2,1)},{onComplete:()=>{
tween(this.boxs.getChildByName("skill2")).to(0.2, {scale:v3(1,1,1)}).start()
}}).start()
this.do_skill(this.skill2.uuid)
}
do_skill3(){
if(this.skill3.uuid==0) return
if(this.skill3.cd_time < (this.skill3.cd)) return
if(smc.vmdata.mission_data.skill_stone < SkillSet[this.skill3.uuid].cost){
oops.gui.toast("技能石不足", false);
return
}
smc.vmdata.mission_data.skill_stone-=SkillSet[this.skill3.uuid].cost
this.skill3.cd_time=0
tween(this.boxs.getChildByName("skill3")).to(0.1, {scale:v3(1.2,1.2,1)},{onComplete:()=>{
tween(this.boxs.getChildByName("skill3")).to(0.2, {scale:v3(1,1,1)}).start()
}}).start()
oops.message.dispatchEvent(GameEvent.MaxSkill,{uuid:this.skill3.uuid})
}
do_skill(uuid:number){
console.log("出发技能:",uuid)
@@ -194,32 +148,11 @@ export class EquipSkillComp extends CCComp {
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
});
break
case "skill3":
this.skill3.uuid=data.uuid
this.skill3.skill_name=SkillSet[data.uuid].name
this.skill3.type=1
this.skill3.cd=SkillSet[data.uuid].cd
this.skill3.cd_time=SkillSet[data.uuid].cd
let icon = this.boxs.getChildByName("skill3").getChildByName("icon")
icon.active=true
var icon_path = "game/heros/cards"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = icon.getChildByName("skill").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[data.uuid].path);
});
break
}
}
call_skill_card(e:any,data:any){
let mission_data=smc.vmdata.mission_data
if(mission_data.skill_stone < mission_data.skill_stone_max){
oops.gui.toast("技能石不足", false);
return
}
oops.message.dispatchEvent(GameEvent.HeroSkillSelect,{slot:data})
mission_data.skill_stone-=mission_data.skill_stone_max
mission_data.skill_stone_max=mission_data.skill_stone_max*2
}
@@ -236,15 +169,22 @@ export class EquipSkillComp extends CCComp {
this.boxs.getChildByName("skill2").getChildByName("tip").active =true
this.boxs.getChildByName("skill2").getChildByName("tip").getComponent(Label).string="学习"
}
if(this.skill3.uuid==0&&this.skill1.uuid!=0&&this.skill2.uuid!=0){
this.boxs.getChildByName("skill3").getChildByName("get").active =true
this.boxs.getChildByName("skill3").getChildByName("light").active=true
this.boxs.getChildByName("skill3").getChildByName("tip").active =true
this.boxs.getChildByName("skill3").getChildByName("tip").getComponent(Label).string="学习"
}
}
show_info(e:any,data:any){
switch(data){
case "skill1":
console.log("[EquipSkillComp]: show_info",this.skill1)
break
case "skill2":
console.log("[EquipSkillComp]: show_info",this.skill2)
break
}
}
private hide_skill_get(e:any,data:string){
this.boxs.getChildByName("skill1").getChildByName("get").active =false
this.boxs.getChildByName("skill1").getChildByName("tip").active =false
@@ -266,9 +206,7 @@ export class EquipSkillComp extends CCComp {
if(this.skill2.uuid!=0){
this.boxs.getChildByName("skill2").getChildByName("change").active =true
}
if(this.skill3.uuid!=0){
this.boxs.getChildByName("skill3").getChildByName("change").active =true
}
}
private hide_skill_change(e:any,data:any){