Hey guys, I am adding Godwars to this server right now and I am running into some problems with the bosses.
For example, General Graardor. I have his "size" set at 5, because anything lower than this he clips through the eastern wall. But since his size is 5, the closest he stands to a player is 5 tiles. In doing this, if I set his attack distance to 5, he can attack from an unnaturally long ways away. I need his attackDistance to be set at 2. How can I allow him to remain size 5 but be able to walk closer to players by himself? Here his definition:
Code:
{
"npcId": 2215,
"name": "General Graardor",
"size": 5,
"attackable": true,
"aggressive": true,
"combat-follow": 15,
"respawn": 130,
"hitpoints": 255,
"combat-level": 624,
"attack-level": 280,
"strength-level": 350,
"ranged-level": 350,
"magic-level": 80,
"defence-melee": 270,
"defence-ranged": 90,
"defence-magic": 298,
"max-hit": 60,
"attack-speed": 6,
"defence-anim": 7019,
"death-anim": 4321,
"attack-anim": 7018,
"examine": "That's a large General.",
"walk-radius": 8
},
And here is the combatMethod I made for him
Code:
public class GraardorCombatMethod implements CombatMethod {
private static final Animation MELEE_ATTACK_ANIMATION = new Animation(7018);
private static final Animation RANGE_ATTACK_ANIMATION = new Animation(7021);
private int attackDistance = 2;
private CombatType currentAttackType = CombatType.MELEE;
@Override
public CombatType getCombatType() {
return currentAttackType;
}
@Override
public boolean canAttack(Character character, Character target) {
return true;
}
@Override
public PendingHit[] getHits(Character character, Character target) {
return new PendingHit[]{new PendingHit(character, target, this, true, 1)};
}
@Override
public void preQueueAdd(Character character, Character target) {
if(currentAttackType == CombatType.RANGED) {
new Projectile(character, target, -1, 40, 55, 31, 43, 0).sendProjectile();
}
}
@Override
public int getAttackSpeed(Character character) {
return character.getBaseAttackSpeed();
}
@Override
public int getAttackDistance(Character character) {
return attackDistance;
}
@Override
public void startAnimation(Character character) {
if(currentAttackType == CombatType.MELEE) {
character.performAnimation(MELEE_ATTACK_ANIMATION);
} else if(currentAttackType == CombatType.RANGED) {
character.performAnimation(RANGE_ATTACK_ANIMATION);
}
}
@Override
public void finished(Character character) {
currentAttackType = CombatType.MELEE;
attackDistance = 2;
if(Misc.getRandom(100) <= 10) {
currentAttackType = CombatType.RANGED;
attackDistance = 100;
}
}
@Override
public void handleAfterHitEffects(PendingHit hit) {
if(!hit.isAccurate() || hit.getTarget() == null || !hit.getTarget().isPlayer()) {
return;
}
}
}