护盾改为 护甲值

This commit is contained in:
2025-08-17 12:25:22 +08:00
parent 6288d4e4bb
commit e5874bf936
15 changed files with 8903 additions and 8921 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "12eb126e-afc6-4b04-911e-8cab7f334c44",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "victory"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -17047,8 +17047,8 @@
"rawHeight": 53,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"borderLeft": 54,
"borderRight": 54,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,

View File

@@ -59,7 +59,7 @@ export class SingletonModuleComp extends ecs.Comp {
mission:1,//关卡
chapter:1,//章节
level:1,//关卡等级
max_mission:10,//最大关卡
max_mission:4,//最大关卡
meat:0,//肉
mon_num:0,//怪物数量
hero_num:0,//英雄数量
@@ -418,10 +418,10 @@ export class SingletonModuleComp extends ecs.Comp {
this.vmdata.mission_data.mission=this.getGameProperty("mission", 1)
this.vmdata.mission_data.score=this.getGameProperty("score", 0)
this.vmdata.mission_data.exp=this.getGameProperty("exp", 0)
// 计算章节和关卡等级
const currentMission = this.getGameProperty("mission", 1)
this.vmdata.mission_data.chapter = Math.floor((currentMission - 1) / 10) + 1
this.vmdata.mission_data.level = ((currentMission - 1) % 10) + 1
// // 计算章节和关卡等级
// const currentMission = this.getGameProperty("mission", 1)
// this.vmdata.mission_data.chapter = Math.floor((currentMission - 1) / 10) + 1
// this.vmdata.mission_data.level = ((currentMission - 1) % 10) + 1
}
initReward(){
this.vmdata.reward.gold=0
@@ -507,8 +507,8 @@ export class SingletonModuleComp extends ecs.Comp {
this.setGameProperty("mission", newMission, autoSave);
console.log(`[SMC]: 关卡进度增加: ${currentMission} -> ${newMission} (+${amount})`);
// 计算章节和关卡等级
this.vmdata.mission_data.chapter = Math.floor((newMission - 1) / 10) + 1
this.vmdata.mission_data.level = ((newMission - 1) % 10) + 1
// this.vmdata.mission_data.chapter = Math.floor((newMission - 1) / 10) + 1
// this.vmdata.mission_data.level = ((newMission - 1) % 10) + 1
return newMission;
}

View File

@@ -29,7 +29,7 @@ export var UIConfigData: { [key: number]: UIConfig } = {
// [UIID.Window]: { layer: LayerType.Dialog, prefab: "common/prefab/window" },
[UIID.Role_Controller]: { layer: LayerType.UI, prefab: "gui/role_controller" },
[UIID.HeroInfo]: { layer: LayerType.UI, prefab: "gui/Hinfo" },
[UIID.Victory]: { layer: LayerType.UI, prefab: "gui/victory" },
[UIID.Victory]: { layer: LayerType.UI, prefab: "gui/element/victory" },
// [UIID.Shop_Page]: { layer: LayerType.UI, prefab: "gui/shop_page" },
// [UIID.Hero_Page]: { layer: LayerType.UI, prefab: "gui/heros_page" },
// [UIID.Toast]: { layer: LayerType.PopUp, prefab: "common/prefab/toast" },

View File

@@ -25,6 +25,9 @@ export enum TType {
/** 随机目标 */
Random =8 // 随机目标
}
export enum SKILL_CONST {
POWER_UP = 60,
}
export enum DTType {
single = 0,
@@ -140,6 +143,7 @@ export enum BuffAttr {
DIS = 33, //距离
SPEED = 34, //速度
SHIELD = 35, //护盾
POWER_MAX = 36, //最大能量
}
export const getBuffNum=()=>{
return {
@@ -179,6 +183,7 @@ export const getBuffNum=()=>{
[BuffAttr.DIS]:0,//距离
[BuffAttr.SPEED]:0,//速度
[BuffAttr.SHIELD]:0,//护盾
[BuffAttr.POWER_MAX]:0,//最大能量
}
}
export const geDebuffNum=()=>{

View File

@@ -44,19 +44,20 @@ export const getMonList = (quality:number=0)=>{
}).map(item=>item.uuid)
}
export const HeroPos={
0:{pos:v3(-290,0,0)},
1:{pos:v3(0,0,0)},
2:{pos:v3(-100,0,0)},
}
export const MonSet = {
0:{pos:v3(160,0,0)},
1:{pos:v3(220,0,0)},
2:{pos:v3(280,0,0)},
3:{pos:v3(340,0,0)},
4:{pos:v3(400,0,0)},
5:{pos:v3(460,0,0)},
0:{pos:v3(240,0,0)},
1:{pos:v3(320,0,0)},
2:{pos:v3(360,0,0)},
3:{pos:v3(400,0,0)},
4:{pos:v3(440,0,0)},
5:{pos:v3(480,0,0)},
6:{pos:v3(520,0,0)},
7:{pos:v3(560,0,0)},
}
export const HQuality = {
@@ -75,11 +76,11 @@ export const HQuality = {
export const HeroInfo = {
//主将
5001:{uuid:5001,name:"火焰骑士",path:"hk1", fac:FacSet.HERO, quality:HQuality.GREEN,lv:1,kind:1,
type:HType.warrior,hp:100,ap:15,dis:100,cd:1,speed:150,skills:[6001],
type:HType.warrior,hp:100,ap:15,dis:100,cd:1,speed:150,skills:[6001,6001],
buff:[],info:"剑类专精,穿刺伤害额外+10%"},
5002:{uuid:5002,name:"hk1",path:"hk1", fac:FacSet.HERO, quality:HQuality.BLUE,lv:1,kind:1,
type:HType.warrior,hp:100,ap:15,dis:100,cd:1,speed:150,skills:[6001],
type:HType.warrior,hp:100,ap:15,dis:100,cd:1,speed:150,skills:[6001,6001],
buff:[],info:"斧类专精,风怒概率增加10%"},
// 5003:{uuid:5003,name:"碎颅.赫克托",path:"k4", quality:HQuality.BLUE,lv:1,kind:1,
@@ -91,7 +92,7 @@ export const HeroInfo = {
// buff:[],info:"刀类专精,易伤效果额外持续1次"},
5005:{uuid:5005,name:"ha1",path:"ha1", fac:FacSet.HERO, quality:HQuality.BLUE,lv:1,kind:2,
type:HType.remote,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6003],
type:HType.remote,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6003,6003],
buff:[],info:"说明"},

View File

@@ -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(){

View File

@@ -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);
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) {

View File

@@ -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,18 +36,35 @@ 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)
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) {
}
}
}
}

View File

@@ -9,6 +9,7 @@ import { GameEvent } from "../common/config/GameEvent";
import { HeroViewComp } from "../hero/HeroViewComp";
import { MonModelComp } from "../hero/MonModelComp";
import { SkillCom } from "../skills/SkillCom";
import { UIID } from "../common/config/GameUIConfig";
const { ccclass, property } = _decorator;
@@ -46,12 +47,17 @@ export class MissionComp extends CCComp {
}
do_mon_dead(){
smc.addGold(1)
smc.vmdata.mission_data.mon_num--
console.log("[MissionComp] do_mon_dead",smc.vmdata.mission_data.mon_num)
if(smc.vmdata.mission_data.mon_num<=0) {
smc.addMission()
smc.vmdata.mission_data.level++
if(smc.vmdata.mission_data.level < smc.vmdata.mission_data.max_mission){
oops.message.dispatchEvent(GameEvent.NewWave)
return
}
smc.addMission(1)
oops.message.dispatchEvent(GameEvent.FightEnd,{victory:true})
oops.gui.open(UIID.Victory,{victory:true})
}
}
do_hero_dead(){
@@ -59,6 +65,7 @@ export class MissionComp extends CCComp {
console.log("[MissionComp] do_hero_dead",smc.vmdata.mission_data.hero_num)
if(smc.vmdata.mission_data.hero_num<=0) {
oops.message.dispatchEvent(GameEvent.FightEnd,{victory:false})
oops.gui.open(UIID.Victory,{victory:false})
}
}
do_ad(){
@@ -79,7 +86,6 @@ export class MissionComp extends CCComp {
async mission_start(){
console.log("[MissionComp] ** 1 ** mission_start")
this.node.getChildByName("ending").getComponent(Animation).play("startFight")
oops.message.dispatchEvent(GameEvent.FightReady)
this.node.active=true
@@ -103,6 +109,7 @@ export class MissionComp extends CCComp {
to_end_fight(){
oops.message.dispatchEvent(GameEvent.FightEnd,{victory:false})
oops.gui.open(UIID.Victory,{victory:false})
}
@@ -117,6 +124,7 @@ export class MissionComp extends CCComp {
}
mission_end(){
console.log("[MissionComp] mission_end")
this.node.getChildByName("ending").active=false
this.node.active=false
}
@@ -126,6 +134,7 @@ export class MissionComp extends CCComp {
smc.mission.play = true;
smc.vmdata.mission_data.in_fight=false
smc.vmdata.mission_data.fight_time=0
smc.vmdata.mission_data.level=0
smc.initReward()
console.log("[MissionComp]局内数据初始化",smc.vmdata.mission_data)
}

View File

@@ -43,8 +43,8 @@ export class MissionMonCompComp extends CCComp { // 添加刷怪队列 - 使
onLoad(){
// this.on(GameEvent.NewWave,this.do_mon_wave,this)
this.on(GameEvent.FightReady,this.fight_ready,this)
this.on(GameEvent.NewWave,this.fight_ready,this)
}
/** 视图层逻辑代码分离演示 */

View File

@@ -16,49 +16,34 @@ export class VictoryComp extends CCComp {
reward_num:number=2
/** 视图层逻辑代码分离演示 */
protected onLoad(): void {
this.on(GameEvent.MissionStart,this.mission_start,this)
this.on(GameEvent.FightEnd,this.fight_end,this)
}
onAdded(args: any) {
console.log("[VictoryComp] onAdded",args)
this.node.getChildByName("title").getChildByName("victory").active=args.victory
this.node.getChildByName("title").getChildByName("defeat").active=!args.victory
this.node.getChildByName("btns").getChildByName("next").active=false
this.scheduleOnce(()=>{
this.node.getChildByName("btns").getChildByName("next").active=true
},0.2)
}
mission_start(){
this.hide()
}
fight_end(e:any,val:any){
this.node.getChildByName("title").getChildByName("victory").active=val.victory
this.node.getChildByName("title").getChildByName("defeat").active=!val.victory
this.open()
}
victory_end(){
this.hide()
oops.message.dispatchEvent(GameEvent.MissionEnd)
oops.gui.removeByNode(this.node)
}
restart(){
this.hide()
oops.message.dispatchEvent(GameEvent.MissionStart)
oops.gui.removeByNode(this.node)
}
open(){
this.show()
}
show(){
this.node.setPosition(v3(0,640,0))
}
hide(){
this.node.setPosition(v3(-1500,640,0))
}
do_x10(){
this.clear_x1()
}
do_x1(){
this.clear_x1()
}
clear_x1(){
this.victory_end()
}
item_show(e:any,val:any){
console.log("item_show",val)
}
protected onDestroy(): void {
console.log("释放胜利界面");
}