From b4e9c3b891a28c3d659028cff87e62f59c804f29 Mon Sep 17 00:00:00 2001 From: Pilow Date: Fri, 19 May 2023 11:17:49 +0200 Subject: [PATCH] [entity] Small fixes --- src/main/java/com/leekwars/generator/fight/Fight.java | 3 ++- .../java/com/leekwars/generator/fight/entity/EntityAI.java | 2 +- src/main/java/com/leekwars/generator/scenario/EntityInfo.java | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/leekwars/generator/fight/Fight.java b/src/main/java/com/leekwars/generator/fight/Fight.java index fe52df5..f2931db 100644 --- a/src/main/java/com/leekwars/generator/fight/Fight.java +++ b/src/main/java/com/leekwars/generator/fight/Fight.java @@ -164,6 +164,7 @@ public void startFight(boolean drawCheckLife) throws Exception { // Build AI after the fight is ready (static init) var ai = EntityAI.build(this.generator, (AIFile) entity.getAIFile(), entity); entity.setAI(ai); + ((EntityAI) ai).setFight(this); ((EntityAI) ai).init(); ((EntityAI) ai).getRandom().seed(state.getSeed()); @@ -267,7 +268,6 @@ public void startTurn() throws Exception { state.getActions().log(new ActionEntityTurn(current)); Log.i(TAG, "Start turn of " + current.getName()); - current.applyCoolDown(); current.startTurn(); if (!current.isDead()) { @@ -275,6 +275,7 @@ public void startTurn() throws Exception { var ai = (EntityAI) current.getAI(); if (ai != null) { if (ai.isValid()) { + // System.out.println("Run " + current.getName() + " ai..."); long startTime = System.nanoTime(); ai.runTurn(state.getOrder().getTurn()); long endTime = System.nanoTime(); diff --git a/src/main/java/com/leekwars/generator/fight/entity/EntityAI.java b/src/main/java/com/leekwars/generator/fight/entity/EntityAI.java index 55ffd5c..70dab55 100644 --- a/src/main/java/com/leekwars/generator/fight/entity/EntityAI.java +++ b/src/main/java/com/leekwars/generator/fight/entity/EntityAI.java @@ -133,7 +133,7 @@ public static EntityAI build(Generator generator, AIFile file, Entity entity) { return new EntityAI(entity, (LeekLog) entity.getLogs()); } - Log.i(TAG, "Compile AI " + file.getPath() + "..."); + Log.i(TAG, "Compile AI " + file.getPath() + " (id " + file.getId() + ")..."); try { file.setJavaClass("AI_" + file.getId()); file.setRootClass("com.leekwars.generator.fight.entity.EntityAI"); diff --git a/src/main/java/com/leekwars/generator/scenario/EntityInfo.java b/src/main/java/com/leekwars/generator/scenario/EntityInfo.java index 3ab7a11..d76e852 100644 --- a/src/main/java/com/leekwars/generator/scenario/EntityInfo.java +++ b/src/main/java/com/leekwars/generator/scenario/EntityInfo.java @@ -111,6 +111,7 @@ public Entity createEntity(Generator generator, Scenario scenario, Fight fight) entity.setId(id); entity.setName(name); entity.setLevel(level); + entity.setTotalLife(life); entity.setLife(life); entity.setStrength(strength); entity.setAgility(agility);