combat formula and steal

This commit is contained in:
2025-01-20 16:08:54 -06:00
parent 05e542215d
commit 69bf6ef8cd
2 changed files with 9 additions and 5 deletions
+6 -4
View File
@@ -1472,15 +1472,17 @@ public enum CombatManager {
public static boolean LandHit(int C5, int D5){ public static boolean LandHit(int C5, int D5){
float chance = (C5-((C5+D5)*.315f)) / ((D5-((C5+D5)*.315f)) + (C5-((C5+D5)*.315f))); float chance = (C5-((C5+D5) * 0.315f)) / ((D5-((C5+D5) * 0.315f)) + (C5-((C5+D5) * 0.315f)));
int convertedChance = Math.round(chance * 100); float convertedChance = chance * 100;
//convertedChance = Math.max(5, Math.min(95, convertedChance));
int roll = ThreadLocalRandom.current().nextInt(101); int roll = ThreadLocalRandom.current().nextInt(101);
if(roll < 5)//always 5% chance ot miss if(roll <= 5)//always 5% chance to miss
return false; return false;
if(roll >= 95)//always 5% chance to hit
return true;
return roll <= convertedChance; return roll <= convertedChance;
} }
@@ -187,8 +187,10 @@ public class StealPowerAction extends AbstractPowerAction {
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
//update thief's inventory //update thief's inventory
if (sourcePlayer.getCharItemManager() != null) if (sourcePlayer.getCharItemManager() != null) {
sourcePlayer.getCharItemManager().updateInventory(); sourcePlayer.getCharItemManager().updateInventory();
sourcePlayer.cancelOnAttackSwing();
}
//update victims inventory //update victims inventory
if (owner.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { if (owner.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {