From f7c89584fed8241c468131cf38616b35b157cb1b Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 26 Mar 2017 03:05:35 -0500 Subject: [PATCH] Include situations where the game forces the battle to be over. --- src/sig/modules/TouhouMotherModule.java | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/sig/modules/TouhouMotherModule.java b/src/sig/modules/TouhouMotherModule.java index 9e12ef0..95d86da 100644 --- a/src/sig/modules/TouhouMotherModule.java +++ b/src/sig/modules/TouhouMotherModule.java @@ -59,6 +59,7 @@ public class TouhouMotherModule extends Module implements ActionListener{ int data_display_toggle=0; int data_display_id=0; boolean hasDied=false; + boolean battleEnds=false; Button updateButton; @@ -235,6 +236,10 @@ public class TouhouMotherModule extends Module implements ActionListener{ if (real_gameData!=null && real_gameData.contains("sad thing that your adventures")) { hasDied=true; } + if (real_gameData!=null && (real_gameData.contains("you should see...") || + real_gameData.contains("KA-75 fired its") || real_gameData.contains("The battle was lost"))) { + battleEnds=true; + } } private int GetLastAttacker(String data) { @@ -309,26 +314,29 @@ public class TouhouMotherModule extends Module implements ActionListener{ public void KillBossData() { if ((real_bossHP==SemiValidInteger.ERROR_VALUE && - currentBoss!=null) || hasDied) { + currentBoss!=null) || hasDied || battleEnds) { if (bossImage!=null) { bossImage.flush(); } int diff = lastBossHP; if (!hasDied) { - if (lastCharacterAttacked>=0) { - characterDatabase[lastCharacterAttacked].addCurrentDamage(diff); - characterDatabase[lastCharacterAttacked].addTotalDamage(diff); - characterDatabase[lastCharacterAttacked].addDamageTurns(1); - characterDatabase[lastCharacterAttacked].setLargestHit(diff); + if (!battleEnds) { + if (lastCharacterAttacked>=0) { + characterDatabase[lastCharacterAttacked].addCurrentDamage(diff); + characterDatabase[lastCharacterAttacked].addTotalDamage(diff); + characterDatabase[lastCharacterAttacked].addDamageTurns(1); + characterDatabase[lastCharacterAttacked].setLargestHit(diff); + } + TimeRecord.setRecord(currentBoss.getID(), secondsCount); + TimeRecord.SaveRecordDatabase(); } - TimeRecord.setRecord(currentBoss.getID(), secondsCount); - TimeRecord.SaveRecordDatabase(); } else { for (TouhouMotherCharacterData tmcd : characterDatabase) { tmcd.resetAllData(); } hasDied=false; } + battleEnds=false; bossMaxHP=SemiValidInteger.ERROR_VALUE; currentBoss=null; lastBossHP=0;