bug fixes and add MinimumHitPercentage to config
This commit is contained in:
parent
0ea3dfd98a
commit
d70d0c2d38
4 changed files with 26 additions and 7 deletions
|
@ -550,6 +550,9 @@ public class Battle
|
|||
next = turnOrderQueue.poll();
|
||||
continue;
|
||||
}
|
||||
|
||||
next.remainingDefenses = 0;
|
||||
|
||||
switch(next.decision)
|
||||
{
|
||||
case UNDECIDED:
|
||||
|
@ -580,9 +583,9 @@ public class Battle
|
|||
{
|
||||
hitChance -= target.entityInfo.evasion;
|
||||
}
|
||||
if(hitChance < 1)
|
||||
if(hitChance < TurnBasedMinecraftMod.config.getMinimumHitPercentage())
|
||||
{
|
||||
hitChance = 1;
|
||||
hitChance = TurnBasedMinecraftMod.config.getMinimumHitPercentage();
|
||||
}
|
||||
if((int)(Math.random() * 100) < hitChance)
|
||||
{
|
||||
|
@ -667,9 +670,9 @@ public class Battle
|
|||
{
|
||||
hitChance -= target.entityInfo.evasion;
|
||||
}
|
||||
if(hitChance < 1)
|
||||
if(hitChance < TurnBasedMinecraftMod.config.getMinimumHitPercentage())
|
||||
{
|
||||
hitChance = 1;
|
||||
hitChance = TurnBasedMinecraftMod.config.getMinimumHitPercentage();
|
||||
}
|
||||
if((int)(Math.random() * 100) < hitChance)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@ public class Config
|
|||
private int defenseDuration = 1;
|
||||
private int fleeGoodProbability = 90;
|
||||
private int fleeBadProbability = 40;
|
||||
private int minimumHitPercentage = 1;
|
||||
|
||||
public Config(Logger logger)
|
||||
{
|
||||
|
@ -206,6 +207,14 @@ public class Config
|
|||
{
|
||||
fleeBadProbability = Integer.parseInt(xmlReader.getElementText());
|
||||
}
|
||||
else if(xmlReader.getLocalName().equals("MinimumHitPercentage"))
|
||||
{
|
||||
minimumHitPercentage = Integer.parseInt(xmlReader.getElementText());
|
||||
if(minimumHitPercentage < 1)
|
||||
{
|
||||
minimumHitPercentage = 1;
|
||||
}
|
||||
}
|
||||
else if(xmlReader.getLocalName().equals("EntityStats"))
|
||||
{
|
||||
do
|
||||
|
@ -455,4 +464,9 @@ public class Config
|
|||
{
|
||||
return ignoreBattleTypes.contains(type);
|
||||
}
|
||||
|
||||
public int getMinimumHitPercentage()
|
||||
{
|
||||
return minimumHitPercentage;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,12 +327,12 @@ public class PacketBattleMessage implements IMessage
|
|||
if(message.amount != 0)
|
||||
{
|
||||
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(
|
||||
to + " switched to a different item!"));
|
||||
from + " switched to a different item!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(
|
||||
to + " switched to a different item but failed because it was invalid!"));
|
||||
from + " switched to a different item but failed because it was invalid!"));
|
||||
}
|
||||
break;
|
||||
case WAS_AFFECTED:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<TurnBasedMinecraftConfig>
|
||||
<!-- If the mod has a newer version config, it will rename the existing config and place the new config -->
|
||||
<Version>1</Version>
|
||||
<Version>2</Version>
|
||||
<!-- Types that will not initiate battle with player. They are listed as "Category" per EntiytStats entity.
|
||||
Note that items listed in "IgnoreBattleTypes" and "Category" are converted to lowercase before being compared. -->
|
||||
<IgnoreBattleTypes>
|
||||
|
@ -19,6 +19,8 @@
|
|||
<!-- Probability of escaping battle. If entity's speed is greater than the enemy team's speediest entity, then good probability is used. -->
|
||||
<FleeGoodProbability>90</FleeGoodProbability>
|
||||
<FleeBadProbability>40</FleeBadProbability>
|
||||
<!-- Minimum hit percentage for every entity. If less than 1, it will be stored as 1 anyways. -->
|
||||
<MinimumHitPercentage>4</MinimumHitPercentage>
|
||||
<!-- Battle stats for entities should be specified here. If an entity is not listed it cannot enter battle. -->
|
||||
<EntityStats>
|
||||
<!-- AttackPower: How much damage an entity does per attack. Usually has a "Probability" attribute between 0 and 100. Also may have a "Variance" attribute that varies the attack power by the specified amount randomly. -->
|
||||
|
|
Loading…
Reference in a new issue