Compare commits
No commits in common. "d69376c110df8da11ca994eeac8096ec8b40ad0c" and "adb0a497112f842434b2fe1adf62a5ae5874a929" have entirely different histories.
d69376c110
...
adb0a49711
23
build.gradle
23
build.gradle
@ -2,7 +2,6 @@ plugins {
|
||||
id 'java'
|
||||
id 'idea'
|
||||
id "org.sonarqube" version "3.2.0"
|
||||
id 'jacoco'
|
||||
}
|
||||
|
||||
repositories {
|
||||
@ -18,28 +17,6 @@ test {
|
||||
maxParallelForks = 1
|
||||
}
|
||||
|
||||
jacocoTestReport {
|
||||
reports {
|
||||
html.enabled true
|
||||
xml.enabled true
|
||||
xml.destination file("${buildDir}/reports/jacoco.xml")
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withType(JacocoPlugin) {
|
||||
tasks["test"].finalizedBy 'jacocoTestReport'
|
||||
}
|
||||
|
||||
sonarqube {
|
||||
properties {
|
||||
property "sonar.java.coveragePlugin", "jacoco"
|
||||
property "sonar.host.url", "https://sonarqube.yandrik.dev"
|
||||
property "sonar.coverage.jacoco.xmlReportPath", "${buildDir}/reports/jacoco.xml"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.4'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.4'
|
||||
|
@ -452,15 +452,6 @@ public class GameLogic {
|
||||
.withOriginField(data.originField)
|
||||
.withTargetField(data.targetField)
|
||||
.buildCharacterEvent());
|
||||
for(Entity entity: state.entities.findByPosition(data.targetField)) {
|
||||
if(entity instanceof InfinityStone) {
|
||||
result.add(new EventBuilder(EventType.DestroyedEntityEvent)
|
||||
.withTargetField(data.targetField)
|
||||
.withTargetEntity(entity.id)
|
||||
.buildEntityEvent());
|
||||
break; //we should only have one entity per field anyways
|
||||
}
|
||||
}
|
||||
}
|
||||
case MindStone -> {
|
||||
EntityType target = data.originEntity.type == EntityType.P1 ? EntityType.P2 : EntityType.P1;
|
||||
@ -499,15 +490,11 @@ public class GameLogic {
|
||||
case PowerStone -> {
|
||||
Character origin = (Character)state.entities.findEntity(data.originEntity);
|
||||
int dmg = (int)Math.round(origin.hp.getMax() * 0.1);
|
||||
//this is ugly ... but also easy to understand
|
||||
int hp1 = origin.hp.getValue();
|
||||
int hp2 = Math.max(1, origin.hp.getValue() - dmg);
|
||||
int actualDmg = hp1 - hp2;
|
||||
if(actualDmg > 0) {
|
||||
if(origin.hp.getValue() != 1 && dmg > 0) {
|
||||
result.add(new EventBuilder(EventType.TakenDamageEvent)
|
||||
.withTargetEntity(data.originEntity)
|
||||
.withTargetField(data.originField)
|
||||
.withAmount(actualDmg)
|
||||
.withAmount(dmg)
|
||||
.buildEntityEvent());
|
||||
}
|
||||
result.add(new EventBuilder(EventType.TakenDamageEvent)
|
||||
|
@ -120,27 +120,15 @@ class MessageValidationUtilityTest {
|
||||
var characterConfig = new CharacterConfig();
|
||||
|
||||
assertThat(ValidationUtility.validate(characterConfig).get())
|
||||
.isIn("characters mus not be empty", "characters darf nicht leer sein");
|
||||
// .isEqualTo("characters must not be empty");
|
||||
.isEqualTo("characters must not be empty");
|
||||
|
||||
characterConfig.characters = new CharacterProperties[] {racoon, quicksilver, hulk, loki, silversurfer};
|
||||
|
||||
var results = ValidationUtility.validate(characterConfig).get();
|
||||
assertThat(results.contains("characters has less than 24 characters") ||
|
||||
results.contains("characters hat weniger als 24 characters"))
|
||||
.isTrue();
|
||||
|
||||
assertThat(results.contains("characters[4].rangedDamage must be greater than 0") ||
|
||||
results.contains("characters[4].rangedDamage muss größer als 0 sein"))
|
||||
.isTrue();
|
||||
|
||||
assertThat(results.contains("characters[4].name must not be empty") ||
|
||||
results.contains("characters[4].name darf nicht leer sein"))
|
||||
.isTrue();
|
||||
|
||||
assertThat(results.contains("characters[4].meleeDamage must be greater than 0") ||
|
||||
results.contains("characters[4].meleeDamage muss größer als 0 sein"))
|
||||
.isTrue();
|
||||
assertThat(ValidationUtility.validate(characterConfig).get())
|
||||
.contains("characters has less than 24 characters",
|
||||
"characters[4].rangedDamage must be greater than 0",
|
||||
"characters[4].name must not be empty",
|
||||
"characters[4].meleeDamage must be greater than 0");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user