mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 08:39:11 +00:00
Rename Character to Mob; make Entity an abstract class.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package org.apollo.game.action;
|
||||
|
||||
import org.apollo.game.model.Character;
|
||||
import org.apollo.game.model.Mob;
|
||||
import org.apollo.game.scheduling.ScheduledTask;
|
||||
|
||||
/**
|
||||
@@ -12,7 +12,7 @@ import org.apollo.game.scheduling.ScheduledTask;
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public abstract class Action<T extends Character> extends ScheduledTask {
|
||||
public abstract class Action<T extends Mob> extends ScheduledTask {
|
||||
|
||||
/**
|
||||
* The character performing the action.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.apollo.game.action;
|
||||
|
||||
import org.apollo.game.model.Character;
|
||||
import org.apollo.game.model.Mob;
|
||||
import org.apollo.game.model.Position;
|
||||
|
||||
/**
|
||||
@@ -9,7 +9,7 @@ import org.apollo.game.model.Position;
|
||||
* @author Blake
|
||||
* @author Graham
|
||||
*/
|
||||
public abstract class DistancedAction<T extends Character> extends Action<T> {
|
||||
public abstract class DistancedAction<T extends Mob> extends Action<T> {
|
||||
|
||||
/**
|
||||
* The delay once the threshold is reached.
|
||||
|
||||
@@ -1,25 +1,31 @@
|
||||
package org.apollo.game.model;
|
||||
|
||||
|
||||
/**
|
||||
* Represents an in-game entity, such as a character, object, projectile etc.
|
||||
*
|
||||
* @author Major
|
||||
*/
|
||||
public interface Entity {
|
||||
public abstract class Entity {
|
||||
|
||||
/**
|
||||
* The position of the entity.
|
||||
*/
|
||||
protected Position position;
|
||||
|
||||
/**
|
||||
* Gets the {@link EntityType} of this entity.
|
||||
*
|
||||
* @return The type.
|
||||
*/
|
||||
public EntityType getEntityType();
|
||||
public abstract EntityType getEntityType();
|
||||
|
||||
/**
|
||||
* Gets the position of this entity.
|
||||
*
|
||||
* @return The position.
|
||||
*/
|
||||
public Position getPosition();
|
||||
public Position getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,11 +13,11 @@ import org.apollo.game.sync.block.SynchronizationBlockSet;
|
||||
import org.apollo.util.CharacterRepository;
|
||||
|
||||
/**
|
||||
* A {@link Character} is a living creature in the world, such as a player or NPC.
|
||||
* A {@link Mob} is a living entity in the world, such as a player or NPC.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public abstract class Character implements Entity {
|
||||
public abstract class Mob extends Entity {
|
||||
|
||||
/**
|
||||
* The character's current action.
|
||||
@@ -70,11 +70,6 @@ public abstract class Character implements Entity {
|
||||
*/
|
||||
private final List<Player> localPlayers = new ArrayList<Player>();
|
||||
|
||||
/**
|
||||
* The current position of this character.
|
||||
*/
|
||||
private Position position;
|
||||
|
||||
/**
|
||||
* The second direction.
|
||||
*/
|
||||
@@ -100,7 +95,7 @@ public abstract class Character implements Entity {
|
||||
*
|
||||
* @param position The initial position of this character.
|
||||
*/
|
||||
public Character(Position position) {
|
||||
public Mob(Position position) {
|
||||
this.position = position;
|
||||
init();
|
||||
}
|
||||
@@ -286,8 +281,8 @@ public abstract class Character implements Entity {
|
||||
/**
|
||||
* Sends an {@link Event} to either:
|
||||
* <ul>
|
||||
* <li>The client if this {@link Character} is a {@link Player}.</li>
|
||||
* <li>The AI routines if this {@link Character} is an NPC</li>
|
||||
* <li>The client if this {@link Mob} is a {@link Player}.</li>
|
||||
* <li>The AI routines if this {@link Mob} is an NPC</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param event The event.
|
||||
@@ -4,11 +4,11 @@ import org.apollo.game.event.Event;
|
||||
import org.apollo.game.model.def.NpcDefinition;
|
||||
|
||||
/**
|
||||
* An {@link Npc} is a {@link Character} that is not being controlled by a player.
|
||||
* An {@link Npc} is a {@link Mob} that is not being controlled by a player.
|
||||
*
|
||||
* @author Major
|
||||
*/
|
||||
public class Npc extends Character {
|
||||
public class Npc extends Mob {
|
||||
|
||||
/**
|
||||
* This npc's definition.
|
||||
|
||||
@@ -28,11 +28,11 @@ import org.apollo.security.PlayerCredentials;
|
||||
import org.apollo.util.Point;
|
||||
|
||||
/**
|
||||
* A {@link Player} is a {@link Character} that a user is controlling.
|
||||
* A {@link Player} is a {@link Mob} that a user is controlling.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public final class Player extends Character {
|
||||
public final class Player extends Mob {
|
||||
|
||||
/**
|
||||
* An enumeration with the different privilege levels a player can have.
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Deque;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* A queue of {@link Direction}s which a {@link Character} will follow.
|
||||
* A queue of {@link Direction}s which a {@link Mob} will follow.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
@@ -53,7 +53,7 @@ public final class WalkingQueue {
|
||||
/**
|
||||
* The character whose walking queue this is.
|
||||
*/
|
||||
private final Character character;
|
||||
private final Mob character;
|
||||
|
||||
/**
|
||||
* The old queue of directions.
|
||||
@@ -75,7 +75,7 @@ public final class WalkingQueue {
|
||||
*
|
||||
* @param character The character.
|
||||
*/
|
||||
public WalkingQueue(Character character) {
|
||||
public WalkingQueue(Mob character) {
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,18 +10,13 @@ import org.apollo.game.model.def.ObjectDefinition;
|
||||
*
|
||||
* @author Major
|
||||
*/
|
||||
public final class GameObject implements Entity {
|
||||
public final class GameObject extends Entity {
|
||||
|
||||
/**
|
||||
* The object definition.
|
||||
*/
|
||||
private final ObjectDefinition definition;
|
||||
|
||||
/**
|
||||
* The position of the game object.
|
||||
*/
|
||||
private final Position position;
|
||||
|
||||
/**
|
||||
* Creates the game object.
|
||||
*
|
||||
@@ -46,9 +41,4 @@ public final class GameObject implements Entity {
|
||||
return EntityType.GAME_OBJECT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Position getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import org.apollo.game.model.def.ObjectDefinition;
|
||||
* @author Chris Fletcher
|
||||
* @author Major
|
||||
*/
|
||||
public final class StaticObject implements Entity {
|
||||
public final class StaticObject extends Entity {
|
||||
|
||||
/**
|
||||
* The object's definition.
|
||||
@@ -23,11 +23,6 @@ public final class StaticObject implements Entity {
|
||||
*/
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
* The object's position.
|
||||
*/
|
||||
private final Position position;
|
||||
|
||||
/**
|
||||
* The object's rotation.
|
||||
*/
|
||||
@@ -77,15 +72,6 @@ public final class StaticObject implements Entity {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the position of this object.
|
||||
*
|
||||
* @return The object's position.
|
||||
*/
|
||||
public Position getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the object's rotation.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.apollo.game.scheduling.impl;
|
||||
|
||||
import org.apollo.game.model.Character;
|
||||
import org.apollo.game.model.Mob;
|
||||
import org.apollo.game.scheduling.ScheduledTask;
|
||||
|
||||
/**
|
||||
@@ -14,14 +14,14 @@ public final class SkillNormalizationTask extends ScheduledTask {
|
||||
/**
|
||||
* The character.
|
||||
*/
|
||||
private final Character character;
|
||||
private final Mob character;
|
||||
|
||||
/**
|
||||
* Creates the skill normalization task.
|
||||
*
|
||||
* @param character The character.
|
||||
*/
|
||||
public SkillNormalizationTask(Character character) {
|
||||
public SkillNormalizationTask(Mob character) {
|
||||
super(100, false);
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package org.apollo.game.sync.block;
|
||||
public class HitUpdateBlock extends SynchronizationBlock {
|
||||
|
||||
/**
|
||||
* The {@link org.apollo.game.model.Character}'s current health.
|
||||
* The {@link org.apollo.game.model.Mob}'s current health.
|
||||
*/
|
||||
private final int currentHealth;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class HitUpdateBlock extends SynchronizationBlock {
|
||||
private final int damage;
|
||||
|
||||
/**
|
||||
* The {@link org.apollo.game.model.Character}'s maximum health.
|
||||
* The {@link org.apollo.game.model.Mob}'s maximum health.
|
||||
*/
|
||||
private final int maximumHealth;
|
||||
|
||||
@@ -33,8 +33,8 @@ public class HitUpdateBlock extends SynchronizationBlock {
|
||||
*
|
||||
* @param hitDamage The damage dealt by the hit.
|
||||
* @param hitType The type of hit.
|
||||
* @param currentHealth The current health of the {@link org.apollo.game.model.Character}.
|
||||
* @param maximumHealth The maximum health of the {@link org.apollo.game.model.Character}.
|
||||
* @param currentHealth The current health of the {@link org.apollo.game.model.Mob}.
|
||||
* @param maximumHealth The maximum health of the {@link org.apollo.game.model.Mob}.
|
||||
*/
|
||||
public HitUpdateBlock(int hitDamage, int hitType, int currentHealth, int maximumHealth) {
|
||||
damage = hitDamage;
|
||||
@@ -44,7 +44,7 @@ public class HitUpdateBlock extends SynchronizationBlock {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current health of the {@link org.apollo.game.model.Character}.
|
||||
* Gets the current health of the {@link org.apollo.game.model.Mob}.
|
||||
*
|
||||
* @return The current health;
|
||||
*/
|
||||
@@ -62,7 +62,7 @@ public class HitUpdateBlock extends SynchronizationBlock {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum health of the {@link org.apollo.game.model.Character}.
|
||||
* Gets the maximum health of the {@link org.apollo.game.model.Mob}.
|
||||
*
|
||||
* @return The maximum health.
|
||||
*/
|
||||
|
||||
@@ -3,15 +3,15 @@ package org.apollo.util;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apollo.game.model.Character;
|
||||
import org.apollo.game.model.Mob;
|
||||
|
||||
/**
|
||||
* A {@link CharacterRepository} is a repository of {@link Character}s that are currently active in the game world.
|
||||
* A {@link CharacterRepository} is a repository of {@link Mob}s that are currently active in the game world.
|
||||
*
|
||||
* @author Graham
|
||||
* @param <T> The type of character.
|
||||
*/
|
||||
public final class CharacterRepository<T extends Character> implements Iterable<T> {
|
||||
public final class CharacterRepository<T extends Mob> implements Iterable<T> {
|
||||
|
||||
/**
|
||||
* The {@link Iterator} implementation for the {@link CharacterRepository} class.
|
||||
@@ -75,7 +75,7 @@ public final class CharacterRepository<T extends Character> implements Iterable<
|
||||
/**
|
||||
* The array of characters in this repository.
|
||||
*/
|
||||
private final Character[] characters;
|
||||
private final Mob[] characters;
|
||||
|
||||
/**
|
||||
* The position of the next free index.
|
||||
@@ -93,7 +93,7 @@ public final class CharacterRepository<T extends Character> implements Iterable<
|
||||
* @param capacity The maximum number of characters that can be present in the repository.
|
||||
*/
|
||||
public CharacterRepository(int capacity) {
|
||||
this.characters = new Character[capacity];
|
||||
this.characters = new Mob[capacity];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user