diff --git a/client/build.gradle b/client/build.gradle index ec200661..4b5c9d3c 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -11,4 +11,10 @@ dependencies { } implementation group: 'net.mostlyoriginal.artemis-odb', name: 'contrib-plugin-profiler', version: '2.5.0' implementation group: "org.reflections", name: "reflections", version: "$reflectionsVersion" + + compileOnly 'org.projectlombok:lombok:1.18.24' + annotationProcessor 'org.projectlombok:lombok:1.18.24' + + testCompileOnly 'org.projectlombok:lombok:1.18.24' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.24' } diff --git a/components/build.gradle b/components/build.gradle index a47ab06d..51ac9bb2 100644 --- a/components/build.gradle +++ b/components/build.gradle @@ -4,4 +4,10 @@ sourceSets.main.java.srcDirs = ["src/"] dependencies { api group: "com.badlogicgames.gdx", name: "gdx", version: "$gdxVersion" api group: "net.onedaybeard.artemis", name: "artemis-odb", version: "$artemisVersion" + + compileOnly 'org.projectlombok:lombok:1.18.24' + annotationProcessor 'org.projectlombok:lombok:1.18.24' + + testCompileOnly 'org.projectlombok:lombok:1.18.24' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.24' } diff --git a/components/src/component/entity/Clear.java b/components/src/component/entity/Clear.java index 7c6b9b5f..3cf4f5aa 100644 --- a/components/src/component/entity/Clear.java +++ b/components/src/component/entity/Clear.java @@ -1,6 +1,9 @@ package component.entity; import com.artemis.Component; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; /** * Componente para la limpieza automática de entidades por timeout. @@ -10,18 +13,12 @@ * @todo ¿son necesarios los getters/setters? * @todo Evaluar unificar los sistemas de limpieza en cliente y servidor. */ -public class Clear extends Component { - - float time; - public Clear() { - } +@Getter +@Setter +@NoArgsConstructor +public class Clear extends Component { - public float getTime() { - return time; - } + private float time; - public void setTime(float time) { - this.time = time; - } } diff --git a/components/src/component/entity/Description.java b/components/src/component/entity/Description.java index 779a349a..fee9156f 100644 --- a/components/src/component/entity/Description.java +++ b/components/src/component/entity/Description.java @@ -2,19 +2,16 @@ import com.artemis.Component; import com.artemis.annotations.PooledWeaver; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; import java.io.Serializable; @PooledWeaver +@NoArgsConstructor +@AllArgsConstructor public class Description extends Component implements Serializable { public String text; - public Description() { - } - - public Description(String desc) { - this.text = desc; - } - } diff --git a/components/src/component/entity/Ref.java b/components/src/component/entity/Ref.java index 06ab7798..0fe4a8ae 100644 --- a/components/src/component/entity/Ref.java +++ b/components/src/component/entity/Ref.java @@ -1,22 +1,16 @@ package component.entity; import com.artemis.Component; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter public class Ref extends Component { private int id; - public Ref() { - } - - public Ref(int id) { - this.id = id; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } } diff --git a/components/src/component/entity/character/Character.java b/components/src/component/entity/character/Character.java index a2877a67..facf0790 100644 --- a/components/src/component/entity/character/Character.java +++ b/components/src/component/entity/character/Character.java @@ -2,11 +2,12 @@ import com.artemis.Component; import com.artemis.annotations.PooledWeaver; +import lombok.NoArgsConstructor; import java.io.Serializable; @PooledWeaver +@NoArgsConstructor public class Character extends Component implements Serializable { - public Character() { - } + } diff --git a/components/src/component/entity/character/status/Criminal.java b/components/src/component/entity/character/status/Criminal.java index c0b69ea6..b7dd6a1f 100644 --- a/components/src/component/entity/character/status/Criminal.java +++ b/components/src/component/entity/character/status/Criminal.java @@ -2,13 +2,13 @@ import com.artemis.Component; import com.artemis.annotations.PooledWeaver; +import lombok.NoArgsConstructor; import java.io.Serializable; @PooledWeaver +@NoArgsConstructor public class Criminal extends Component implements Serializable { - public Criminal() { - } } diff --git a/components/src/component/entity/character/status/GM.java b/components/src/component/entity/character/status/GM.java index 95371b8f..8d163779 100644 --- a/components/src/component/entity/character/status/GM.java +++ b/components/src/component/entity/character/status/GM.java @@ -2,12 +2,12 @@ import com.artemis.Component; import com.artemis.annotations.PooledWeaver; +import lombok.NoArgsConstructor; import java.io.Serializable; @PooledWeaver +@NoArgsConstructor public class GM extends Component implements Serializable { - public GM() { - } } diff --git a/components/src/component/entity/combat/AttackPower.java b/components/src/component/entity/combat/AttackPower.java index dc69a3cb..47451ddc 100644 --- a/components/src/component/entity/combat/AttackPower.java +++ b/components/src/component/entity/combat/AttackPower.java @@ -2,26 +2,20 @@ import com.artemis.Component; import com.artemis.annotations.PooledWeaver; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import java.io.Serializable; @PooledWeaver +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter public class AttackPower extends Component implements Serializable { - public int value; + private int value; - public AttackPower() { - } - - public AttackPower(int value) { - this.value = value; - } - - public int getValue() { - return value; - } - - public void setValue(int value) { - this.value = value; - } } diff --git a/components/src/component/entity/combat/EvasionPower.java b/components/src/component/entity/combat/EvasionPower.java index 9be06913..4120ee96 100644 --- a/components/src/component/entity/combat/EvasionPower.java +++ b/components/src/component/entity/combat/EvasionPower.java @@ -2,26 +2,20 @@ import com.artemis.Component; import com.artemis.annotations.PooledWeaver; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import java.io.Serializable; @PooledWeaver +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter public class EvasionPower extends Component implements Serializable { public int value; - public EvasionPower() { - } - - public EvasionPower(int value) { - this.value = value; - } - - public int getValue() { - return value; - } - - public void setValue(int value) { - this.value = value; - } } diff --git a/components/src/component/entity/npc/NPC.java b/components/src/component/entity/npc/NPC.java index 8b63193b..fbac9bc8 100644 --- a/components/src/component/entity/npc/NPC.java +++ b/components/src/component/entity/npc/NPC.java @@ -2,26 +2,20 @@ import com.artemis.Component; import com.artemis.annotations.PooledWeaver; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import java.io.Serializable; @PooledWeaver +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter public class NPC extends Component implements Serializable { - public int id; + private int id; - public NPC() { - } - - public NPC(int id) { - this.id = id; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } } diff --git a/components/src/component/entity/npc/OriginPos.java b/components/src/component/entity/npc/OriginPos.java index eef62b98..28dbb3b4 100644 --- a/components/src/component/entity/npc/OriginPos.java +++ b/components/src/component/entity/npc/OriginPos.java @@ -3,10 +3,16 @@ import com.artemis.Component; import com.artemis.annotations.PooledWeaver; import component.position.WorldPos; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; import java.util.Objects; @PooledWeaver +@Getter +@Setter +@AllArgsConstructor public class OriginPos extends Component { public int map; @@ -19,48 +25,12 @@ public OriginPos() { this.map = 0; } - public OriginPos(int x, int y) { - this.x = x; - this.y = y; - this.map = 1; // wrong - } - - public OriginPos(int x, int y, int map) { - this.x = x; - this.y = y; - this.map = map; - } - public OriginPos(OriginPos pos) { this.x = pos.x; this.y = pos.y; this.map = pos.map; } - public int getMap() { - return map; - } - - public void setMap(int map) { - this.map = map; - } - - public int getX() { - return x; - } - - public void setX(int x) { - this.x = x; - } - - public int getY() { - return y; - } - - public void setY(int y) { - this.y = y; - } - public WorldPos toWorldPos() { return new WorldPos(x, y, map); } diff --git a/components/src/component/entity/npc/Respawn.java b/components/src/component/entity/npc/Respawn.java index eeeb3cc6..a94ebf8b 100644 --- a/components/src/component/entity/npc/Respawn.java +++ b/components/src/component/entity/npc/Respawn.java @@ -1,47 +1,23 @@ package component.entity.npc; import com.artemis.Component; +import com.artemis.annotations.All; import com.artemis.annotations.PooledWeaver; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import java.io.Serializable; @PooledWeaver +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor public class Respawn extends Component implements Serializable { private float time; private int npcId; private OriginPos pos; - - public Respawn() { - } - - public Respawn(float time, int npcId, OriginPos pos) { - this.time = time; - this.npcId = npcId; - this.pos = pos; - } - - public float getTime() { - return time; - } - - public void setTime(float time) { - this.time = time; - } - - public int getNpcId() { - return npcId; - } - - public void setNpcId(int npcId) { - this.npcId = npcId; - } - - public OriginPos getPos() { - return pos; - } - - public void setPos(OriginPos pos) { - this.pos = pos; - } } diff --git a/server/src/server/systems/world/entity/combat/AbstractCombatSystem.java b/server/src/server/systems/world/entity/combat/AbstractCombatSystem.java index 79e0f605..287b288d 100644 --- a/server/src/server/systems/world/entity/combat/AbstractCombatSystem.java +++ b/server/src/server/systems/world/entity/combat/AbstractCombatSystem.java @@ -43,7 +43,7 @@ public int evasionPower(int userId) { float temp = tacticSkills + tacticSkills / 33f * userEntity.getAgility().getCurrentValue() * modifierSystem.of(EVASION, CharClass.of(userEntity)); power = (int) (temp + getLvlPower(userEntity.levelLevel())); } else if (userEntity.hasEvasionPower()) { - power = userEntity.getEvasionPower().value; + power = userEntity.getEvasionPower().getValue(); } return power; } @@ -61,7 +61,7 @@ public int weaponAttackPower(int userId) { float weaponModifier = modifierSystem.of(WEAPON, CharClass.of(userEntity)); power = getUserAttackPower(weaponModifier, weaponSkills, userEntity.getAgility().getCurrentValue(), userEntity.levelLevel()); } else if (userEntity.hasAttackPower()) { - power = userEntity.getAttackPower().value; + power = userEntity.getAttackPower().getValue(); } return power; } @@ -75,7 +75,7 @@ public int projectileAttackPower(int userId) { float modifier = modifierSystem.of(PROJECTILE, CharClass.of(userEntity)); power = getUserAttackPower(modifier, projectileSkills, userEntity.getAgility().getCurrentValue(), userEntity.levelLevel()); } else if (userEntity.hasAttackPower()) { - power = userEntity.getAttackPower().value; + power = userEntity.getAttackPower().getValue(); } return power; } diff --git a/server/src/server/systems/world/entity/training/CharacterTrainingSystem.java b/server/src/server/systems/world/entity/training/CharacterTrainingSystem.java index 81c4253e..8d97b7a9 100644 --- a/server/src/server/systems/world/entity/training/CharacterTrainingSystem.java +++ b/server/src/server/systems/world/entity/training/CharacterTrainingSystem.java @@ -76,7 +76,7 @@ private int getExp(int target, int effectiveDamage) { E npc = E(target); if (npc.hasNPC()) { Health health = npc.getHealth(); - int id = npc.getNPC().id; + int id = npc.getNPC().getId(); NPC npcInfo = npcSystem.getNpcs().get(id); exp = npcInfo.getGiveEXP() * effectiveDamage / health.max; } @@ -88,7 +88,7 @@ private int getGold(int entityId) { int gold = 0; E npc = E(entityId); if (npc.hasNPC()) { - int id = npc.getNPC().id; + int id = npc.getNPC().getId(); NPC npcInfo = npcSystem.getNpcs().get(id); gold = npcInfo.getGiveGLD(); }