Jelajahi Sumber

计算方式攻击 速度修改

woso_javan 2 bulan lalu
induk
melakukan
244c776912

+ 1 - 23
assets/module_basic/config/develop_config.json

@@ -1,23 +1 @@
-{
-    "1": {
-        "property_type": 1,
-        "base": 0,
-        "up_value": 1,
-        "base_currency": 350,
-        "money_growth": 350
-    },
-    "2": {
-        "property_type": 2,
-        "base": 0,
-        "up_value": 1,
-        "base_currency": 450,
-        "money_growth": 450
-    },
-    "3": {
-        "property_type": 3,
-        "base": 0,
-        "up_value": 10,
-        "base_currency": 400,
-        "money_growth": 400
-    }
-}
+{"1":{"property_type":1,"base":0,"up_value":1,"base_currency":350,"money_growth":350},"2":{"property_type":2,"base":0,"up_value":1,"base_currency":450,"money_growth":450},"3":{"property_type":3,"base":0,"up_value":10,"base_currency":400,"money_growth":400}}

+ 81 - 1
assets/module_basic/config/main_config.json

@@ -1 +1,81 @@
-{"1":{"param":5,"content":"强制弹窗广告间隔游玩次数"},"2":{"param":5000,"content":"观看广告获得货币的数量"},"3":{"param":20,"content":"龙卷风基础高度"},"4":{"param":1,"content":"每获得1经验提升的高度值"},"5":{"param":5,"content":"基础攻击力"},"6":{"param":5,"content":"每次升级提升的攻击力"},"7":{"param":2,"content":"每秒攻击次数"},"8":{"param":20,"content":"基础移动速度"},"9":{"param":1,"content":"每次升级提升的移动速度"},"10":{"param":10,"content":"等级为1时被吸收基础提供经验值"},"11":{"param":10,"content":"每次升级时提升的提供经验值"},"12":{"param":1,"content":"龙卷风基础模型体积"},"13":{"param":50,"content":"每次升级时提升体型的百分比,此数值在每次升级时加算,即 体积=基础体积×(1+等级×百分比)"},"14":{"param":50,"content":"开局弹窗提升的龙卷风破坏范围百分比"},"15":{"param":null,"content":"AI属性等级对比玩家属性等级浮动值,用一个负数到正数的区间表示"},"16":{"param":400,"content":"基础通关奖励"},"17":{"param":50,"content":"奖励养成属性加成百分比"},"18":{"param":5,"content":"奖励排名减益百分比"},"19":{"param":3,"content":"通过多倍奖励倍率"}}
+{
+    "1": {
+        "param": 5,
+        "content": "强制弹窗广告间隔游玩次数"
+    },
+    "2": {
+        "param": 5000,
+        "content": "观看广告获得货币的数量"
+    },
+    "3": {
+        "param": 20,
+        "content": "龙卷风基础高度"
+    },
+    "4": {
+        "param": 1,
+        "content": "每获得1经验提升的高度值"
+    },
+    "5": {
+        "param": 5,
+        "content": "基础攻击力"
+    },
+    "6": {
+        "param": 5,
+        "content": "每次升级提升的攻击力"
+    },
+    "7": {
+        "param": 2,
+        "content": "每秒攻击次数"
+    },
+    "8": {
+        "param": 20,
+        "content": "基础移动速度"
+    },
+    "9": {
+        "param": 1,
+        "content": "每次升级提升的移动速度"
+    },
+    "10": {
+        "param": 10,
+        "content": "等级为1时被吸收基础提供经验值"
+    },
+    "11": {
+        "param": 10,
+        "content": "每次升级时提升的提供经验值"
+    },
+    "12": {
+        "param": 1,
+        "content": "龙卷风基础模型体积"
+    },
+    "13": {
+        "param": 50,
+        "content": "每次升级时提升体型的百分比,此数值在每次升级时加算,即 体积=基础体积×(1+等级×百分比)"
+    },
+    "14": {
+        "param": 50,
+        "content": "开局弹窗提升的龙卷风破坏范围百分比"
+    },
+    "15": {
+        "param": [
+            -10,
+            1
+        ],
+        "content": "AI属性等级对比玩家属性等级浮动值,用一个负数到正数的区间表示"
+    },
+    "16": {
+        "param": 400,
+        "content": "基础通关奖励"
+    },
+    "17": {
+        "param": 50,
+        "content": "奖励养成属性加成百分比"
+    },
+    "18": {
+        "param": 5,
+        "content": "奖励排名减益百分比"
+    },
+    "19": {
+        "param": 3,
+        "content": "通过多倍奖励倍率"
+    }
+}

+ 1 - 0
assets/module_basic/table/Tabledevelop_config.ts

@@ -36,3 +36,4 @@ export class Tabledevelop_config {
         return this.data.money_growth;
     }
 }
+    

+ 1 - 1
assets/module_basic/table/Tablemain_config.ts

@@ -16,7 +16,7 @@ export class Tablemain_config {
     id: number = 0;
 
     /** 参数 */
-    get param(): number {
+    get param(): any {
         return this.data.param;
     }
     /** 数据说明 */

+ 14 - 5
assets/module_storm_sunder/Script/Component/TornadoAIComponent.ts

@@ -31,18 +31,27 @@ export class TornadoAIComponent extends TornadoComponent {
 
     protected async start() {
         super.start();
-
         this.ai = true;
-        this.playerInfo.nickName = '阿西吧 ai';
-        this.playerInfo.level = 2;
-        this.currentLv = this.playerInfo.level;
 
+        this.initAIPlayer();
         this.onPlayerInfoHandler();
         this.decideAction(); // 进入行为循环
 
         this.radiusTigger.on('onTriggerEnter', this.onRadiusTriggerEnter, this);
     }
 
+    private initAIPlayer() {
+        this.playerInfo.nickName = '阿西吧 ai';
+        this.playerInfo.level = 2;
+        this.currentLv = this.playerInfo.level;
+
+        this.nextExp = this.attributeBonusMgr.getExpNeed(this.currentLv + 1);
+        this.attack = this.attributeBonusMgr.getStormSunderAttack(this.currentLv, true);
+        this.speed = this.attributeBonusMgr.getStormSunderSpeed(this.currentLv, true);
+
+        console.log(`AI 攻击力:${this.attack} 速度:${this.speed} 下一级经验:${this.nextExp}`)
+    }
+
     /** 选择 AI 行为 */
     private decideAction() {
         if (this.playerStatus == PlayerStatus.DIE) return; // AI 死亡时不执行行为
@@ -169,7 +178,7 @@ export class TornadoAIComponent extends TornadoComponent {
         this.isChasing = true;
         this.targetNode = target;
 
-        PathfindingManager.getInstance().followTarget(this, target, 30, () => {
+        PathfindingManager.getInstance().followTarget(this, target, this.speed, () => {
             console.log(`AI 追击目标到达`);
             this.unscheduleAllCallbacks();
             this.isChasing = false;

+ 13 - 9
assets/module_storm_sunder/Script/Component/TornadoComponent.ts

@@ -43,6 +43,8 @@ export class TornadoComponent extends Component {
     _attackInterval: number = 0.5; // 攻击间隔
     _lastAttackTime: Map<string, number> = new Map(); // 记录上次攻击时间
 
+    attributeBonusMgr: AttributeBonusMgr = null;
+
     protected start(): void {
         this.initPlayer();
         this.initilizeUI();
@@ -67,16 +69,17 @@ export class TornadoComponent extends Component {
     }
 
     protected initPlayer() {
-        const attributeBonusMgr = AttributeBonusMgr.inst;
-        const userModel = attributeBonusMgr.userModel;
+        this.attributeBonusMgr = AttributeBonusMgr.inst;
+        const userModel = this.attributeBonusMgr.userModel;
 
-        this.currentLv = userModel.userTornadoLevel;
         this.currentExp = 0;
-        this.nextExp = attributeBonusMgr.getExpNeed(this.currentLv + 1);
-        this.attack = attributeBonusMgr.getStormSunderAttack(userModel.userTornadoLevel);
-        this.speed = attributeBonusMgr.getStormSunderSpeed(userModel.userTornadoLevel);
+        this.nextExp = this.attributeBonusMgr.getExpNeed(this.currentLv + 1);
+        this.attack = this.attributeBonusMgr.getStormSunderAttack(this.currentLv);
+        this.speed = this.attributeBonusMgr.getStormSunderSpeed(this.currentLv);
         this.nickName = userModel.nickName;
 
+        console.log(`玩家的攻击力 :${this.attack}}`)
+
         this.playerInfo = {
             nickName: this.nickName,
             level: this.currentLv,
@@ -197,6 +200,7 @@ export class TornadoComponent extends Component {
     }
 
     protected onPlayerInfoHandler() {
+        if (!this.node || !this.playerInfo) return;
         Effect2DUIMgr.inst.addPlayerInfo(this.node, this.playerInfo);
     }
 
@@ -218,6 +222,7 @@ export class TornadoComponent extends Component {
         if (!this.curHitObj) return;
 
         const propComp = this.curHitObj.getComponent(PropComponent);
+
         let objExp = 0;
         if (this.curHitObj.getComponent(PropComponent)) {
             objExp = propComp.currentExp;
@@ -226,13 +231,12 @@ export class TornadoComponent extends Component {
             objExp = AttributeBonusMgr.inst.getStormSunderExp(lv);
         }
 
+        objExp = AttributeBonusMgr.inst.getStormSunderExp(objExp);
         this.currentExp += objExp;
         if (this.currentExp >= this.nextExp) {
             this.currentLv++;
-            AttributeBonusMgr.inst.userModel.userTornadoLevel = this.currentLv;
-            this.stormLevelUp();
-
             this.playerInfo.level = this.currentLv;
+            this.stormLevelUp();
             Effect2DUIMgr.inst.updatePlayerInfo(this.node, this.playerInfo);
         }
     }

+ 17 - 7
assets/module_storm_sunder/Script/Manager/AttributeBonusMgr.ts

@@ -72,9 +72,18 @@ export class AttributeBonusMgr {
     }
 
     /** 获取类型最终属性加成*/
-    public getBonus(type: BonusType): number {
+    public getBonus(type: BonusType, isAI?: boolean): number {
         const { level, base, up_value } = this.userModel.bonusData[type];
-        return base + (level - 1) * up_value;
+        let finialLevel = 1;
+        if (!isAI) {
+            finialLevel = level;
+        } else {
+            const aiRange = this.userModel.game_ai_range;
+            const randomOffset = Math.floor(Math.random() * (aiRange[1] - aiRange[0] + 1)) + aiRange[0];
+            const newLv = level + randomOffset;
+            finialLevel = newLv < 0 ? 3 : newLv; // 如果计算结果小于 0,则返回 3
+        }
+        return base + (finialLevel - 1) * up_value;
     }
 
     /** 升级需要的经验*/
@@ -84,7 +93,7 @@ export class AttributeBonusMgr {
 
     /** 计算玩家龙卷风攻击力*/
     public getStormSunderAttack(lv: number, isAI?: boolean): number {
-        const external_attack = this.getBonus(BonusType.ATTACK);
+        const external_attack = this.getBonus(BonusType.ATTACK, isAI);
         const game_attack_base = this.userModel.game_attack_base;
         const game_lv_attack_up = this.userModel.game_lv_attack_up;
         return external_attack + game_attack_base + game_lv_attack_up * lv;
@@ -92,7 +101,7 @@ export class AttributeBonusMgr {
 
     /** 计算玩家龙卷风速度*/
     public getStormSunderSpeed(lv: number, isAI?: boolean): number {
-        const external_speed = this.getBonus(BonusType.SPEED);
+        const external_speed = this.getBonus(BonusType.SPEED, isAI);
         const game_speed_base = this.userModel.game_speed_base;
         const game_lv_speed_up = this.userModel.game_lv_speed_up;
         return external_speed + game_speed_base + game_lv_speed_up * lv;
@@ -105,9 +114,10 @@ export class AttributeBonusMgr {
         return game_absorbec_exp_base + game_lv_absorbec_exp_up * lv;
     }
 
-    /** DOTO 计算经验加成百分比*/
-    public getExpBonus(isAI?: boolean): number {
-        return 0;
+    /** 经验加成后最终值*/
+    public getExpBonus(exp: number, isAI?: boolean): number {
+        const expProgress = Math.floor(this.getBonus(BonusType.EXP) / 100);
+        return exp * (1 + expProgress);
     }
 }
 

+ 10 - 6
assets/module_storm_sunder/Script/Model/UserModel.ts

@@ -8,12 +8,16 @@ import { AttributeBonusMgr, BonusType } from "../Manager/AttributeBonusMgr";
 export class UserModel {
     money: number = 9999;
     nickName: string = '爸爸在此'; //昵称
-    userTornadoLevel: number = 1; //玩家风暴等级
-
-    game_attack_base: number = 0; //游戏内攻击力
-    game_lv_attack_up: number = 0;//每级提升的攻击力
-    game_speed_base: number = 0; //游戏内速度
-    game_lv_speed_up: number = 0;//每级提升的速度
+    // userTornadoLevel: number = 1; //玩家风暴等级
+
+    /** 游戏内基础攻击*/
+    game_attack_base: number = 0;
+    /** 游戏内等级升级提升的攻击力*/
+    game_lv_attack_up: number = 0;
+    /** 游戏内基础速度*/
+    game_speed_base: number = 0;
+    /** 游戏内等级升级提升的速度*/
+    game_lv_speed_up: number = 0;
     game_expPower_base: number = 0;//经验基础加成
     game_absorbec_exp_base: number = 0;//被吸收基础提供经验值
     game_lv_absorbec_exp_up: number = 0;//升级提供的经验值提升