Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit 2cc1822

Browse files
committed
changed combo check (e.g. E-A combo is now successful with E-E-A)
1 parent c38b114 commit 2cc1822

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

src/combat/Combat.java

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,34 @@ private void attack() {
287287
status = 0;
288288
}
289289

290-
public void eval(Element[] streakElem) {
291-
// System.out.println(Arrays.toString(combo));
290+
// public void eval(Element[] streakElem) {
291+
// // System.out.println(Arrays.toString(combo));
292+
//
293+
// for (Combo combo : Combo.getCombosInUse()) {
294+
// if (Arrays.equals(streakElem, combo.getCombo())) {
295+
// info = "Combo completed!";
296+
// player.doAttack(monster.get(curFocus), combo);
297+
// streak.clear();
298+
// }
299+
// }
300+
//
301+
// }
302+
303+
private void eval(Element[] streakElem) {
292304

293305
for (Combo combo : Combo.getCombosInUse()) {
294-
if (Arrays.equals(streakElem, combo.getCombo())) {
295-
info = "Combo completed!";
296-
player.doAttack(monster.get(curFocus), combo);
297-
streak.clear();
306+
Element[] elements = combo.getCombo();
307+
if(streakElem.length >= elements.length){
308+
for(int i = 1; i <= elements.length; i++){
309+
if(elements[elements.length - i] != streakElem[streakElem.length - i]){
310+
break;
311+
}
312+
if(i == elements.length){
313+
info = "Combo completed!";
314+
player.doAttack(monster.get(curFocus), combo);
315+
streak.clear();
316+
}
317+
}
298318
}
299319
}
300320

0 commit comments

Comments
 (0)