add tall decay type

This commit is contained in:
James 2024-04-21 12:57:21 +01:00
parent 7f9ca47b84
commit 89b01891b4
2 changed files with 34 additions and 5 deletions

View file

@ -8,10 +8,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;
import com.monjaro.gamejam.SegmentUI;
import com.monjaro.gamejam.segment.DualSegment;
import com.monjaro.gamejam.segment.KinSegment;
import com.monjaro.gamejam.segment.OlympicSegment;
import com.monjaro.gamejam.segment.Segment;
import com.monjaro.gamejam.segment.*;
import java.util.ArrayList;
import java.util.List;
@ -41,7 +38,7 @@ public class Game extends ApplicationAdapter {
segUi = new SegmentUI();
ui = new UI(this, 50, 280);
round = new Round(List.of(new OlympicSegment(1), new OlympicSegment(3), new KinSegment(3), new DualSegment(false)), List.of(new ParityDecay(true)), 5);
round = new Round(List.of(new OlympicSegment(1), new OlympicSegment(3), new KinSegment(3), new DualSegment(false)), List.of(new TallDecay()), 5);
Face.setBlankFaceSprite(new Texture("blank_die_face.png"));
Face.setPipSprite(new Texture("pip.png"));

View file

@ -0,0 +1,32 @@
package com.monjaro.gamejam.segment;
import com.monjaro.gamejam.main.Decay;
import com.monjaro.gamejam.main.Die;
import java.util.ArrayList;
import java.util.List;
public class TallDecay extends Decay {
public TallDecay() {
description = "All used dice with HIGHEST value decay.";
}
@Override
public List<Die> getDecayed(List<Die> dice) {
int highestValue = -1;
List<Die> targets = new ArrayList<>();
for (Die die : dice) {
if (die.isFaceBlank()) continue;
if (die.getFaceValue() < highestValue) continue;
targets.add(die);
highestValue = die.getFaceValue();
}
return targets;
}
}