001package com.fs.starfarer.api.impl.campaign.shared; 002 003import java.util.ArrayList; 004import java.util.List; 005 006import com.fs.starfarer.api.impl.campaign.ids.Factions; 007 008public class PersonBountyEventData { 009 010 private List<String> participatingFactions = new ArrayList<String>(); 011 012 private int level = 0; 013 private int successesThisLevel = 0; 014 015 public PersonBountyEventData() { 016 addParticipatingFaction(Factions.HEGEMONY); 017 addParticipatingFaction(Factions.DIKTAT); 018 addParticipatingFaction(Factions.LUDDIC_CHURCH); 019 addParticipatingFaction(Factions.TRITACHYON); 020 addParticipatingFaction(Factions.INDEPENDENT); 021 addParticipatingFaction(Factions.PERSEAN); 022 } 023 024 public void reportSuccess() { 025 successesThisLevel++; 026 027 int threshold = getThresholdForLevel(level); 028 if (successesThisLevel >= threshold) { 029 level++; 030 successesThisLevel = 0; 031 } 032 if (level > 10) level = 10; 033 } 034 035 public int getThresholdForLevel(int level) { 036 if (level == 0) return 2; 037 if (level == 1) return 2; 038 if (level == 2) return 2; 039 040 if (level == 3) return 3; 041 if (level == 4) return 3; 042 if (level == 5) return 3; 043 if (level == 6) return 3; 044 045 if (level == 7) return 4; 046 if (level == 8) return 5; 047 if (level == 9) return 6; 048 049 return 6; 050 } 051 052 public int getLevel() { 053 //if (true) return 10; 054 return level; 055 } 056 057 public void setLevel(int level) { 058 this.level = level; 059 } 060 061 public void setSuccessesThisLevel(int successesThisLevel) { 062 this.successesThisLevel = successesThisLevel; 063 } 064 065 public List<String> getParticipatingFactions() { 066 return participatingFactions; 067 } 068 069 public void addParticipatingFaction(String factionId) { 070 participatingFactions.add(factionId); 071 } 072 073 public void removeParticipatingFaction(String factionId) { 074 participatingFactions.remove(factionId); 075 } 076 077 public boolean isParticipating(String factionId) { 078 return participatingFactions.contains(factionId); 079 } 080} 081