private void checkBattleTypes()
{
- if(battleMusicCount <= 1 && sillyMusicCount > 0)
+ float percentage = 0.0f;
+ if(sillyMusicCount == 0 && battleMusicCount == 0)
+ {
+ percentage = 0.0f;
+ }
+ else if(battleMusicCount == 0)
+ {
+ percentage = 100.0f;
+ }
+ else
+ {
+ percentage = 100.0f * (float)sillyMusicCount / (float)(sillyMusicCount + battleMusicCount);
+ }
+
+ if(percentage >= (float)TurnBasedMinecraftMod.getConfig().getSillyMusicThreshold())
{
if(battleMusic.isPlaying())
{
// battle limit reached, cannot add to battle
return true;
}
- if(battle.hasCombatantInSideA(inBattle.getEntityId()))
+ else if(battle.hasCombatantInSideA(inBattle.getEntityId()))
{
battle.addCombatantToSideB(notInBattle);
}
private Set<String> musicBattleTypes;
private Set<String> musicSillyTypes;
private boolean freezeCombatantsInBattle = false;
+ private int sillyMusicThreshold = 40;
public Config(Logger logger)
{
TurnBasedMinecraftMod.setBattleDurationSeconds(TurnBasedMinecraftMod.BATTLE_DECISION_DURATION_NANO_DEFAULT / 1000000000L);
}
}
+ else if(xmlReader.getLocalName().equals("SillyMusicThreshold"))
+ {
+ sillyMusicThreshold = Integer.parseInt(xmlReader.getElementText());
+ if(sillyMusicThreshold < 0)
+ {
+ sillyMusicThreshold = 0;
+ }
+ else if(sillyMusicThreshold > 100)
+ {
+ sillyMusicThreshold = 100;
+ }
+ }
else if(xmlReader.getLocalName().equals("EntityEntry"))
{
EntityInfo eInfo = new EntityInfo();
{
return freezeCombatantsInBattle;
}
+
+ public int getSillyMusicThreshold()
+ {
+ return sillyMusicThreshold;
+ }
}
BATTLE_DECISION_DURATION_NANOSECONDS = BATTLE_DECISION_DURATION_NANO_MAX;
}
}
+
+ public static Config getConfig()
+ {
+ return config;
+ }
}
<MinimumHitPercentage>4</MinimumHitPercentage>
<!-- Number of seconds to wait in battle for all players to make a decision. Minimum of 5 and maximum of 60. -->
<BattleTurnTimeSeconds>15</BattleTurnTimeSeconds>
+ <!-- Minimum percentage of silly entities in battle to use silly music -->
+ <SillyMusicThreshold>40</SillyMusicThreshold>
<!-- Battle stats for entities should be specified here. If an entity is not listed it cannot enter battle. -->
<!-- Name: The full class name of an entity. -->