buff动画优化 + 添加闪避最大值限定值

This commit is contained in:
2025-01-13 10:19:26 +08:00
parent 82b68e4f87
commit 0f1c30e666
9 changed files with 7949 additions and 6510 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "52d47aaf-02c9-44df-ba95-52143ffebad4",
"files": [],
"subMetas": {},
"userData": {}
}

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": "f7765d3a-474b-4c84-bc8c-da3c281b8f7a",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "buffget"
}
}

View File

@@ -45,11 +45,12 @@ export enum GameSet {
ATK_TO_HP_RATIO=0.2, ATK_TO_HP_RATIO=0.2,
ATK_TO_SHIELD_RATIO=2, ATK_TO_SHIELD_RATIO=2,
ATK_LINES = 6, //英雄数 ATK_LINES = 3, //英雄数
MON_GOLD_ADD =2, MON_GOLD_ADD =2,
MON_COIN_ADD=2, MON_COIN_ADD=2,
COIN_ADD=1, COIN_ADD=1,
DEF_RATE=0.5, DEF_RATE=0.7,
DODGE_MAX=70,
HERO_NUM=3, HERO_NUM=3,
} }
export const ColorSet: { [key: string]: string } = { export const ColorSet: { [key: string]: string } = {

View File

@@ -5,6 +5,7 @@ import { ecs } from 'db://oops-framework/libs/ecs/ECS';
import { Tooltip } from '../skills/Tooltip'; import { Tooltip } from '../skills/Tooltip';
import { timedCom } from '../skills/timedCom'; import { timedCom } from '../skills/timedCom';
import { smc } from '../common/SingletonModuleComp'; import { smc } from '../common/SingletonModuleComp';
import { BuffGet } from '../skills/BuffGet';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('BuffComp') @ccclass('BuffComp')
@@ -33,7 +34,7 @@ export class BuffComp extends Component {
start() { start() {
this.heroView = this.node.getComponent(HeroViewComp); this.heroView = this.node.getComponent(HeroViewComp);
this.show_ap(10) this.buff_get("dodge")
// this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = false; // this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = false; // this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = false;
// this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = false; // this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = false;
@@ -64,119 +65,15 @@ export class BuffComp extends Component {
} }
} }
show_ap(t:number=2){
this.ap_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("ap")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_cd(t:number=2){
this.cd_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("cd").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("cd")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_def(t:number=2){
this.def_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("def").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("def")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_hp(t:number=2){
this.hp_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("hp").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("hp")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_crit(t:number=2){
this.crit_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("crit")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_debuff_ap(t:number=2){
this.deap_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("deap").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("deap")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_debuff_cd(t:number=2){
this.decd_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("decd").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("decd")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_debuff_def(t:number=2){
this.dedef_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("dedef").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("dedef")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_debuff_hp(t:number=2){
this.dehp_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("dehp").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("dehp")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
show_debuff_crit(t:number=2){
this.decrit_cd = t;
this.node.getChildByName("top").getChildByName("buff").getChildByName("decrit").active = true;
let node = this.node.getChildByName("top").getChildByName("buff").getChildByName("decrit")
this.scheduleOnce(()=>{
tween(node).to( 0.1,
{ position: new Vec3(node.position.x,node.position.y+50) },
{ onComplete:()=>{ node.position=v3(0,0);node.active = false; }, }
).start();
}, 1);
}
buff_get(name:string){
var path = "game/skills/buffget/buffget";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent = this.node.getChildByName("top").getChildByName("buff");
let comp=node.getComponent(BuffGet)
comp.init(name)
}
show_wind(t:number=1){ show_wind(t:number=1){
this.wind_cd = t; this.wind_cd = t;
this.node.getChildByName("wind").active = true; this.node.getChildByName("wind").active = true;

View File

@@ -326,7 +326,7 @@ export class HeroViewComp extends CCComp {
this.hp_less(l_hp,skill.is_crit); this.hp_less(l_hp,skill.is_crit);
} }
check_less(ap:number,is_crit:boolean,crit_add:number=0){ check_less(ap:number,is_crit:boolean,crit_add:number=0){
let d=this.def/ap let d=this.def_max/ap
if(d > 1) d = 1 if(d > 1) d = 1
let l_hp=ap*(1-d*GameSet.DEF_RATE) //防御最高减免伤害比率计算 let l_hp=ap*(1-d*GameSet.DEF_RATE) //防御最高减免伤害比率计算
if(is_crit){ if(is_crit){
@@ -420,6 +420,7 @@ export class HeroViewComp extends CCComp {
check_dodge():boolean check_dodge():boolean
{ {
let i = RandomManager.instance.getRandomInt(0,100,3) let i = RandomManager.instance.getRandomInt(0,100,3)
if(this.dodge_max > GameSet.DODGE_MAX) this.dodge_max = GameSet.DODGE_MAX
if(i < this.dodge_max){ if(i < this.dodge_max){
// console.log("闪避触发: i="+i+":dodge="+dodge); // console.log("闪避触发: i="+i+":dodge="+dodge);
this.BUFFCOMP.tooltip(5,"闪避"); this.BUFFCOMP.tooltip(5,"闪避");
@@ -732,18 +733,70 @@ export class HeroViewComp extends CCComp {
power_add(p:number){ power_add(p:number){
this.pw+= p this.pw+= p
} }
add_shield(shield:number){
this.shield =shield
console.log("shield:",shield);
}
// add_cd(cd: number){
// this.cd += this.cd*((100-cd)/100);
// this.BUFFCOMP.buff_get("cd")
// }
/** /**
* 增加英雄的攻击AP * 增加英雄的攻击AP
* @param ap 要增加的攻击。 * @param ap 要增加的攻击。
*/ */
add_ap(ap: number){ add_ap(ap: number){
this.ap += Math.floor(ap); this.ap += Math.floor(ap);
this.BUFFCOMP.buff_get("ap")
} }
add_shield(shield:number){ de_ap(ap: number){
this.shield =shield this.ap -= Math.floor(ap);
console.log("shield:",shield); this.BUFFCOMP.buff_get("deap")
} }
add_hp(hp: number=0){ add_def(def: number){
this.def += Math.floor(def);
this.BUFFCOMP.buff_get("def")
}
de_def(def: number){
this.def -= Math.floor(def);
this.BUFFCOMP.buff_get("dedef")
}
/**
* 增加英雄的暴击率。
* @param crit 要增加的暴击率。
*/
add_crit(critRate: number) {
this.crit += Math.floor(critRate);
this.BUFFCOMP.buff_get("crit");
}
de_crit(critRate: number) {
this.crit += Math.floor(critRate);
this.BUFFCOMP.buff_get("decrit");
}
/**
* 增加英雄的闪避率。
* @param dodge 要增加的闪避率。
*/
add_dodge(dodgeRate: number) {
this.dodge += Math.floor(dodgeRate);
this.BUFFCOMP.buff_get("dodge");
}
de_dodge(dodgeRate: number) {
this.dodge += Math.floor(dodgeRate);
this.BUFFCOMP.buff_get("dedodge");
}
add_hp_max(hprate: number=0){
this.BUFFCOMP.buff_get("hp")
this.hp_max += Math.floor(hprate/100*this.rhp_max) ;
this.add_hp2(hprate)
}
de_hp_max(hprate: number=0){
this.BUFFCOMP.buff_get("dehp")
this.hp_max -= Math.floor(hprate/100*this.rhp_max) ;
}
add_hp(hp: number = 0) {
this.BUFFCOMP.heathed(); this.BUFFCOMP.heathed();
this.hp+=Math.floor(hp); this.hp+=Math.floor(hp);
if(this.hp > this.rhp_max){ if(this.hp > this.rhp_max){
@@ -754,11 +807,6 @@ export class HeroViewComp extends CCComp {
add_hp2(hprate: number=0){ add_hp2(hprate: number=0){
this.hp += Math.floor(hprate/100*this.hp_max) ; this.hp += Math.floor(hprate/100*this.hp_max) ;
} }
add_hp_max(hprate: number=0){
this.BUFFCOMP.show_hp(0.5)
this.hp_max += Math.floor(hprate/100*this.rhp_max) ;
this.add_hp2(hprate)
}
hp_less(hp: number,is_crit:boolean=false){ hp_less(hp: number,is_crit:boolean=false){
if(this.is_dead) return if(this.is_dead) return

View File

@@ -0,0 +1,35 @@
import { _decorator, Component, Node, tween, v3, Vec3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('BuffGet')
export class BuffGet extends Component {
start() {
this.scheduleOnce(()=>{
tween(this.node).to( 0.1,
{ position: new Vec3(this.node.position.x,this.node.position.y+50) },
{
onComplete:()=>{ this.node.destroy() }
}
).start();
}, 1);
}
init(name:string){
this.node.getChildByName("ap").active=(name=="ap")
this.node.getChildByName("cd").active=(name=="cd")
this.node.getChildByName("def").active=(name=="def")
this.node.getChildByName("hp").active=(name=="hp")
this.node.getChildByName("crit").active=(name=="crit")
this.node.getChildByName("dodge").active=(name=="dodge")
this.node.getChildByName("deap").active=(name=="deap")
this.node.getChildByName("decd").active=(name=="decd")
this.node.getChildByName("dedef").active=(name=="dedef")
this.node.getChildByName("dehp").active=(name=="dehp")
this.node.getChildByName("decrit").active=(name=="decrit")
this.node.getChildByName("dedodge").active=(name=="dedodge")
}
update(deltaTime: number) {
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "28a19abf-3818-4e24-92af-0e3c0c05299b",
"files": [],
"subMetas": {},
"userData": {}
}