Include situations where the game forces the battle to be over.

dev
sigonasr2 8 years ago
parent 7aa7790a5e
commit f7c89584fe
  1. 24
      src/sig/modules/TouhouMotherModule.java

@ -59,6 +59,7 @@ public class TouhouMotherModule extends Module implements ActionListener{
int data_display_toggle=0; int data_display_toggle=0;
int data_display_id=0; int data_display_id=0;
boolean hasDied=false; boolean hasDied=false;
boolean battleEnds=false;
Button updateButton; 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")) { if (real_gameData!=null && real_gameData.contains("sad thing that your adventures")) {
hasDied=true; 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) { private int GetLastAttacker(String data) {
@ -309,26 +314,29 @@ public class TouhouMotherModule extends Module implements ActionListener{
public void KillBossData() { public void KillBossData() {
if ((real_bossHP==SemiValidInteger.ERROR_VALUE && if ((real_bossHP==SemiValidInteger.ERROR_VALUE &&
currentBoss!=null) || hasDied) { currentBoss!=null) || hasDied || battleEnds) {
if (bossImage!=null) { if (bossImage!=null) {
bossImage.flush(); bossImage.flush();
} }
int diff = lastBossHP; int diff = lastBossHP;
if (!hasDied) { if (!hasDied) {
if (lastCharacterAttacked>=0) { if (!battleEnds) {
characterDatabase[lastCharacterAttacked].addCurrentDamage(diff); if (lastCharacterAttacked>=0) {
characterDatabase[lastCharacterAttacked].addTotalDamage(diff); characterDatabase[lastCharacterAttacked].addCurrentDamage(diff);
characterDatabase[lastCharacterAttacked].addDamageTurns(1); characterDatabase[lastCharacterAttacked].addTotalDamage(diff);
characterDatabase[lastCharacterAttacked].setLargestHit(diff); characterDatabase[lastCharacterAttacked].addDamageTurns(1);
characterDatabase[lastCharacterAttacked].setLargestHit(diff);
}
TimeRecord.setRecord(currentBoss.getID(), secondsCount);
TimeRecord.SaveRecordDatabase();
} }
TimeRecord.setRecord(currentBoss.getID(), secondsCount);
TimeRecord.SaveRecordDatabase();
} else { } else {
for (TouhouMotherCharacterData tmcd : characterDatabase) { for (TouhouMotherCharacterData tmcd : characterDatabase) {
tmcd.resetAllData(); tmcd.resetAllData();
} }
hasDied=false; hasDied=false;
} }
battleEnds=false;
bossMaxHP=SemiValidInteger.ERROR_VALUE; bossMaxHP=SemiValidInteger.ERROR_VALUE;
currentBoss=null; currentBoss=null;
lastBossHP=0; lastBossHP=0;

Loading…
Cancel
Save