Răsfoiți Sursa

经验加成计算

woso_javan 2 luni în urmă
părinte
comite
71d9d89d8c

+ 10 - 2
assets/module_storm_sunder/Script/Component/TornadoAIComponent.ts

@@ -49,6 +49,8 @@ export class TornadoAIComponent extends TornadoComponent {
         this.attack = this.attributeBonusMgr.getStormSunderAttack(this.currentLv, true);
         this.speed = this.attributeBonusMgr.getStormSunderSpeed(this.currentLv, true);
 
+        this.attack = 10000; //测试
+
         console.log(`AI 攻击力:${this.attack} 速度:${this.speed} 下一级经验:${this.nextExp}`)
     }
 
@@ -97,7 +99,6 @@ export class TornadoAIComponent extends TornadoComponent {
         }, this.moveDuration);
     }
 
-
     protected onTriggerEnter(event: ITriggerEvent): void {
         // super.onTriggerEnter(event);
         if (event.otherCollider.getGroup() === 1 << 2) {
@@ -117,12 +118,19 @@ export class TornadoAIComponent extends TornadoComponent {
             const targetTornado = otherCollider.node.parent.getComponent(TornadoComponent);
             if (!targetTornado) return;
 
-            if (this.currentLv > targetTornado.currentLv) {
+            const isPlayer = targetTornado instanceof TornadoComponent;
+            if (this.currentLv > targetTornado.currentLv && isPlayer) {
                 GameMgr.inst.setGameStatus(GameStatus.End);
             }
         }
     }
 
+    protected addExpByKill() {
+        super.addExpByKill(true);
+
+        console.log(`AI 当前经验:${this.currentExp}`);
+    }
+
     /** 触发器检测(过程中遇到其他龙卷风) */
     protected onRadiusTriggerEnter(event: ITriggerEvent): void {
         const otherCollider = event.otherCollider;

+ 4 - 2
assets/module_storm_sunder/Script/Component/TornadoComponent.ts

@@ -218,7 +218,7 @@ export class TornadoComponent extends Component {
         this.node.setPosition(this.node.position.x + playerX, 0, this.node.position.z - playerZ);
     }
 
-    protected addExpByKill() {
+    protected addExpByKill(isAI?: boolean) {
         if (!this.curHitObj) return;
 
         const propComp = this.curHitObj.getComponent(PropComponent);
@@ -232,7 +232,9 @@ export class TornadoComponent extends Component {
         }
 
         objExp = AttributeBonusMgr.inst.getStormSunderExp(objExp);
-        this.currentExp += objExp;
+        const finialExp = AttributeBonusMgr.inst.getExpBonus(objExp, isAI);
+        this.currentExp += finialExp;
+
         if (this.currentExp >= this.nextExp) {
             this.currentLv++;
             this.playerInfo.level = this.currentLv;

+ 1 - 1
assets/module_storm_sunder/Script/Manager/AttributeBonusMgr.ts

@@ -116,7 +116,7 @@ export class AttributeBonusMgr {
 
     /** 经验加成后最终值*/
     public getExpBonus(exp: number, isAI?: boolean): number {
-        const expProgress = Math.floor(this.getBonus(BonusType.EXP) / 100);
+        const expProgress = Math.floor(this.getBonus(BonusType.EXP, isAI) / 100);
         return exp * (1 + expProgress);
     }
 }

Fișier diff suprimat deoarece este prea mare
+ 181 - 137
assets/module_storm_sunder/rooster_stormsunder.scene


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff