mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
基础的数值计算
This commit is contained in:
parent
6cd69ca9e3
commit
8dcf92a302
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -81,7 +81,7 @@
|
|||||||
"__id__": 1
|
"__id__": 1
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": false,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 3
|
"__id__": 3
|
||||||
|
@ -157,7 +157,10 @@
|
|||||||
"_iso": 0,
|
"_iso": 0,
|
||||||
"_screenScale": 1,
|
"_screenScale": 1,
|
||||||
"_visibility": 1073741825,
|
"_visibility": 1073741825,
|
||||||
"_targetTexture": null,
|
"_targetTexture": {
|
||||||
|
"__uuid__": "a0d1e275-5512-493e-8e15-7d2db8beb48e",
|
||||||
|
"__expectedType__": "cc.RenderTexture"
|
||||||
|
},
|
||||||
"_postProcess": null,
|
"_postProcess": null,
|
||||||
"_usePostProcess": false,
|
"_usePostProcess": false,
|
||||||
"_cameraType": -1,
|
"_cameraType": -1,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": 0,
|
"id": 0,
|
||||||
"Blood": 100,
|
"Blood": 200,
|
||||||
"Attack": 10,
|
"Attack": 20,
|
||||||
"Defend": 5
|
"Defend": 5
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -26,12 +26,12 @@ import { JAPI, JAPIConfig } from "../../extensions/ngame/assets/ngame/util/JAPI"
|
|||||||
import { AppData } from "./AppData";
|
import { AppData } from "./AppData";
|
||||||
import AppAction from "./AppAction";
|
import AppAction from "./AppAction";
|
||||||
|
|
||||||
// let APIPath = `http://localhost:8080`
|
let APIPath = `http://localhost:8080`
|
||||||
// let WsPath = `ws://localhost:8080/websocket`
|
let WsPath = `ws://localhost:8080/websocket`
|
||||||
// let APIPath = `http://192.168.1.23:8080`
|
// let APIPath = `http://192.168.1.23:8080`
|
||||||
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
||||||
let APIPath = `http://192.168.0.113:8080`
|
// let APIPath = `http://192.168.0.113:8080`
|
||||||
let WsPath = `ws://192.168.0.113:8080/websocket`
|
// let WsPath = `ws://192.168.0.113:8080/websocket`
|
||||||
// let APIPath = `https://api.pet.jisol.cn`
|
// let APIPath = `https://api.pet.jisol.cn`
|
||||||
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ export enum GTowards{
|
|||||||
export default class GObject<T> extends JNGSyncProtoBase<T>{
|
export default class GObject<T> extends JNGSyncProtoBase<T>{
|
||||||
|
|
||||||
//当前模式
|
//当前模式
|
||||||
_mode:GBaseMode<{}>;
|
_mode:GBaseMode<{},{}>;
|
||||||
|
|
||||||
//是否镜像
|
//是否镜像
|
||||||
_isMirror:boolean = false;
|
_isMirror:boolean = false;
|
||||||
@ -26,10 +26,10 @@ export default class GObject<T> extends JNGSyncProtoBase<T>{
|
|||||||
this._isMirror = value;
|
this._isMirror = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get mode():GBaseMode<{}>{
|
get mode():GBaseMode<{},{}>{
|
||||||
return this._mode;
|
return this._mode;
|
||||||
}
|
}
|
||||||
set mode(value:GBaseMode<{}>){
|
set mode(value:GBaseMode<{},{}>){
|
||||||
this._mode = value;
|
this._mode = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { TB } from "../../../../resources/config/data/schema";
|
import { TB } from "../../../../resources/config/data/schema";
|
||||||
|
import GRoleAttack from "../common/GRoleAttack";
|
||||||
import GRoleDefault from "../role/GRoleDefault";
|
import GRoleDefault from "../role/GRoleDefault";
|
||||||
|
import { GRoleAttackType } from "../values/GRoleValues";
|
||||||
import { GAttackBase } from "./GAttack";
|
import { GAttackBase } from "./GAttack";
|
||||||
|
|
||||||
|
|
||||||
@ -7,7 +9,7 @@ import { GAttackBase } from "./GAttack";
|
|||||||
export default class GAttackNormal implements GAttackBase{
|
export default class GAttackNormal implements GAttackBase{
|
||||||
|
|
||||||
attack(role: GRoleDefault, info: TB.TbGRoleAttack) {
|
attack(role: GRoleDefault, info: TB.TbGRoleAttack) {
|
||||||
role.fsm.enemy.onHit();
|
GRoleAttack.onNormalAttack(role,role.fsm.enemy); //普通攻击
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import GDetection from "../common/GDetection";
|
|||||||
import { rect } from "cc";
|
import { rect } from "cc";
|
||||||
import GRoleDefault from "../role/GRoleDefault";
|
import GRoleDefault from "../role/GRoleDefault";
|
||||||
import { TB } from "../../../../resources/config/data/schema";
|
import { TB } from "../../../../resources/config/data/schema";
|
||||||
|
import GRoleAttack from "../common/GRoleAttack";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 抛物线 爆炸普攻
|
* 抛物线 爆炸普攻
|
||||||
@ -76,12 +77,10 @@ export default class GAttackParabolicRemote implements GAttackBase{
|
|||||||
//销毁
|
//销毁
|
||||||
bullet.node.destroy();
|
bullet.node.destroy();
|
||||||
|
|
||||||
// enemy.getComponent(BoxCollider2D).apply();
|
GDetection.testAABBCenterRole(rect(effect.node.worldPosition.x,effect.node.worldPosition.y,aw,ah)).forEach(enemy =>{
|
||||||
|
GRoleAttack.onNormalAttack(role,enemy); //普通攻击
|
||||||
// console.log(enemy.v2World,enemy.getComponent(BoxCollider2D).worldPoints,enemy.getComponent(UITransform).getBoundingBoxToWorld());
|
|
||||||
GDetection.testAABBRole(rect(effect.node.worldPosition.x,effect.node.worldPosition.y,aw,ah)).forEach(role =>{
|
|
||||||
role.onHit();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@ import { Vec2 } from "cc";
|
|||||||
export default class GDetection{
|
export default class GDetection{
|
||||||
|
|
||||||
//检测角色
|
//检测角色
|
||||||
static testAABBRole(rect:math.Rect):GRoleBase<{}>[]{
|
static testAABBCenterRole(rect:math.Rect):GRoleBase<{}>[]{
|
||||||
|
rect.x -= rect.width / 2;
|
||||||
|
rect.y -= rect.height / 2;
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
return PhysicsSystem2D.instance.testAABB(rect).map(item => item.getComponent(GRoleBase<any>));
|
return PhysicsSystem2D.instance.testAABB(rect).map(item => item.getComponent(GRoleBase<any>));
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
import GRoleBase from "../role/GRoleBase";
|
||||||
|
import GRoleDefault from "../role/GRoleDefault";
|
||||||
|
import { GRoleAttackType } from "../values/GRoleValues";
|
||||||
|
|
||||||
|
//宠物攻击 工具类
|
||||||
|
export default class GRoleAttack{
|
||||||
|
|
||||||
|
//普通攻击
|
||||||
|
static onNormalAttack(attack:GRoleBase<{}>,hit:GRoleBase<{}>){
|
||||||
|
hit.onHit(GRoleAttackType.NormalAttack,attack.values.onAttack(GRoleAttackType.NormalAttack),attack);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.23",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "d4ea04bc-bcfc-45ce-9753-126ac88604d1",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -48,7 +48,7 @@ export default class GSpine{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 创建一个 Spine 并且 播放 销毁
|
// 创建一个 Spine 并且 播放 销毁
|
||||||
static onPlaySceneSpine(scene:GBaseMode<{}>,pos:Vec2,spine:sp.SkeletonData,play:string):JNSkeleton{
|
static onPlaySceneSpine(scene:GBaseMode<{},{}>,pos:Vec2,spine:sp.SkeletonData,play:string):JNSkeleton{
|
||||||
|
|
||||||
let create = this.onCreateSpine(spine);
|
let create = this.onCreateSpine(spine);
|
||||||
scene.addGNode(create.node,pos);
|
scene.addGNode(create.node,pos);
|
||||||
|
@ -8,6 +8,8 @@ import { GFSMAnimBase } from "../fsm/GFSMAnimBase";
|
|||||||
import GFSMBase from "../fsm/GFSMBase";
|
import GFSMBase from "../fsm/GFSMBase";
|
||||||
import { app } from "../../../App";
|
import { app } from "../../../App";
|
||||||
import { TB } from "../../../../resources/config/data/schema";
|
import { TB } from "../../../../resources/config/data/schema";
|
||||||
|
import GRoleValues, { GRoleAttackType } from "../values/GRoleValues";
|
||||||
|
import GAttributeBase from "../values/attribute/GAttributeBase";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
export enum GRoleAnimEvent{
|
export enum GRoleAnimEvent{
|
||||||
@ -19,8 +21,6 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
|||||||
|
|
||||||
@property(JNSkeleton)
|
@property(JNSkeleton)
|
||||||
spine:JNSkeleton;
|
spine:JNSkeleton;
|
||||||
// @property(sp.Skeleton)
|
|
||||||
// spine:sp.Skeleton;
|
|
||||||
|
|
||||||
//角色
|
//角色
|
||||||
role:TB.TbGRole;
|
role:TB.TbGRole;
|
||||||
@ -63,6 +63,9 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
|||||||
//添加攻击回调
|
//添加攻击回调
|
||||||
addAttackCallback(fun:Function){this.attackCallbacks.push(fun)};
|
addAttackCallback(fun:Function){this.attackCallbacks.push(fun)};
|
||||||
|
|
||||||
|
//角色数值类
|
||||||
|
values:GRoleValues;
|
||||||
|
|
||||||
get():this{
|
get():this{
|
||||||
if(this.isDie) return null;
|
if(this.isDie) return null;
|
||||||
return this;
|
return this;
|
||||||
@ -82,6 +85,9 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
|||||||
//创建角色动画状态机
|
//创建角色动画状态机
|
||||||
this.fsmAnim = this.fsmAnimCreate();
|
this.fsmAnim = this.fsmAnimCreate();
|
||||||
|
|
||||||
|
//创建数值类
|
||||||
|
this.values = new GRoleValues();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化
|
//初始化
|
||||||
@ -145,11 +151,12 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//受击
|
//受击 伤害类型 伤害
|
||||||
onHit(){
|
onHit(type:GRoleAttackType,harm:number,enemy:GRoleBase<{}>){
|
||||||
// return;
|
// return;
|
||||||
this.blood -= 10;
|
harm = this.values.onUnderAttack(type,harm)
|
||||||
this.hitCallbacks.forEach(fun => fun(this,10));
|
this.blood -= harm;
|
||||||
|
this.hitCallbacks.forEach(fun => fun(this,harm));
|
||||||
//检测是否死亡
|
//检测是否死亡
|
||||||
if(this.blood <= 0){
|
if(this.blood <= 0){
|
||||||
//关闭状态机
|
//关闭状态机
|
||||||
@ -170,6 +177,20 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//生效数值
|
||||||
|
onEffectiveValue(...values:GAttributeBase[]){
|
||||||
|
|
||||||
|
this.values.reset();
|
||||||
|
values.forEach(value => {
|
||||||
|
this.values.add(value);
|
||||||
|
})
|
||||||
|
this.values.update();
|
||||||
|
|
||||||
|
//赋值血量
|
||||||
|
this.blood = this.fullBlood = this.values.onBlood();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,7 @@ import { JEasing } from "../../../../../extensions/ngame/assets/ngame/sync/frame
|
|||||||
import { GAttack } from "../attack/GAttack";
|
import { GAttack } from "../attack/GAttack";
|
||||||
import { v2 } from "cc";
|
import { v2 } from "cc";
|
||||||
import { GTactical } from "../../entity/GTactical";
|
import { GTactical } from "../../entity/GTactical";
|
||||||
import { Vec2 } from "cc";
|
|
||||||
import { GSkill, GSkillBase, GSkillState } from "../../skill/GSkill";
|
import { GSkill, GSkillBase, GSkillState } from "../../skill/GSkill";
|
||||||
import JNFrameTime from "../../../../../extensions/ngame/assets/ngame/sync/frame/game/time/JNFrameTime";
|
|
||||||
import { TB } from "../../../../resources/config/data/schema";
|
import { TB } from "../../../../resources/config/data/schema";
|
||||||
import { TD } from "../../../App";
|
import { TD } from "../../../App";
|
||||||
const { property,ccclass } = _decorator;
|
const { property,ccclass } = _decorator;
|
||||||
|
9
JisolGameCocos/assets/script/battle/base/values.meta
Normal file
9
JisolGameCocos/assets/script/battle/base/values.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.2.0",
|
||||||
|
"importer": "directory",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "84ccbb8f-b24a-4d98-91c1-dcd3f0201edb",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -0,0 +1,94 @@
|
|||||||
|
import GAttribute, { GAttributeType } from "./attribute/GAttribute";
|
||||||
|
import GAttributeBase from "./attribute/GAttributeBase";
|
||||||
|
|
||||||
|
//宠物攻击类
|
||||||
|
export enum GRoleAttackType{
|
||||||
|
NormalAttack,
|
||||||
|
}
|
||||||
|
|
||||||
|
//宠物数值 核心类
|
||||||
|
export default class GRoleValues {
|
||||||
|
|
||||||
|
//宠物属性
|
||||||
|
attribute:GAttribute;
|
||||||
|
|
||||||
|
get attributes(){
|
||||||
|
return this.attribute.info;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(){
|
||||||
|
|
||||||
|
//初始化属性
|
||||||
|
this.attribute = new GAttribute();
|
||||||
|
this.update();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//重置
|
||||||
|
reset(){
|
||||||
|
//初始化属性
|
||||||
|
this.attribute = new GAttribute();
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加属性类
|
||||||
|
add(info:GAttributeBase){
|
||||||
|
this.attribute.add(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
//刷新属性
|
||||||
|
update(){
|
||||||
|
//刷新属性
|
||||||
|
this.attribute.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
//普通攻击
|
||||||
|
onNormalAttack(){
|
||||||
|
|
||||||
|
//普通攻击伤害 = 攻击
|
||||||
|
return this.attributes[GAttributeType.Attack];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//受到普通攻击
|
||||||
|
onUnderNormalAttack(under:number){
|
||||||
|
|
||||||
|
//受到普通攻击伤害 = 受到伤害 - 防御
|
||||||
|
return Math.max(0,under - this.attributes[GAttributeType.Defend]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//受到攻击 统一方法
|
||||||
|
onUnderAttack(type:GRoleAttackType,under:number){
|
||||||
|
if(type == GRoleAttackType.NormalAttack){
|
||||||
|
//受到普通攻击
|
||||||
|
return this.onUnderNormalAttack(under);
|
||||||
|
}
|
||||||
|
return under;
|
||||||
|
}
|
||||||
|
|
||||||
|
//攻击 统一方法
|
||||||
|
onAttack(type:GRoleAttackType){
|
||||||
|
if(type == GRoleAttackType.NormalAttack){
|
||||||
|
//普通攻击
|
||||||
|
return this.onNormalAttack();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//普通攻击某个目标
|
||||||
|
onNormalAttackTarget(values:GRoleValues){
|
||||||
|
return values.onUnderNormalAttack(this.onNormalAttack());
|
||||||
|
}
|
||||||
|
|
||||||
|
//血量
|
||||||
|
onBlood(){
|
||||||
|
|
||||||
|
//总血量 = 血量
|
||||||
|
return this.attributes[GAttributeType.Blood];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.23",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "52b4e441-2a5c-4d33-8d4e-2b96df25afc2",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.2.0",
|
||||||
|
"importer": "directory",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "e3df25b3-9781-42c1-9b3d-a74be923c931",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
import { TD } from "../../../../App";
|
||||||
|
import GAttributeBase from "./GAttributeBase";
|
||||||
|
|
||||||
|
//属性类型
|
||||||
|
export enum GAttributeType{
|
||||||
|
Attack = 110001, //攻击
|
||||||
|
Defend = 110002, //防御
|
||||||
|
Blood = 110003, //血量
|
||||||
|
}
|
||||||
|
|
||||||
|
//属性类
|
||||||
|
export default class GAttribute {
|
||||||
|
|
||||||
|
attributes:GAttributeBase[] = [];
|
||||||
|
|
||||||
|
//属性最终信息 {属性Id:属性值}
|
||||||
|
info:{[key:number]:number} = {};
|
||||||
|
|
||||||
|
//添加一个属性类
|
||||||
|
add(info:GAttributeBase){
|
||||||
|
this.attributes.push(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
//重置
|
||||||
|
reset(){
|
||||||
|
this.attributes = [];
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
//刷新属性
|
||||||
|
update(){
|
||||||
|
|
||||||
|
this.info = {};
|
||||||
|
|
||||||
|
TD.TbGAttribute.getDataList().forEach(attr => {
|
||||||
|
//初始化属性
|
||||||
|
this.info[attr.id] = 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
//累加全部属性
|
||||||
|
this.attributes.forEach((attribute) => {
|
||||||
|
attribute.update();
|
||||||
|
for (const key in attribute.attributes) {
|
||||||
|
if(this.info[key]){
|
||||||
|
this.info[key] = this.info[key] + attribute.attributes[key];
|
||||||
|
}else{
|
||||||
|
this.info[key] = attribute.attributes[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.23",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "72467729-defa-485b-bd75-3bbe791ebea3",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
//属性 基类
|
||||||
|
export default abstract class GAttributeBase{
|
||||||
|
|
||||||
|
//属性 {属性Id:属性值}
|
||||||
|
attributes:{[key:number]:number} = {};
|
||||||
|
|
||||||
|
//刷新属性
|
||||||
|
abstract update();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.23",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "a0ef91dd-110a-4622-8a6d-4c16a6255d5f",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.2.0",
|
||||||
|
"importer": "directory",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "54170ba9-5142-4612-9335-28436a7ddc08",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
import { TD } from "../../../../../App";
|
||||||
|
import { PlayerPetOV } from "../../../../../consts/API";
|
||||||
|
import GAttributeBase from "../GAttributeBase";
|
||||||
|
|
||||||
|
//宠物属性
|
||||||
|
export default class GPetAttribute extends GAttributeBase{
|
||||||
|
|
||||||
|
//宠物信息
|
||||||
|
pet:PlayerPetOV;
|
||||||
|
|
||||||
|
constructor(pet:PlayerPetOV){
|
||||||
|
|
||||||
|
super();
|
||||||
|
this.pet = pet;
|
||||||
|
|
||||||
|
//固定属性直接计算
|
||||||
|
this.compute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算属性
|
||||||
|
compute(){
|
||||||
|
|
||||||
|
this.attributes = {};
|
||||||
|
//*************** 宠物初始属性 **************************
|
||||||
|
let baseAttribute = TD.TbGRoleBaseAttribute.get(this.pet.petTbId) || TD.TbGRoleBaseAttribute.get(0);
|
||||||
|
|
||||||
|
//获取全部属性信息
|
||||||
|
TD.TbGAttribute.getDataList().forEach(attr => {
|
||||||
|
//保存初始属性 如果没有默认 0
|
||||||
|
this.attributes[attr.id] = baseAttribute[attr.sign] || 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//刷新属性
|
||||||
|
update(): void { }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.23",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "a66f3d1e-b975-4cf3-a666-54194eeda220",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -24,6 +24,7 @@ import { GOnHookPet, GOnHookPets } from "../../../../extensions/ngame/assets/nga
|
|||||||
import GOnHookManager from "../../manager/battle/mode/GOnHookManager";
|
import GOnHookManager from "../../manager/battle/mode/GOnHookManager";
|
||||||
import GRoleOnHookCreepsExpand from "../base/role/expand/OnHook/GRoleOnHookCreepsExpand";
|
import GRoleOnHookCreepsExpand from "../base/role/expand/OnHook/GRoleOnHookCreepsExpand";
|
||||||
import { ModeRenderEvent } from "../../ui/Consts/Game/ModeRender";
|
import { ModeRenderEvent } from "../../ui/Consts/Game/ModeRender";
|
||||||
|
import GPetAttribute from "../base/values/attribute/role/GPetAttribute";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
//挂机模式状态
|
//挂机模式状态
|
||||||
@ -251,6 +252,10 @@ export default class GOnHookMode extends GBaseMode<{},{}>{
|
|||||||
//向宠物添加 OnHook 扩展
|
//向宠物添加 OnHook 扩展
|
||||||
let expand = role.node.addComponent(GRoleOnHookPlayerExpand);
|
let expand = role.node.addComponent(GRoleOnHookPlayerExpand);
|
||||||
expand.petId = petId;
|
expand.petId = petId;
|
||||||
|
|
||||||
|
//添加宠物属性
|
||||||
|
role.onEffectiveValue(new GPetAttribute(info));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//生成野怪
|
//生成野怪
|
||||||
@ -262,6 +267,16 @@ export default class GOnHookMode extends GBaseMode<{},{}>{
|
|||||||
let expand = role.node.addComponent(GRoleOnHookCreepsExpand);
|
let expand = role.node.addComponent(GRoleOnHookCreepsExpand);
|
||||||
expand.creeps = creeps;
|
expand.creeps = creeps;
|
||||||
|
|
||||||
|
//添加野怪属性
|
||||||
|
role.onEffectiveValue(new GPetAttribute({
|
||||||
|
petId:0,
|
||||||
|
petPlayerId:0,
|
||||||
|
petTbId:creeps.petTbId,
|
||||||
|
petLevel:0,
|
||||||
|
petStar:0,
|
||||||
|
petStarExp:0,
|
||||||
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//生成宠物
|
//生成宠物
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { TB } from "../../../resources/config/data/schema";
|
import { TB } from "../../../resources/config/data/schema";
|
||||||
import GRoleBase from "../base/role/GRoleBase";
|
|
||||||
import GRoleDefault from "../base/role/GRoleDefault";
|
import GRoleDefault from "../base/role/GRoleDefault";
|
||||||
import { GSkillBase, GSkillState } from "./GSkill";
|
import { GSkillBase, GSkillState } from "./GSkill";
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { TB } from "../../../../../resources/config/data/schema";
|
import { TB } from "../../../../../resources/config/data/schema";
|
||||||
|
import GRoleAttack from "../../../base/common/GRoleAttack";
|
||||||
import GRoleBase from "../../../base/role/GRoleBase";
|
import GRoleBase from "../../../base/role/GRoleBase";
|
||||||
import GRoleDefault from "../../../base/role/GRoleDefault";
|
import GRoleDefault from "../../../base/role/GRoleDefault";
|
||||||
import GSkillAngerBase from "../../GSkillAngerBase";
|
import GSkillAngerBase from "../../GSkillAngerBase";
|
||||||
@ -26,7 +27,7 @@ export default class GSkillBulbasaurDoubleHit extends GSkillAngerBase{
|
|||||||
|
|
||||||
let skill1Attack = () => {
|
let skill1Attack = () => {
|
||||||
if(!enemy.isDie){
|
if(!enemy.isDie){
|
||||||
enemy.onHit();
|
GRoleAttack.onNormalAttack(this.role,enemy);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let end = () => {
|
let end = () => {
|
||||||
|
@ -2,7 +2,6 @@ import { v2 } from "cc";
|
|||||||
import { JTween } from "../../../../../../extensions/ngame/assets/ngame/sync/frame/game/tween/JNFrameTween";
|
import { JTween } from "../../../../../../extensions/ngame/assets/ngame/sync/frame/game/tween/JNFrameTween";
|
||||||
import { app } from "../../../../App";
|
import { app } from "../../../../App";
|
||||||
import GSpine from "../../../base/common/GSpine";
|
import GSpine from "../../../base/common/GSpine";
|
||||||
import GRoleBase from "../../../base/role/GRoleBase";
|
|
||||||
import GSkillCDBase from "../../GSkillCDBase";
|
import GSkillCDBase from "../../GSkillCDBase";
|
||||||
import { v3 } from "cc";
|
import { v3 } from "cc";
|
||||||
import GBaseMode from "../../../GBaseMode";
|
import GBaseMode from "../../../GBaseMode";
|
||||||
@ -10,6 +9,7 @@ import GDetection from "../../../base/common/GDetection";
|
|||||||
import { rect } from "cc";
|
import { rect } from "cc";
|
||||||
import GRoleDefault from "../../../base/role/GRoleDefault";
|
import GRoleDefault from "../../../base/role/GRoleDefault";
|
||||||
import { TB } from "../../../../../resources/config/data/schema";
|
import { TB } from "../../../../../resources/config/data/schema";
|
||||||
|
import GRoleAttack from "../../../base/common/GRoleAttack";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 疯狂松鼠技能
|
* 疯狂松鼠技能
|
||||||
@ -33,7 +33,7 @@ export default class GSkillCrazySquirrel extends GSkillCDBase{
|
|||||||
|
|
||||||
//获取敌人位置
|
//获取敌人位置
|
||||||
let enemy = this.role.fsm.enemy;
|
let enemy = this.role.fsm.enemy;
|
||||||
let scene:GBaseMode<{}> = this.role.mode;
|
let scene:GBaseMode<{},{}> = this.role.mode;
|
||||||
if(!enemy) return false;
|
if(!enemy) return false;
|
||||||
|
|
||||||
let aw = parseInt(this.info.skillArgs[1]);
|
let aw = parseInt(this.info.skillArgs[1]);
|
||||||
@ -60,9 +60,8 @@ export default class GSkillCrazySquirrel extends GSkillCDBase{
|
|||||||
let world = spine.node.worldPosition;
|
let world = spine.node.worldPosition;
|
||||||
spine.node.destroy();
|
spine.node.destroy();
|
||||||
GSpine.onPlaySceneSpine(scene,v2(world.x,world.y),app.battleRes.roleResSpine[30005],"animation");
|
GSpine.onPlaySceneSpine(scene,v2(world.x,world.y),app.battleRes.roleResSpine[30005],"animation");
|
||||||
console.log(GDetection.testAABBRole(rect(world.x,world.y,aw,ah)).length)
|
GDetection.testAABBCenterRole(rect(world.x,world.y,aw,ah)).forEach(enemy =>{
|
||||||
GDetection.testAABBRole(rect(world.x,world.y,aw,ah)).forEach(role =>{
|
GRoleAttack.onNormalAttack(this.role,enemy);
|
||||||
role.onHit();
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.start();
|
.start();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": 0,
|
"id": 0,
|
||||||
"Blood": 100,
|
"Blood": 200,
|
||||||
"Attack": 10,
|
"Attack": 20,
|
||||||
"Defend": 5
|
"Defend": 5
|
||||||
}
|
}
|
||||||
]
|
]
|
Loading…
x
Reference in New Issue
Block a user