Atavism Version 2018.1AGIS API

atavism.agis.arenas
Class DeathmatchArena

java.lang.Object
  extended by atavism.agis.arenas.Arena
      extended by atavism.agis.arenas.DeathmatchArena
All Implemented Interfaces:
MessageCallback, java.io.Serializable

public class DeathmatchArena
extends Arena
implements java.io.Serializable, MessageCallback

The Arena class handles an arena instance. It has numerous scheduled executors and a state variable to control the flow of the arena from setup to the end. This class is complete, it relies on no other class to perform it's duties.

Author:
Andrew Harrison
See Also:
Serialized Form

Nested Class Summary
 class DeathmatchArena.ArenaCleanup
          Teleports all players out and then sends out a message to remove this arena instance from the Map stored in the ArenaPlugin.
 class DeathmatchArena.ArenaCountdown
           
 class DeathmatchArena.ArenaEnd
          The class to handle when the arenas timer has expired.
 class DeathmatchArena.ArenaReady
           
 class DeathmatchArena.ArenaStart
          Starts the arena.
 class DeathmatchArena.CollisionCheck
          Iterates through every player in the arena and compares their location to all the other players in the other teams.
 
Field Summary
 
Fields inherited from class atavism.agis.arenas.Arena
arenaDatabaseID, arenaGameType, arenaID, arenaName, arenaObjects, category, centreY, defeatPayment, defeatXP, goalType, instanceOid, instanceTemplateID, length, numTeams, PLAYER_IMMUNE, PLAYER_INACTIVE, PROP_HEALTH, PROP_MAX_HEALTH, PROP_WEAPON, scheduledExecutioner, startTime, state, STATE_END, STATE_RUNNING, STATE_SETUP, STATE_UNSET, teams, useWeapons, victoryCondition, victoryPayment, victoryXP
 
Fields inherited from interface atavism.msgsys.MessageCallback
NO_FLAGS, RESPONSE_EXPECTED
 
Constructor Summary
DeathmatchArena(int numTeams)
          The default constructor.
DeathmatchArena(int numTeams, java.util.ArrayList<ArenaQueue.QueueMember>[] members, int type, int arenaDatabaseID, java.lang.String arenaName, int category, int dur, int[] goals, java.lang.String[] teamNames, Point[] spawnPoints, int condition, int id, int[] minPlayers, int instanceTemplateID, java.util.HashMap<java.lang.Integer,java.lang.Integer> victoryPayment, java.util.HashMap<java.lang.Integer,java.lang.Integer> defeatPayment, int victoryExp, int defeatExp, boolean useWeapons)
          Constructor that takes in two lists that contain the oids of the players on each team.
 
Method Summary
 void activateAbility(OID playerOid, OID targetOid, int slot)
           
protected  boolean addAbility(OID playerOid, int team)
           
 void addDotScore(OID attackerOid)
          This is called whenever a pac eats a dot.
 void addKillScore(OID attackerOid, OID victimOid)
          This will be called whenever one player kills another.
protected  boolean addPowerup(ArenaMember member, int playerTeam)
           
protected  void alterTeamScore(int team, int score)
          Add the score to the teams score.
protected  boolean canPlaceObject(int x, int z)
           
 void completeTutorial(OID oid)
           
protected  java.util.LinkedList<java.lang.Integer> getAbilityList(int team)
           
protected  int getGridXTile(float f)
           
protected  int getGridZTile(float f)
           
protected  java.util.LinkedList<java.lang.Integer> getPowerupList(int team)
           
 void handleDeath(OID attackerOid, OID victimOid)
           
 void handleMessage(Message msg, int flags)
          process network messages
protected  boolean placeObjectInGrid(int x, int z, java.lang.Object object)
           
 void releaseRequest(OID playerOid)
           
protected  boolean removeObjectFromGrid(int x, int z, java.lang.Object object)
           
 boolean sendMessageSingle(java.lang.String msgType, OID oid, java.io.Serializable data)
          Sends an extension message of the specified type to the specified player
 void setup()
          This is run once the Arena object is created.
 
Methods inherited from class atavism.agis.arenas.Arena
activateMachine, addArenaObject, addHealth, addIndividualDeath, addIndividualKill, addIndividualScore, addWeapon, changePlayerRace, createSubs, despawnGates, getArenaCategory, getArenaID, getArenaInstanceOid, getArenaPlayer, getArenaType, getInstanceTemplateID, getLength, getOpposingTeams, getPlayerTeam, getState, getTeam, getTeams, getUsableSkins, logArenaResult, removePlayer, sendAbilities, sendChatMessageAll, sendChatMessageSingle, sendChatMessageTeam, sendMessageAll, sendMessageTeam, sendStatMessageAll, sendStatMessageSingle, setArenaCategory, setArenaID, setArenaInstanceOid, setArenaType, setInstanceTemplateID, setLength, setPlayerProperty, setPlayerSkin, setPlayerTeamColour, setState, setTeams, teleportAllBase, teleportAllOut, teleportOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeathmatchArena

public DeathmatchArena(int numTeams)
The default constructor. This creates the Arrays and ArrayLists. This needs to be called by the other constructors.

Parameters:
numTeams: - the number of teams in the arena

DeathmatchArena

public DeathmatchArena(int numTeams,
                       java.util.ArrayList<ArenaQueue.QueueMember>[] members,
                       int type,
                       int arenaDatabaseID,
                       java.lang.String arenaName,
                       int category,
                       int dur,
                       int[] goals,
                       java.lang.String[] teamNames,
                       Point[] spawnPoints,
                       int condition,
                       int id,
                       int[] minPlayers,
                       int instanceTemplateID,
                       java.util.HashMap<java.lang.Integer,java.lang.Integer> victoryPayment,
                       java.util.HashMap<java.lang.Integer,java.lang.Integer> defeatPayment,
                       int victoryExp,
                       int defeatExp,
                       boolean useWeapons)
Constructor that takes in two lists that contain the oids of the players on each team.

Parameters:
one: - the list of oids for players on team one
two: - the list of oids for players on team two
type: - the arena type
dur: - the duration of the arena
goals: - the goal score for the teams
loc: - the centre point of the arena
id: - the identification number of the arena
minPlayers: - the minimum number of players in each team
Method Detail

setup

public void setup()
This is run once the Arena object is created. It will be responsible for teleporting players to their bases, sending the setup extension message to all players and then getting arenaStart() to be activated in 30 seconds.

Overrides:
setup in class Arena

handleMessage

public void handleMessage(Message msg,
                          int flags)
process network messages

Specified by:
handleMessage in interface MessageCallback
Overrides:
handleMessage in class Arena
Parameters:
msg - Message sent from other agent.
flags - Bitwise OR of MessageCallback.NO_FLAGS, MessageCallback.RESPONSE_EXPECTED.

addAbility

protected boolean addAbility(OID playerOid,
                             int team)
Specified by:
addAbility in class Arena

addPowerup

protected boolean addPowerup(ArenaMember member,
                             int playerTeam)

canPlaceObject

protected boolean canPlaceObject(int x,
                                 int z)

placeObjectInGrid

protected boolean placeObjectInGrid(int x,
                                    int z,
                                    java.lang.Object object)

removeObjectFromGrid

protected boolean removeObjectFromGrid(int x,
                                       int z,
                                       java.lang.Object object)

getGridXTile

protected int getGridXTile(float f)

getGridZTile

protected int getGridZTile(float f)

handleDeath

public void handleDeath(OID attackerOid,
                        OID victimOid)
Overrides:
handleDeath in class Arena

addKillScore

public void addKillScore(OID attackerOid,
                         OID victimOid)
This will be called whenever one player kills another. This function is called from the ArenaPlugin which has a hook to catch the kill message.

Overrides:
addKillScore in class Arena
Parameters:
attackerOid: - the oid of the attacker
victimOid: - the oid of the victim

addDotScore

public void addDotScore(OID attackerOid)
This is called whenever a pac eats a dot. This function is called from the ArenaPlugin which has a hook to catch when a pac runs into a dot.

Parameters:
attackerOid: - the oid of the pac who ate the dot

releaseRequest

public void releaseRequest(OID playerOid)
Specified by:
releaseRequest in class Arena

completeTutorial

public void completeTutorial(OID oid)
Specified by:
completeTutorial in class Arena

getAbilityList

protected java.util.LinkedList<java.lang.Integer> getAbilityList(int team)

getPowerupList

protected java.util.LinkedList<java.lang.Integer> getPowerupList(int team)

alterTeamScore

protected void alterTeamScore(int team,
                              int score)
Add the score to the teams score.

Specified by:
alterTeamScore in class Arena
Parameters:
team: - Which team to add score to.
score: - Score value to add. Can be negative.

sendMessageSingle

public boolean sendMessageSingle(java.lang.String msgType,
                                 OID oid,
                                 java.io.Serializable data)
Sends an extension message of the specified type to the specified player

Overrides:
sendMessageSingle in class Arena
Parameters:
msgType: - the message type
oid: - the oid to send the message to
data: - some form of data to be sent

activateAbility

public void activateAbility(OID playerOid,
                            OID targetOid,
                            int slot)
Specified by:
activateAbility in class Arena


Copyright © 2018 Dragonsan Studios Sp. z o.o.