添加了 英雄专门处理 装备加成的文件,接下来 去掉原先的光环类文件 FightCon

This commit is contained in:
2025-07-22 16:16:36 +08:00
parent 508c3b570a
commit e45ebd524b
24 changed files with 557 additions and 2108 deletions

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 95 "__id__": 95
},
{
"__id__": 97
} }
], ],
"_prefab": { "_prefab": {
"__id__": 97 "__id__": 99
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1498,6 +1501,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "12/JRUQxNOb4XyRugfdK75" "fileId": "12/JRUQxNOb4XyRugfdK75"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 98
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0eI7xnuipJJJ8/kJ+t51l4"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 95 "__id__": 95
},
{
"__id__": 97
} }
], ],
"_prefab": { "_prefab": {
"__id__": 97 "__id__": 99
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1498,6 +1501,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "a2jPQ8TNhPj67IyZiPimbD" "fileId": "a2jPQ8TNhPj67IyZiPimbD"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 98
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a0ZuO8pcZBVLCGR/YlgT1g"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 95 "__id__": 95
},
{
"__id__": 97
} }
], ],
"_prefab": { "_prefab": {
"__id__": 97 "__id__": 99
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1498,6 +1501,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "bcLqUE0OFGNrOQ237vM07E" "fileId": "bcLqUE0OFGNrOQ237vM07E"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 98
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "67tfoudqpBOa0qtG74B8C1"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 96 "__id__": 96
},
{
"__id__": 98
} }
], ],
"_prefab": { "_prefab": {
"__id__": 98 "__id__": 100
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1511,6 +1514,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "73tF4dlnxPwrg/FRKx1Opn" "fileId": "73tF4dlnxPwrg/FRKx1Opn"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 99
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e04gcKnRVFqIEPoK8xjNF5"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 96 "__id__": 96
},
{
"__id__": 98
} }
], ],
"_prefab": { "_prefab": {
"__id__": 98 "__id__": 100
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1511,6 +1514,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "01hrg2GRpPOIe0UPL1K3+9" "fileId": "01hrg2GRpPOIe0UPL1K3+9"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 99
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "49gQPhPXRGGIE6FPJixjy0"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -65,10 +65,13 @@
}, },
{ {
"__id__": 87 "__id__": 87
},
{
"__id__": 89
} }
], ],
"_prefab": { "_prefab": {
"__id__": 89 "__id__": 91
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1383,6 +1386,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "4cocBoZPBGhph8DyWbZwSS" "fileId": "4cocBoZPBGhph8DyWbZwSS"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 90
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "08J9V80+JMALiSGlvM4eOE"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 95 "__id__": 95
},
{
"__id__": 97
} }
], ],
"_prefab": { "_prefab": {
"__id__": 97 "__id__": 99
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1498,6 +1501,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "22rQh8lkpINoemMMMjGXPA" "fileId": "22rQh8lkpINoemMMMjGXPA"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 98
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "d7mGZQWT5Ke7Pn6FHiBfvi"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 95 "__id__": 95
},
{
"__id__": 97
} }
], ],
"_prefab": { "_prefab": {
"__id__": 97 "__id__": 99
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1498,6 +1501,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "22rQh8lkpINoemMMMjGXPA" "fileId": "22rQh8lkpINoemMMMjGXPA"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 98
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5bxB76k5BGoLoztZDZc06R"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 95 "__id__": 95
},
{
"__id__": 97
} }
], ],
"_prefab": { "_prefab": {
"__id__": 97 "__id__": 99
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1498,6 +1501,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "22rQh8lkpINoemMMMjGXPA" "fileId": "22rQh8lkpINoemMMMjGXPA"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 98
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "dflWZRVv9BhIkcpqreLeRl"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 98 "__id__": 98
},
{
"__id__": 100
} }
], ],
"_prefab": { "_prefab": {
"__id__": 100 "__id__": 102
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1530,6 +1533,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "f2f7ZpftZN5ats6jdhFfCm" "fileId": "f2f7ZpftZN5ats6jdhFfCm"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 101
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f2GtSvgCtHAYJc+VDNYBt4"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 98 "__id__": 98
},
{
"__id__": 100
} }
], ],
"_prefab": { "_prefab": {
"__id__": 100 "__id__": 102
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1530,6 +1533,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "24NMIe4OBIpbwx1nh6NYWa" "fileId": "24NMIe4OBIpbwx1nh6NYWa"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 101
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c0QpxHu2ZIF4SuX4gcAwdM"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -68,10 +68,13 @@
}, },
{ {
"__id__": 98 "__id__": 98
},
{
"__id__": 100
} }
], ],
"_prefab": { "_prefab": {
"__id__": 100 "__id__": 102
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1530,6 +1533,24 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "beDt1ByHNB564mmZr4kD3H" "fileId": "beDt1ByHNB564mmZr4kD3H"
}, },
{
"__type__": "846e0MH5V5Lw6nbs4fImtZx",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 101
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "92KbMRroFOB79gD+ep0wHK"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@@ -4,7 +4,7 @@
import { getHeroList, HeroList } from "./heroSet" import { getHeroList, HeroList } from "./heroSet"
import { getSkills, HeroSkillList, SkillSet } from "./SkillSet" import { getSkills, HeroSkillList, SkillSet } from "./SkillSet"
import { equip_list, weapons, armors, accessorys, getEquipUUIDsByTypeAndLevel } from "./Equips" import { equip_list, weapons, armors, accessorys, getEquipUUIDsByType } from "./Equips"
import { getEnhancement } from "./LevelUp" import { getEnhancement } from "./LevelUp"
//1:伙伴 2:技能 3:装备的出现概率配置 //1:伙伴 2:技能 3:装备的出现概率配置
@@ -116,7 +116,7 @@ export function getRandomCardsByType(
break; break;
case cardType.EQUIP: case cardType.EQUIP:
// 根据装备子类型筛选 // 根据装备子类型筛选
cardList=getEquipUUIDsByTypeAndLevel(data,level) //装备时 data是装备子类型 1:武器 2:防具 3:饰品 0或undefined:全部 cardList=getEquipUUIDsByType(data) //装备时 data是装备子类型 1:武器 2:防具 3:饰品 0或undefined:全部
break; break;
case cardType.SPECIAL: case cardType.SPECIAL:
cardList = SuperCardsList; cardList = SuperCardsList;

File diff suppressed because it is too large Load Diff

View File

@@ -54,8 +54,7 @@ export enum GameEvent {
UpdateHP = "UpdateHP", UpdateHP = "UpdateHP",
APChange = "APChange", APChange = "APChange",
EXPUP = "EXPUP", EXPUP = "EXPUP",
EQUIP_STONE_UP = "EQUIP_STONE_UP",
SKILL_STONE_UP = "SKILL_STONE_UP",
ShopOpen = "ShopOpen", ShopOpen = "ShopOpen",
RestOpen = "RestOpen", RestOpen = "RestOpen",
HeroLvUp = "HeroLvUp", HeroLvUp = "HeroLvUp",

View File

@@ -60,6 +60,10 @@ export enum FightSet {
ORANGE_GOLD=4,//橙色金币 ORANGE_GOLD=4,//橙色金币
BURN_COUNT=5,//默认易伤次数 BURN_COUNT=5,//默认易伤次数
STUN_TIME=0.5,//默认晕时间 STUN_TIME=0.5,//默认晕时间
WEAPON_LV=2,//武器等级
SHIELD_LV=3,//护盾等级
ARMOR_LV=4,//防具等级
ACCESSORY_LV=5,//饰品等级
// ATK_TO_ATK_RATIO=0.1, // ATK_TO_ATK_RATIO=0.1,
// ATK_TO_HP_RATIO=0.2, // ATK_TO_HP_RATIO=0.2,
// ATK_TO_SHIELD_RATIO=2, // ATK_TO_SHIELD_RATIO=2,

View File

@@ -91,10 +91,11 @@ export enum DebuffAttr {
//buff类型 //buff类型
export enum BuffAttr { export enum BuffAttr {
ATK = 1, // 攻击力 AP = 0, //攻击力 数值
ATK = 1, // 攻击力百分比
WFUNY = 2, // 风怒 WFUNY = 2, // 风怒
ATK_CD = 3, // 攻击速度 ATK_CD = 3, // 攻击速度
HP = 4, // 生命值 HP = 4, // 生命值比例
DEF = 5, // 免伤 DEF = 5, // 免伤
SKILL_DMG = 6, // 技能效果 SKILL_DMG = 6, // 技能效果
SKILL_CD = 7, // 技能冷却缩减 SKILL_CD = 7, // 技能冷却缩减
@@ -119,6 +120,7 @@ export enum BuffAttr {
STUN_TIME = 25, //击晕额外时间 STUN_TIME = 25, //击晕额外时间
STUN_RATTO = 26, //击晕概率 STUN_RATTO = 26, //击晕概率
FROST_TIME = 27, //冰冻时间 FROST_TIME = 27, //冰冻时间
HP_MAX = 28, //最大生命值数值
} }
export const geDebuffNum=()=>{ export const geDebuffNum=()=>{
@@ -140,10 +142,11 @@ export const geDebuffNum=()=>{
export const getBuffNum=()=>{ export const getBuffNum=()=>{
return { return {
AP:0, //攻击力 数值
ATK:0, // 攻击力 ATK:0, // 攻击力
WFUNY:0, // 风怒概率 WFUNY:0, // 风怒概率
ATK_CD:0, // 攻击速度 ATK_CD:0, // 攻击速度
HP:0, // 生命值 HP:0, // 生命值 比例
DEF:0, // 免伤 DEF:0, // 免伤
SKILL_DMG:0, // 技能效果 SKILL_DMG:0, // 技能效果
SKILL_CD:0, // 技能冷却缩减 SKILL_CD:0, // 技能冷却缩减
@@ -168,6 +171,7 @@ export const getBuffNum=()=>{
STUN_TIME:0, STUN_TIME:0,
STUN_RATTO:0, STUN_RATTO:0,
FROST_TIME:0, FROST_TIME:0,
HP_MAX:0,//最大生命值数值
} }
} }

View File

@@ -0,0 +1,82 @@
import { _decorator } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { oops } from "db://oops-framework/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { EquipAttrTarget, EquipInfo } from "../common/config/Equips";
import { HeroViewComp } from "./HeroViewComp";
import { BuffAttr } from "../common/config/SkillSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('HeroConCompComp')
@ecs.register('HeroConComp', false)
export class HeroConCompComp extends CCComp {
/** 视图层逻辑代码分离演示 */
heroView:HeroViewComp=null
protected onLoad(): void {
oops.message.on(GameEvent.EquipAdd,this.equip_add,this)
oops.message.on(GameEvent.EquipChange,this.equip_change,this)
oops.message.on(GameEvent.FightReady,this.fight_ready,this)
oops.message.on(GameEvent.UseSpecialCard,this.use_special_card,this)
}
start() {
this.heroView=this.node.getComponent(HeroViewComp)
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
equip_add(e:GameEvent,data:any){
console.log("[HeroConCompComp]:equip_add",data)
let equip=EquipInfo[data.uuid]
let buffs=equip.buff
let special_attr=equip.special_attr
for(let i=0;i<buffs.length;i++){
let buff=buffs[i]
if(buff.target==EquipAttrTarget.HERO){
switch(buff.type){
case BuffAttr.AP:
this.heroView.add_ap(buff.value,true)
break
case BuffAttr.ATK:
this.heroView.add_ap(buff.value,false)
break
case BuffAttr.ATK_CD:
this.heroView.add_speed(buff.value)
break
case BuffAttr.DEF:
this.heroView.add_def(buff.value)
break
case BuffAttr.HP:
this.heroView.add_hp_max(buff.value,false)
break
case BuffAttr.HP_MAX:
this.heroView.add_hp_max(buff.value,true)
break
}
}
}
}
equip_change(e:GameEvent,data:any){
console.log("[HeroConCompComp]:equip_change",data)
}
fight_ready(e:GameEvent,data:any){
console.log("[HeroConCompComp]:fight_ready",data)
}
use_special_card(e:GameEvent,data:any){
console.log("[HeroConCompComp]:use_special_card",data)
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "846e0307-e55e-4bc3-a9db-b387c89ad671",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -53,10 +53,12 @@ export class HeroViewComp extends CCComp {
hp: number = 100; /** 血量 */ hp: number = 100; /** 血量 */
hp_max: number = 100; /** 最大血量 */ hp_max: number = 100; /** 最大血量 */
buff_hp:number=0; buff_hp:number=0;
hp_base:number=0;
pwt:Timer = new Timer(1); //计时器 pwt:Timer = new Timer(1); //计时器
ap: number = 10; /**攻击力 */ ap: number = 10; /**攻击力 */
buff_ap:number=0; buff_ap:number=0;
ap_base:number=0;
// atk_speed: number = 1; // atk_speed: number = 1;
cd: number = 1.3; /**攻击速度 攻击间隔 */ cd: number = 1.3; /**攻击速度 攻击间隔 */
dis: number = 80; dis: number = 80;
@@ -118,7 +120,6 @@ export class HeroViewComp extends CCComp {
this.FIGHTCON=this.node.parent.getComponent(FightConComp); this.FIGHTCON=this.node.parent.getComponent(FightConComp);
//console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON) //console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_atk,this) this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_atk,this)
this.on(GameEvent.UpdateHP,this.update_hp,this)
this.on(GameEvent.EXPUP,this.exp_up,this) this.on(GameEvent.EXPUP,this.exp_up,this)
this.on(GameEvent.UseEnhancement,this.use_enhancement,this) this.on(GameEvent.UseEnhancement,this.use_enhancement,this)
const collider = this.node.getComponent(BoxCollider2D); const collider = this.node.getComponent(BoxCollider2D);
@@ -218,11 +219,14 @@ export class HeroViewComp extends CCComp {
add_ap(ap: number,is_num:boolean=true){ add_ap(ap: number,is_num:boolean=true){
//console.log("[HeroViewComp]:add_ap add:",ap,this.ap) //console.log("[HeroViewComp]:add_ap add:",ap,this.ap)
if(is_num){ if(is_num){
this.ap += Math.floor(ap); this.ap_base += Math.floor(ap);
}else{ }else{
this.ap += Math.floor(ap/100*this.ap); this.buff_ap += Math.floor(ap/100*this.ap);
} }
this.BUFFCOMP.tooltip(TooltipTypes.apup,ap.toFixed(0)); let diff=Math.floor(this.ap_base*(100+this.buff_ap)/100)-this.ap
this.ap = Math.floor(this.ap_base*(100+this.buff_ap)/100)
this.BUFFCOMP.tooltip(TooltipTypes.apup,diff.toFixed(0));
if(this.is_master) { if(this.is_master) {
this.BUFFCOMP.vmdata_update(); this.BUFFCOMP.vmdata_update();
@@ -233,35 +237,37 @@ export class HeroViewComp extends CCComp {
de_ap(ap: number,is_num:boolean=true){ de_ap(ap: number,is_num:boolean=true){
//console.log("[HeroViewComp]:de_ap de:",ap,this.ap) //console.log("[HeroViewComp]:de_ap de:",ap,this.ap)
if(is_num){ if(is_num){
this.ap -= Math.floor(ap); this.ap_base -= Math.floor(ap);
}else{ }else{
this.ap -= Math.floor(ap/100*this.ap); this.buff_ap -= Math.floor(ap/100*this.ap);
} }
let diff=Math.floor(this.ap_base*(100+this.buff_ap)/100)-this.ap
this.ap = Math.floor(this.ap_base*(100+this.buff_ap)/100)
this.BUFFCOMP.tooltip(TooltipTypes.apup,diff.toFixed(0));
if(this.is_master) this.BUFFCOMP.vmdata_update() if(this.is_master) this.BUFFCOMP.vmdata_update()
} }
update_hp(e:GameEvent,data:any){
//console.log("[HeroViewComp]:update_hp",data)
if(this.is_master===data.is_master&&this.fac===FacSet.HERO){
this.buff_hp += data.hp
if(data.hp > 0){
this.hp += this.hp_max*data.hp/100
if(this.hp > this.hp_max*(100+this.buff_hp)/100){
this.hp=this.hp_max*(100+this.buff_hp)/100
}
}
}
}
add_hp_max(hp: number=0,is_num:boolean=true){
this.hp_max += Math.floor(hp) ;
this.hp += Math.floor(hp*(100+this.buff_hp)/100) ;
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
this.BUFFCOMP.tooltip(TooltipTypes.hpup,hp.toFixed(0));
add_hp_max(hp: number=0,is_num:boolean=false){
if(is_num){
this.hp_base += Math.floor(hp) ;
}else{
this.buff_hp+=hp
}
let diff=Math.floor(this.hp_base*(100+this.buff_hp)/100)-this.hp_max
this.hp_max =Math.floor(this.hp_base*(100+this.buff_hp)/100)
this.hp+=diff
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
this.BUFFCOMP.tooltip(TooltipTypes.hpup,diff.toFixed(0));
} }
de_hp_max(hp: number=0,is_num:boolean=true){ //最大值 只存在数值添加, 比例通过buff_hp处理 de_hp_max(hp: number=0,is_num:boolean=true){ //最大值 只存在数值添加, 比例通过buff_hp处理
//console.log("[HeroViewComp]:de_hp_max de:",hp,this.hp_max) //console.log("[HeroViewComp]:de_hp_max de:",hp,this.hp_max)
this.hp_max -= Math.floor(hp) ; this.hp_base -= Math.floor(hp) ;
let diff=Math.floor(this.hp_base*(100+this.buff_hp)/100)-this.hp_max
this.hp_max =Math.floor(this.hp_base*(100+this.buff_hp)/100)
this.hp+=diff
if(this.is_master) this.BUFFCOMP.vmdata_update(true) if(this.is_master) this.BUFFCOMP.vmdata_update(true)
} }
@@ -332,13 +338,8 @@ export class HeroViewComp extends CCComp {
if(this.fac==FacSet.MON){ if(this.fac==FacSet.MON){
let exp=getExpDrops(HeroInfo[this.hero_uuid].quality,this.lv) let exp=getExpDrops(HeroInfo[this.hero_uuid].quality,this.lv)
let stone=getStoneDrops(HeroInfo[this.hero_uuid].quality,this.lv)
oops.message.dispatchEvent(GameEvent.EXPUP,{exp:exp}) oops.message.dispatchEvent(GameEvent.EXPUP,{exp:exp})
if(stone.type=="equip"){
oops.message.dispatchEvent(GameEvent.EQUIP_STONE_UP,stone.count)
}else{
oops.message.dispatchEvent(GameEvent.SKILL_STONE_UP,stone.count)
}
} }
if(this.fac==FacSet.HERO){ if(this.fac==FacSet.HERO){
@@ -659,12 +660,12 @@ export class HeroViewComp extends CCComp {
} }
to_update(){ to_update(){
if(!this.is_master) return if(!this.is_master) return
// oops.message.dispatchEvent(GameEvent.HeroLvUp,{lv:this.lv})
smc.vmdata.hero.exp = smc.vmdata.hero.exp-smc.vmdata.hero.next_exp smc.vmdata.hero.exp = smc.vmdata.hero.exp-smc.vmdata.hero.next_exp
smc.vmdata.hero.lv = smc.vmdata.hero.lv+1 smc.vmdata.hero.lv = smc.vmdata.hero.lv+1
smc.vmdata.hero.next_exp=getUpExp(smc.vmdata.hero.lv) smc.vmdata.hero.next_exp=getUpExp(smc.vmdata.hero.lv)
oops.message.dispatchEvent(GameEvent.HeroLvUp,{lv:smc.vmdata.hero.lv})
this.BUFFCOMP.lv_up() this.BUFFCOMP.lv_up()
this.BUFFCOMP.tooltip(TooltipTypes.lvup) this.BUFFCOMP.tooltip(TooltipTypes.lvup)
//@todo 需要添加 升级动画 //@todo 需要添加 升级动画

View File

@@ -226,23 +226,7 @@ export class CardComp extends CCComp {
console.log("[cardcomp]:装备卡 饰品") console.log("[cardcomp]:装备卡 饰品")
break break
} }
switch(EquipInfo[this.c_uuid].lv){
case 1:
show.getChildByName("mask").getChildByName("lv1").active=true
break
case 2:
show.getChildByName("mask").getChildByName("lv2").active=true
break
case 3:
show.getChildByName("mask").getChildByName("lv3").active=true
break
case 4:
show.getChildByName("mask").getChildByName("lv4").active=true
break
case 5:
show.getChildByName("mask").getChildByName("lv5").active=true
break
}
show.getChildByName("type").getChildByName("name").getComponent(Label).string="装备" show.getChildByName("type").getChildByName("name").getComponent(Label).string="装备"
break break
case cardType.SPECIAL: case cardType.SPECIAL:

View File

@@ -24,7 +24,6 @@ export class EquipSkillComp extends CCComp {
onLoad() { onLoad() {
this.on(GameEvent.UseSkillCard, this.get_skill, this); this.on(GameEvent.UseSkillCard, this.get_skill, this);
this.on(GameEvent.FightReady,this.fight_ready,this) this.on(GameEvent.FightReady,this.fight_ready,this)
this.on(GameEvent.SKILL_STONE_UP,this.skill_stone_up,this)
this.boxs=this.node.getChildByName("boxs") this.boxs=this.node.getChildByName("boxs")
this.skill1_cd_bar_progress=this.boxs.getChildByName("skill1").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar) 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.skill2_cd_bar_progress=this.boxs.getChildByName("skill2").getChildByName("icon").getChildByName("cd").getComponent(ProgressBar)

View File

@@ -24,69 +24,36 @@ export class EquipsComp extends Component {
oops.message.on(GameEvent.EquipAdd,this.equip_add,this) oops.message.on(GameEvent.EquipAdd,this.equip_add,this)
oops.message.on(GameEvent.EquipRemove,this.equip_remove,this) oops.message.on(GameEvent.EquipRemove,this.equip_remove,this)
this.boxs=this.node.getChildByName("boxs") this.boxs=this.node.getChildByName("boxs")
oops.message.on(GameEvent.EQUIP_STONE_UP,this.equip_stone_up,this) oops.message.on(GameEvent.HeroLvUp,this.hero_lv_up,this)
} }
hero_lv_up(e:GameEvent,data:any){
switch(data.lv){
case FightSet.WEAPON_LV:
this.show_equip_get("weapon")
break
case FightSet.ARMOR_LV:
this.show_equip_get("armor")
break
case FightSet.SHIELD_LV:
this.show_equip_get("shield")
break
case FightSet.ACCESSORY_LV:
this.show_equip_get("accessory")
break
}
}
equip_stone_up(e:GameEvent,data:any){ equip_stone_up(e:GameEvent,data:any){
console.log("[EquipsComp]:equip_stone_up",data)
smc.vmdata.mission_data.equip_stone+=data
if(smc.vmdata.mission_data.equip_stone >= smc.vmdata.mission_data.equip_stone_max){
this.show_equip_get("weapon")
this.show_equip_get("armor")
this.show_equip_get("accessory")
}
} }
call_equip_card(e:any,data:any){ call_equip_card(e:any,data:any){
let mission_data=smc.vmdata.mission_data oops.message.dispatchEvent(GameEvent.EquipSelect,{slot:data})
if(mission_data.equip_stone < mission_data.equip_stone_max){
oops.gui.toast("装备石不足", false);
return
}
let lv=this.check_lv(data)
oops.message.dispatchEvent(GameEvent.EquipSelect,{slot:data,lv:lv})
mission_data.equip_stone-=mission_data.equip_stone_max
mission_data.equip_stone_max=mission_data.equip_stone_max*2
} }
up_equip_card(e:any,data:any){ up_equip_card(e:any,data:any){
let mission_data=smc.vmdata.mission_data oops.message.dispatchEvent(GameEvent.EquipSelect,{slot:data})
if(mission_data.equip_stone < mission_data.equip_stone_max){
oops.gui.toast("装备石不足", false);
return
}
let lv=this.check_lv(data)
oops.message.dispatchEvent(GameEvent.EquipSelect,{slot:data,lv:lv})
mission_data.equip_stone-=mission_data.equip_stone_max
mission_data.equip_stone_max=mission_data.equip_stone_max*2
}
check_lv(data:any){
let lv=0
switch(data){
case "weapon":
if(this.weapon.uuid==0) return 1
lv=EquipInfo[this.weapon.uuid].lv+1
if(lv>5){
lv=5
}
break
case "armor":
if(this.armor.uuid==0) return 1
lv=EquipInfo[this.armor.uuid].lv+1
if(lv>5){
lv=5
}
break
case "accessory":
if(this.accessory.uuid==0) return 4
lv=EquipInfo[this.accessory.uuid].lv+1
if(lv>5){
lv=5
}
break
}
return lv
} }
start(){ start(){
this.fight_ready() this.fight_ready()
@@ -141,7 +108,7 @@ export class EquipsComp extends Component {
this.accessory.level=data.level this.accessory.level=data.level
this.show_accessory(data.uuid) this.show_accessory(data.uuid)
} }
this.count_attrs() // this.count_attrs()
} }
show_weapon(uuid:number){ show_weapon(uuid:number){
let icon = this.boxs.getChildByName("weapon").getChildByName("icon") let icon = this.boxs.getChildByName("weapon").getChildByName("icon")
@@ -151,11 +118,6 @@ export class EquipsComp extends Component {
const sprite = icon.getChildByName("icon").getComponent(Sprite); const sprite = icon.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path); sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
}); });
icon.getChildByName("lv1").active=EquipInfo[uuid].lv==1
icon.getChildByName("lv2").active=EquipInfo[uuid].lv==2
icon.getChildByName("lv3").active=EquipInfo[uuid].lv==3
icon.getChildByName("lv4").active=EquipInfo[uuid].lv==4
icon.getChildByName("lv5").active=EquipInfo[uuid].lv==5
icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE
icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN
icon.getChildByName("q3").active=EquipInfo[uuid].quality==Quality.BLUE icon.getChildByName("q3").active=EquipInfo[uuid].quality==Quality.BLUE
@@ -171,11 +133,7 @@ export class EquipsComp extends Component {
const sprite = icon.getChildByName("icon").getComponent(Sprite); const sprite = icon.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path); sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
}); });
icon.getChildByName("lv1").active=EquipInfo[uuid].lv==1
icon.getChildByName("lv2").active=EquipInfo[uuid].lv==2
icon.getChildByName("lv3").active=EquipInfo[uuid].lv==3
icon.getChildByName("lv4").active=EquipInfo[uuid].lv==4
icon.getChildByName("lv5").active=EquipInfo[uuid].lv==5
icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE
icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN
@@ -191,11 +149,7 @@ export class EquipsComp extends Component {
const sprite = icon.getChildByName("icon").getComponent(Sprite); const sprite = icon.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path); sprite.spriteFrame = atlas.getSpriteFrame(EquipInfo[uuid].path);
}); });
icon.getChildByName("lv1").active=EquipInfo[uuid].lv==1
icon.getChildByName("lv2").active=EquipInfo[uuid].lv==2
icon.getChildByName("lv3").active=EquipInfo[uuid].lv==3
icon.getChildByName("lv4").active=EquipInfo[uuid].lv==4
icon.getChildByName("lv5").active=EquipInfo[uuid].lv==5
icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE icon.getChildByName("q1").active=EquipInfo[uuid].quality==Quality.WHITE
icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN icon.getChildByName("q2").active=EquipInfo[uuid].quality==Quality.GREEN
@@ -309,41 +263,25 @@ export class EquipsComp extends Component {
} }
private show_equip_get(e:string){ private show_equip_get(e:string){
if(this.weapon.uuid==0){ switch(e){
this.boxs.getChildByName("weapon").getChildByName("get").active =true case "weapon":
this.boxs.getChildByName("weapon").getChildByName("light").active=true this.boxs.getChildByName("weapon").getChildByName("get").active =true
this.boxs.getChildByName("weapon").getChildByName("tip").active=true this.boxs.getChildByName("weapon").getChildByName("light").active=true
this.boxs.getChildByName("weapon").getChildByName("tip").getComponent(Label).string="购买" this.boxs.getChildByName("weapon").getChildByName("tip").active=true
}else{ this.boxs.getChildByName("weapon").getChildByName("tip").getComponent(Label).string="获取"
if(EquipInfo[this.weapon.uuid].lv>=5) return break
this.boxs.getChildByName("weapon").getChildByName("change").active =true case "armor":
this.boxs.getChildByName("weapon").getChildByName("light").active=true this.boxs.getChildByName("armor").getChildByName("get").active =true
this.boxs.getChildByName("weapon").getChildByName("tip").active=true this.boxs.getChildByName("armor").getChildByName("light").active=true
this.boxs.getChildByName("weapon").getChildByName("tip").getComponent(Label).string="升级" this.boxs.getChildByName("armor").getChildByName("tip").active=true
} this.boxs.getChildByName("armor").getChildByName("tip").getComponent(Label).string="获取"
if(this.armor.uuid==0){ break
this.boxs.getChildByName("armor").getChildByName("get").active =true case "accessory":
this.boxs.getChildByName("armor").getChildByName("light").active=true this.boxs.getChildByName("accessory").getChildByName("get").active =true
this.boxs.getChildByName("armor").getChildByName("tip").active=true this.boxs.getChildByName("accessory").getChildByName("light").active=true
this.boxs.getChildByName("armor").getChildByName("tip").getComponent(Label).string="购买" this.boxs.getChildByName("accessory").getChildByName("tip").active=true
}else{ this.boxs.getChildByName("accessory").getChildByName("tip").getComponent(Label).string="获取"
if(EquipInfo[this.armor.uuid].lv>=5) return break
this.boxs.getChildByName("armor").getChildByName("change").active =true
this.boxs.getChildByName("armor").getChildByName("light").active=true
this.boxs.getChildByName("armor").getChildByName("tip").active=true
this.boxs.getChildByName("armor").getChildByName("tip").getComponent(Label).string="升级"
}
if(this.accessory.uuid==0 ){
this.boxs.getChildByName("accessory").getChildByName("get").active =true
this.boxs.getChildByName("accessory").getChildByName("light").active=true
this.boxs.getChildByName("accessory").getChildByName("tip").active=true
this.boxs.getChildByName("accessory").getChildByName("tip").getComponent(Label).string="购买"
}else{
if(EquipInfo[this.accessory.uuid].lv>=5) return
this.boxs.getChildByName("accessory").getChildByName("change").active =true
this.boxs.getChildByName("accessory").getChildByName("light").active=true
this.boxs.getChildByName("accessory").getChildByName("tip").active=true
this.boxs.getChildByName("accessory").getChildByName("tip").getComponent(Label).string="升级"
} }
} }

View File

@@ -65,22 +65,7 @@ export class FightConComp extends Component {
private equip_change(e:GameEvent,equip:any){ private equip_change(e:GameEvent,equip:any){
let old_hero_hp=JSON.parse(JSON.stringify(this.hero_buff.HP))
let new_hero_hp=JSON.parse(JSON.stringify(equip.hero_buff.HP))
this.hero_buff=equip.hero_buff
this.enemy_buff=equip.enemy_buff
let hero_hp_add=new_hero_hp-old_hero_hp
console.log("[FightConComp]:old_hero_hp:"+old_hero_hp+" new_hero_hp:"+new_hero_hp+" hero_hp_add:"+hero_hp_add)
if(hero_hp_add!==0){
oops.message.dispatchEvent(GameEvent.UpdateHP,{hp:hero_hp_add,is_master:true})
}
this.scheduleOnce(()=>{
oops.message.dispatchEvent(GameEvent.UpdateVMData)
},0.1)
} }
private fight_ready(e:GameEvent){ private fight_ready(e:GameEvent){