wip: implement action tree and minimax for ai

This commit is contained in:
2021-06-07 03:06:33 +02:00
parent 81cbec5348
commit 7a5d9dca76
7 changed files with 274 additions and 36 deletions

View File

@ -8,15 +8,15 @@ import java.util.HashSet;
class Piece {
public final PieceType type;
public final EntityID id;
public EntityID id;
public final Stat hp;
public final Stat mp;
public final Stat ap;
public Stat hp;
public Stat mp;
public Stat ap;
public final HashSet<StoneType> inventory;
public HashSet<StoneType> inventory;
public final StoneType stone;
public StoneType stone;
public Piece(PieceType type) {
this.type = type;
@ -69,17 +69,13 @@ class Piece {
}
public Piece clone() {
return new Piece(
this.type,
this.id,
this.hp.getValue(),
this.hp.getMax(),
this.mp.getValue(),
this.mp.getMax(),
this.ap.getValue(),
this.ap.getMax(),
this.inventory.toArray(new StoneType[0]),
this.stone
);
Piece clone = new Piece(type);
clone.id = this.id != null ? this.id.clone() : null;
clone.hp = this.hp != null ? new Stat(StatType.HP, this.hp.getValue(), this.hp.getMax()) : null;
clone.mp = this.mp != null ? new Stat(StatType.MP, this.mp.getValue(), this.mp.getMax()) : null;
clone.ap = this.ap != null ? new Stat(StatType.AP, this.ap.getValue(), this.ap.getMax()) : null;
clone.inventory = this.inventory != null ? (HashSet<StoneType>)this.inventory.clone() : null;
clone.stone = this.stone;
return clone;
}
}