浏览代码

修改战斗属性受加成影响

txq 6 月之前
父节点
当前提交
c9f8b9442e

+ 261 - 0
assets/package/prefab/ui/tower/hero/bullet.prefab

@@ -0,0 +1,261 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "bullet",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "persistent": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "bullet",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 8
+      },
+      {
+        "__id__": 10
+      }
+    ],
+    "_prefab": {
+      "__id__": 12
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "SpriteSplash",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 5
+      }
+    ],
+    "_prefab": {
+      "__id__": 7
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 4
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 10,
+      "height": 10
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "389Onq+LBMupoQoxiwCZwN"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 6
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "cehWc3/7ZFe73C6n7zuXM9"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "1eEYLApNhB7YP4yngj3unZ",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 9
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 10,
+      "height": 10
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "c2aFUu6jBJg5uJ60FKMad/"
+  },
+  {
+    "__type__": "730cdxk+9xNDKpAnDy++yoT",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 11
+    },
+    "modelSpine": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "5cFwo9acBPVp81BFuNkJ7U"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "4cbne1jbpGk4QF3TRtbCOc",
+    "instance": null,
+    "targetOverrides": null
+  }
+]

+ 13 - 0
assets/package/prefab/ui/tower/hero/bullet.prefab.meta

@@ -0,0 +1,13 @@
+{
+  "ver": "1.1.50",
+  "importer": "prefab",
+  "imported": true,
+  "uuid": "6dcb113f-8266-41e6-b6da-5ce194d18d3e",
+  "files": [
+    ".json"
+  ],
+  "subMetas": {},
+  "userData": {
+    "syncNodeName": "bullet"
+  }
+}

+ 9 - 3
assets/package/prefab/ui/tower/hero/role101.prefab

@@ -1059,9 +1059,15 @@
     "levelLabel": {
       "__id__": 26
     },
-    "gunNode1": null,
-    "gunNode2": null,
-    "gunNode3": null,
+    "gunNode1": {
+      "__id__": 3
+    },
+    "gunNode2": {
+      "__id__": 7
+    },
+    "gunNode3": {
+      "__id__": 11
+    },
     "clickBox": {
       "__id__": 34
     },

+ 21 - 1
assets/script/game/common/InterfaceAddEnum.ts

@@ -129,4 +129,24 @@ export const AttrConf = {
     [AttrEnum.suck]: { type: AttrAddTypeEnum.percent, name: "吸血", desc: "吸血", url: "suck_ico" },
     [AttrEnum.thorns]: { type: AttrAddTypeEnum.percent, name: "反伤", desc: "反伤", url: "thorns_ico" },
     [AttrEnum.block]: { type: AttrAddTypeEnum.percent, name: "反伤", desc: "反伤", url: "thorns_ico" },
-}
+}
+
+//服务器端返回的英雄数据
+export interface RoleServer {
+    id: string; //英雄id 动物形象id
+    grade: number;  //星级
+    dna_lv: string;   //基因等级
+    dna_attr: { any }   //基因属性
+    equip: [];//读取状态
+    skin: [];//皮肤
+    fight_force: number;//战力
+}
+
+export interface Role extends RoleServer {
+    conf:any;//配置 RoleConf.data[rid]
+    attr: AttrBaseData;//属性
+    type:ItemEnum
+}
+
+//出战英雄数据[种族1 typeID,种族2 typeID,种族3 typeID,种族4 typeID]
+export type FightRole = [number, number, number, number]

+ 1 - 21
assets/script/game/data/RoleData.ts

@@ -1,26 +1,6 @@
-import { ItemEnum } from "../common/InterfaceAddEnum";
+import { FightRole, ItemEnum, Role } from "../common/InterfaceAddEnum";
 import { RoleConf } from "../ui/tower/conf/RoleConf";
 
-//服务器端返回的英雄数据
-export interface RoleServer {
-    id: string; //英雄id 动物形象id
-    grade: number;  //星级
-    dna_lv: string;   //基因等级
-    dna_attr: { any }   //基因属性
-    equip: [];//读取状态
-    skin: [];//皮肤
-    fight_force: number;//战力
-}
-
-export interface Role extends RoleServer {
-    conf: {};//配置
-    attr: {};//属性
-    type:ItemEnum
-}
-
-//出战英雄数据[种族1 typeID,种族2 typeID,种族3 typeID,种族4 typeID]
-export type FightRole = [number, number, number, number]
-
 class Data {
 
     private _roles: { [id: string]: Role } = {};

+ 3 - 3
assets/script/game/manager/RoleManager.ts

@@ -1,10 +1,10 @@
 import { Framework } from "../../framework/Framework";
-import { AttrBaseData, AttrConf, AttrEnum, ItemEnum } from "../common/InterfaceAddEnum";
+import { AttrBaseData, AttrConf, AttrEnum, ItemEnum, Role, RoleServer } from "../common/InterfaceAddEnum";
 import { LoginMgr } from "../common/LoginManager";
 import { FateattridConf } from "../config/FateattridConf";
 import { FateConf } from "../config/FateConf";
 import { RolegradeConf } from "../config/RolegradeConf";
-import { Role, RoleData, RoleServer } from "../data/RoleData";
+import { RoleData } from "../data/RoleData";
 import { RoleConf } from "../ui/tower/conf/RoleConf";
 import { EquipManager } from "./EquipManager";
 
@@ -38,7 +38,7 @@ export class RoleManager {
         RoleData.setData(roles);
     }
 
-    static getRoleAttr(role) {
+    static getRoleAttr(role): AttrBaseData {
         let attrs:AttrBaseData = {
             [AttrEnum.attack]: 0,
             [AttrEnum.defence]: 0,

+ 7 - 6
assets/script/game/ui/tower/TowerUI.ts

@@ -25,13 +25,14 @@ import { MailManager } from '../../manager/MailManager';
 import { ViewID } from '../../../framework/config/LayerConf';
 import { MailData } from '../../data/MailData';
 import { RoleManager } from '../../manager/RoleManager';
-import { FightRole, RoleData } from '../../data/RoleData';
+import { RoleData } from '../../data/RoleData';
 import { BattleData, BattleLayoutPos, BattleLayoutScale, BattleOptsBase, BattleOptsKill, BattleOptsMerge, BattleOptsMove, BattleOptsNew, BattleOptsRemove, BattleOptsType } from '../../data/BattleData';
 import { BattleManager } from '../../manager/BattleManager';
 import { UserData } from '../../data/UserData';
 import { ResultUI } from './node/ResultUI';
 import { ChangeChapter } from './node/ChangeChapter';
 import { RewardChapter } from './node/RewardChapter';
+import { FightRole } from '../../common/InterfaceAddEnum';
 
 //地图比例尺 1:70
 let mapScale = 72;
@@ -744,7 +745,7 @@ export class TowerUI extends BaseView {
 				bagPos.hero.position = bagPos.pos;
 				let hero = bagPos.hero.getComponent(Hero);
 				
-				heroData.init(battleLayoutData.typeID,battleLayoutData.level,-1)
+				heroData.init(RoleData.getRoleDataByID(battleLayoutData.typeID),battleLayoutData.level,-1)
 				hero.resetData(heroData);
 			}
 		}
@@ -786,7 +787,7 @@ export class TowerUI extends BaseView {
 							posData.hero.position = posData.pos;
 							let hero = posData.hero.getComponent(Hero);
 							
-							heroData.init(battleLayoutData.typeID,battleLayoutData.level,posNumber)
+							heroData.init(RoleData.getRoleDataByID(battleLayoutData.typeID),battleLayoutData.level,posNumber)
 							hero.resetData(heroData);
 						}
 					}
@@ -903,7 +904,7 @@ export class TowerUI extends BaseView {
 			}
 		}
 		let heroData = HeroDataPool.getObject();
-		heroData.init(heroID,1,1)
+		heroData.init(RoleData.getRoleDataByID(heroID),1,1)
 		
 		let node:Node = null;
 		if(this.heroPool[heroID] == null){
@@ -968,7 +969,7 @@ export class TowerUI extends BaseView {
 		// let heroIndex = Math.floor(Math.random() * this.loadHeroModelNum)%this.loadHeroModelNum;
 		let heroID = typeID;
 		let heroData = HeroDataPool.getObject();
-		heroData.init(heroID,level,1)
+		heroData.init(RoleData.getRoleDataByID(heroID),level,1)
 		
 		let posData = this.bagPosList[posIndex];
 		
@@ -1009,7 +1010,7 @@ export class TowerUI extends BaseView {
 		
 		posData.hero = node;
 		
-		let scale = posIndex > BattleUtil.BagListSize ? 1.2 : 1;
+		let scale = posIndex > BattleUtil.BagListSize-1 ? 1.2 : 1;
 		node.scale = v3(scale,scale,1);
 
 		node.position = posData.pos;

+ 3 - 1
assets/script/game/ui/tower/control/BattleControl.ts

@@ -1,3 +1,4 @@
+import { RoleData } from "../../../data/RoleData";
 import { BattleBase } from "../base/BattleBase";
 import { BattleEventManager } from "../base/BattleEventManager";
 import { BattleEventData_Over, BattleEventTarget, BattleEventType } from "../base/BattleEventUtil";
@@ -132,7 +133,8 @@ export class BattleControl extends BattleBase{
                         let startPosID = heroDataChange.changeValueLlist[2] 
                         let startPos = this.map.attackPosDataMap.get(startPosID)
                         if(startPos){
-                            let heroData = this.map.addHero(heroDataChange.changeValueLlist[0],heroDataChange.changeValueLlist[1],heroDataChange.changeValueLlist[2])
+                            let role = RoleData.getRoleDataByID(heroDataChange.changeValueLlist[0])
+                            let heroData = this.map.addHero(role,heroDataChange.changeValueLlist[1],heroDataChange.changeValueLlist[2])
                             startPos.hero = heroData
                         }
                         break

+ 10 - 9
assets/script/game/ui/tower/data/HeroData.ts

@@ -1,5 +1,5 @@
 
-import { RoleConf } from "../conf/RoleConf";
+import { Role } from "../../../common/InterfaceAddEnum";
 import { UptypeConf } from "../conf/UptypeConf";
 import { BattleDataPool } from "./BattleDataPool";
 import { BulletType, ObjectValueType } from "./BattleEnum";
@@ -73,23 +73,24 @@ export class HeroData extends DataBase{
     coolDown: number;
 
 
-    init(typeID:number, level:number, posID: number) {
+    init(role:Role, level:number, posID: number) {
         super._init();
         this.level = level;
-        this.typeID = typeID;
+        this.typeID = Number(role.id);
         this.posID = posID;
-        this._raceID = (typeID - typeID%HeroRaceSacle)/HeroRaceSacle
+        this._raceID = role.conf.race
+        // let roleData = RoleData.getRoleDataByID(this.typeID)
         //读地图
         this.position = new BattleUtil.Vector2(0, 0);
-        let heroConf = RoleConf.data[typeID]
+        let heroConf = role.conf
         if (heroConf) {
             this.attackType = heroConf.AttackType;
-            this._speed = heroConf.Speed;
+            this._speed = role.attr.speed;
             this.coolDown = this._speed
             this._attackRadius = heroConf.Radius;
-            this._attackDamage = heroConf.Damage;
-            this._critical = heroConf.Critical;
-            this._criticalDamage = heroConf.CriticalDamage;
+            this._attackDamage = role.attr.attack;
+            this._critical = role.attr.crite;
+            this._criticalDamage = role.attr.critedamage;
             this.skillList = heroConf.SkillArray
 
             if(this.skillList && this.skillList.length > 0){

+ 3 - 2
assets/script/game/ui/tower/data/MapData.ts

@@ -1,3 +1,4 @@
+import { Role } from "../../../common/InterfaceAddEnum";
 import { BattlesConf } from "../conf/BattlesConf";
 import { EnemyConf } from "../conf/EnemyConf";
 import { MapConf } from "../conf/MapConf";
@@ -279,9 +280,9 @@ export class MapData {
    }
 
    //添加到地图上
-   addHero(typeID:number,level:number,posID:number){
+   addHero(role:Role,level:number,posID:number){
         let hero = HeroDataPool.getObject()
-        hero.init(typeID,level,posID);
+        hero.init(role,level,posID);
         console.log(typeof(posID),posID)
        if(this.attackPosDataMap.has(posID)){
             let posData = this.attackPosDataMap.get(posID)

+ 0 - 10
assets/script/game/ui/tower/node/Bullet.ts

@@ -8,9 +8,6 @@ const { ccclass, property } = _decorator;
 export class Bullet extends BattleNodeBase {
 
 
-    @property({ type: sp.Skeleton, tooltip: '骨骼动画' })
-    modelSpine: sp.Skeleton = null;
-
     speedVector: Vec2 = new Vec2(0, 0);
 
     bStand: boolean = false;
@@ -21,8 +18,6 @@ export class Bullet extends BattleNodeBase {
 
     protected onLoad(): void {
         this.priority = RenderPriority.Bullet;
-        this.modelSpine.setCompleteListener(this.actionComplete.bind(this))
-
     }
 
     start() {
@@ -52,10 +47,6 @@ export class Bullet extends BattleNodeBase {
 
     stand() {
         this.bStand = true;
-        if(!this.modelSpine.node.active) return;
-        this.modelSpine.setAnimation(0, 'idle', true);
-        this.modelSpine.color = Color.WHITE;
-        // this._attackCallback = null;
     }
 
    
@@ -68,7 +59,6 @@ export class Bullet extends BattleNodeBase {
         this.dieCallback = callback;
         tween(this.node).delay(0.5).call(() =>  {
             this.node.active = false
-            this.modelSpine.color = Color.WHITE;
             this.dieCallback && this.dieCallback()
         }).start()
     }