Browse Source

Mobbase cannot be null.

combat-2
MagicBot 1 year ago
parent
commit
338110973d
  1. 53
      src/engine/objects/Mob.java

53
src/engine/objects/Mob.java

@ -76,19 +76,18 @@ public class Mob extends AbstractIntelligenceAgent {
public int lastPatrolPointIndex = 0; public int lastPatrolPointIndex = 0;
public long stopPatrolTime = 0; public long stopPatrolTime = 0;
public City guardedCity; public City guardedCity;
protected int dbID; //the database ID
public int loadID; public int loadID;
public float spawnRadius; public float spawnRadius;
//used by static mobs //used by static mobs
public int parentZoneUUID; public int parentZoneUUID;
public boolean isSiege = false;
protected int dbID; //the database ID
protected float statLat; protected float statLat;
protected float statLon; protected float statLon;
protected float statAlt; protected float statAlt;
private int currentID; private int currentID;
private int ownerUID = 0; //only used by pets private int ownerUID = 0; //only used by pets
private AbstractWorldObject fearedObject = null; private AbstractWorldObject fearedObject = null;
public boolean isSiege = false;
private long lastAttackTime = 0; private long lastAttackTime = 0;
private int lastMobPowerToken = 0; private int lastMobPowerToken = 0;
private HashMap<Integer, MobEquipment> equip = null; private HashMap<Integer, MobEquipment> equip = null;
@ -1059,7 +1058,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.playerAgroMap.clear(); this.playerAgroMap.clear();
if (this.behaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) if (this.behaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal())
this.spawnTime = (int) (-2.500 * ((Mob) this.npcOwner).building.getRank() + 22.5) * 60; this.spawnTime = (int) (-2.500 * this.npcOwner.building.getRank() + 22.5) * 60;
if (this.isPet()) { if (this.isPet()) {
@ -1149,7 +1148,7 @@ public class Mob extends AbstractIntelligenceAgent {
this.setHealth(this.healthMax); this.setHealth(this.healthMax);
if (this.building == null && this.npcOwner != null && ((Mob) this.npcOwner).behaviourType.ordinal() == MobBehaviourType.GuardCaptain.ordinal()) if (this.building == null && this.npcOwner != null && ((Mob) this.npcOwner).behaviourType.ordinal() == MobBehaviourType.GuardCaptain.ordinal())
this.building = ((Mob) this.npcOwner).building; this.building = this.npcOwner.building;
else if (this.building != null) else if (this.building != null)
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z); this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
@ -1748,33 +1747,31 @@ public class Mob extends AbstractIntelligenceAgent {
if (!this.isPet() && !isSiege) if (!this.isPet() && !isSiege)
Mob.mobMapByDBID.put(this.dbID, this); Mob.mobMapByDBID.put(this.dbID, this);
if (this.mobBase != null) { this.gridObjectType = GridObjectType.DYNAMIC;
this.gridObjectType = GridObjectType.DYNAMIC; this.healthMax = this.mobBase.getHealthMax();
this.healthMax = this.mobBase.getHealthMax(); this.manaMax = 0;
this.manaMax = 0; this.staminaMax = 0;
this.staminaMax = 0; this.setHealth(this.healthMax);
this.setHealth(this.healthMax); this.mana.set(this.manaMax);
this.mana.set(this.manaMax); this.stamina.set(this.staminaMax);
this.stamina.set(this.staminaMax);
if (this.contract == null) if (this.contract == null)
this.level = (short) this.mobBase.getLevel(); this.level = (short) this.mobBase.getLevel();
//set bonuses //set bonuses
this.bonuses = new PlayerBonuses(this);
//TODO set these correctly later this.bonuses = new PlayerBonuses(this);
this.rangeHandOne = 8;
this.rangeHandTwo = -1;
this.minDamageHandOne = 0;
this.maxDamageHandOne = 0;
this.minDamageHandTwo = 1;
this.maxDamageHandTwo = 4;
this.atrHandOne = 300;
this.defenseRating = (short) this.mobBase.getDefenseRating();
this.isActive = true;
} //TODO set these correctly later
this.rangeHandOne = 8;
this.rangeHandTwo = -1;
this.minDamageHandOne = 0;
this.maxDamageHandOne = 0;
this.minDamageHandTwo = 1;
this.maxDamageHandTwo = 4;
this.atrHandOne = 300;
this.defenseRating = (short) this.mobBase.getDefenseRating();
this.isActive = true;
// Configure parent zone adding this NPC to the // Configure parent zone adding this NPC to the
// zone collection // zone collection

Loading…
Cancel
Save