Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adjust to query difficulty
Browse files Browse the repository at this point in the history
Raycoms committed Dec 17, 2024
1 parent 7c07155 commit d794062
Showing 4 changed files with 17 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -400,4 +400,14 @@ public BlockPos getSpawnPos()
{
return this.spawnPos;
}

/**
* Get the mobs difficulty
*
* @return difficulty
*/
public double getDifficulty()
{
return 1;
}
}
Original file line number Diff line number Diff line change
@@ -515,11 +515,7 @@ public void initStatsFor(final double baseHealth, final double difficulty, final
}
}

/**
* Get the mobs difficulty
*
* @return difficulty
*/
@Override
public double getDifficulty()
{
return difficulty;
Original file line number Diff line number Diff line change
@@ -72,14 +72,7 @@ protected void doAttack(final LivingEntity target)
@Override
protected double getAttackDistance()
{
if (user instanceof AbstractEntityMinecoloniesRaider raiderMob)
{
return raiderMob.getDifficulty() < EXTENDED_REACH_DIFFICULTY ? MIN_DISTANCE_FOR_ATTACK : MIN_DISTANCE_FOR_ATTACK + EXTENDED_REACH;
}
else
{
return MIN_DISTANCE_FOR_ATTACK;
}
return user.getDifficulty() < EXTENDED_REACH_DIFFICULTY ? MIN_DISTANCE_FOR_ATTACK : MIN_DISTANCE_FOR_ATTACK + EXTENDED_REACH;
}

@Override
@@ -91,18 +84,8 @@ protected int getAttackDelay()
@Override
protected PathResult moveInAttackPosition(final LivingEntity target)
{
if (user instanceof AbstractEntityMinecoloniesRaider raiderMob)
{
return user.getNavigation()
.moveToXYZ(target.getX(), target.getY(), target.getZ(), raiderMob.getDifficulty() < ADD_SPEED_DIFFICULTY ? BASE_COMBAT_SPEED : BASE_COMBAT_SPEED * BONUS_SPEED);

}
else
{
return user.getNavigation()
.moveToXYZ(target.getX(), target.getY(), target.getZ(), BASE_COMBAT_SPEED);

}
return user.getNavigation()
.moveToXYZ(target.getX(), target.getY(), target.getZ(), user.getDifficulty() < ADD_SPEED_DIFFICULTY ? BASE_COMBAT_SPEED : BASE_COMBAT_SPEED * BONUS_SPEED);
}

@Override
Original file line number Diff line number Diff line change
@@ -112,15 +112,11 @@ protected void doAttack(final LivingEntity target)
arrowEntity.setBaseDamage(10);
}

if (user instanceof AbstractEntityMinecoloniesRaider raiderMob)
if (user.getDifficulty() > ARROW_PIERCE_DIFFICULTY)
{
if (raiderMob.getDifficulty() > ARROW_PIERCE_DIFFICULTY)
{
arrowEntity.setPierceLevel((byte) 2);
}
arrowEntity.setPierceLevel((byte) 2);
}


// Shoot arrow
CombatUtils.shootArrow(arrowEntity, target, 10.0f);

@@ -148,14 +144,7 @@ private double getRandomPitch()
@Override
protected double getAttackDistance()
{
if (user instanceof AbstractEntityMinecoloniesRaider raiderMob)
{
return MAX_ATTACK_DISTANCE * Math.max(raiderMob.getDifficulty(), 2.0d);
}
else
{
return MAX_ATTACK_DISTANCE * 2;
}
return MAX_ATTACK_DISTANCE * Math.max(user.getDifficulty(), 2.0d);
}

@Override

0 comments on commit d794062

Please sign in to comment.