Browse Source

hit roll formula fixed

lakebane-strongholds
FatBoy-DOTC 4 months ago
parent
commit
1a13f3f096
  1. 17
      src/engine/gameManager/CombatManager.java
  2. 16
      src/engine/gameManager/PowersManager.java

17
src/engine/gameManager/CombatManager.java

@ -663,15 +663,24 @@ public enum CombatManager { @@ -663,15 +663,24 @@ public enum CombatManager {
//int roll = ThreadLocalRandom.current().nextInt(100);
DeferredPowerJob dpj = null;
int atrRoll = ThreadLocalRandom.current().nextInt(ac.level * 10,(int)atr);
int max = (int)atr;
int min = (int)(max * 0.5f);
if(max < min){
min = max - 1;
}
int atrRoll = ThreadLocalRandom.current().nextInt(min,max);
int defRoll = 0;
if(AbstractCharacter.IsAbstractCharacter(target)){
AbstractCharacter tar = (AbstractCharacter) target;
defRoll = ThreadLocalRandom.current().nextInt(tar.level * 10,tar.defenseRating);
max = tar.defenseRating;
min = (int)(max * 0.5f);
if(max < min){
min = max - 1;
}
defRoll = ThreadLocalRandom.current().nextInt(min,max);
}
if (atrRoll < defRoll) {
if (atrRoll > defRoll) {
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
updateAttackTimers((PlayerCharacter) ac, target, true);

16
src/engine/gameManager/PowersManager.java

@ -2329,13 +2329,23 @@ public enum PowersManager { @@ -2329,13 +2329,23 @@ public enum PowersManager {
//int roll = ThreadLocalRandom.current().nextInt(100);
boolean disable = true;
int atrRoll = ThreadLocalRandom.current().nextInt(pc.level * 10,(int)atr);
int max = (int)atr;
int min = (int)(max * 0.5f);
if(max < min){
min = max - 1;
}
int atrRoll = ThreadLocalRandom.current().nextInt(min,max);
int defRoll = 0;
if(AbstractCharacter.IsAbstractCharacter(awo)){
AbstractCharacter tar = (AbstractCharacter) awo;
defRoll = ThreadLocalRandom.current().nextInt(tar.level * 10,tar.defenseRating);
max = tar.defenseRating;
min = (int)(max * 0.5f);
if(max < min){
min = max - 1;
}
defRoll = ThreadLocalRandom.current().nextInt(min,max);
}
if (atrRoll < defRoll) {
if (atrRoll > defRoll) {
// Hit, check if dodge kicked in
if (awo instanceof AbstractCharacter) {
AbstractCharacter tarAc = (AbstractCharacter) awo;

Loading…
Cancel
Save