Change how silly music is triggered
Can now specify in config what minimum percentage of silly entities trigger silly music in battle.
This commit is contained in:
parent
c2c19f6af2
commit
bb8ebf561b
5 changed files with 41 additions and 2 deletions
|
@ -181,7 +181,21 @@ public class ClientProxy extends CommonProxy
|
|||
|
||||
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())
|
||||
{
|
||||
|
|
|
@ -142,7 +142,7 @@ public class BattleManager
|
|||
// battle limit reached, cannot add to battle
|
||||
return true;
|
||||
}
|
||||
if(battle.hasCombatantInSideA(inBattle.getEntityId()))
|
||||
else if(battle.hasCombatantInSideA(inBattle.getEntityId()))
|
||||
{
|
||||
battle.addCombatantToSideB(notInBattle);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public class Config
|
|||
private Set<String> musicBattleTypes;
|
||||
private Set<String> musicSillyTypes;
|
||||
private boolean freezeCombatantsInBattle = false;
|
||||
private int sillyMusicThreshold = 40;
|
||||
|
||||
public Config(Logger logger)
|
||||
{
|
||||
|
@ -277,6 +278,18 @@ public class Config
|
|||
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();
|
||||
|
@ -521,4 +534,9 @@ public class Config
|
|||
{
|
||||
return freezeCombatantsInBattle;
|
||||
}
|
||||
|
||||
public int getSillyMusicThreshold()
|
||||
{
|
||||
return sillyMusicThreshold;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,4 +165,9 @@ public class TurnBasedMinecraftMod
|
|||
BATTLE_DECISION_DURATION_NANOSECONDS = BATTLE_DECISION_DURATION_NANO_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
public static Config getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
<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. -->
|
||||
|
|
Loading…
Reference in a new issue