Atavism Version 2018.1AGIS API

atavism.agis.arenas
Class CaptureTheFlagArena

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

public class CaptureTheFlagArena
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 CaptureTheFlagArena.ArenaCleanup
          Teleports all players out and then sends out a message to remove this arena instance from the Map stored in the ArenaPlugin.
 class CaptureTheFlagArena.ArenaCountdown
           
 class CaptureTheFlagArena.ArenaEnd
          The class to handle when the arenas timer has expired.
 class CaptureTheFlagArena.ArenaReady
           
 class CaptureTheFlagArena.ArenaStart
          Starts the arena.
 class CaptureTheFlagArena.CollisionCheck
          Iterates through every player in the arena and compares their location to all the other players in the other teams.
 class CaptureTheFlagArena.RespawnFlags
          The class to handle when the arenas timer has expired.
 class CaptureTheFlagArena.SpawnObjects
          Calls the functions to spawn all the objects needed in this arena.
 
Field Summary
 
Fields inherited from class atavism.agis.arenas.Arena
arenaDatabaseID, arenaGameType, arenaID, arenaName, arenaObjects, category, centreX, centreY, centreZ, defeatPayment, defeatXP, goalType, gridSize, 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
CaptureTheFlagArena(int numTeams)
          The default constructor.
CaptureTheFlagArena(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 playerTeam)
           
 void addKillScore(OID attackerOid, OID victimOid)
          This will be called whenever one player kills another.
protected  void alterTeamScore(int team, int score)
          Add the score to the teams score.
 void completeTutorial(OID oid)
           
 void dropFlag(OID playerOid)
           
 void flagCaptured(ArenaMember member, int flagTeam)
          Called when a player carrying an enemy teams flag enters their flag platform and their flag is still on it.
protected  void flagDropped(ArenaMember member)
          Spawns a flag at the position of the player dropping a flag
protected  java.util.LinkedList<java.lang.Integer> getAbilityList(int team)
           
 int getFlagDisplayID(int team)
           
 java.lang.String getFlagMesh()
           
 void handleDeath(OID attackerOid, OID victimOid)
           
 void handleMessage(Message msg, int flags)
          process network messages
 void pickupFlag(OID playerOid, int teamNum)
           
 void releaseRequest(OID playerOid)
           
 void removePlayer(OID oid, boolean teleport)
          Removes a player from the arena.
 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 setFlagClickable(ArenaFlag flag, boolean allTeams)
          Sets the flag clickable to either every team in the game, or just the opposing teams of the flag.
 void setup()
          This is run once the Arena object is created.
protected  void spawnFlags()
           
 
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, 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

CaptureTheFlagArena

public CaptureTheFlagArena(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

CaptureTheFlagArena

public CaptureTheFlagArena(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 playerTeam)
Specified by:
addAbility in class Arena

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

removePlayer

public void removePlayer(OID oid,
                         boolean teleport)
Removes a player from the arena.

Overrides:
removePlayer in class Arena
Parameters:
oid: - The player being removed from the arena

spawnFlags

protected void spawnFlags()

pickupFlag

public void pickupFlag(OID playerOid,
                       int teamNum)

dropFlag

public void dropFlag(OID playerOid)

flagDropped

protected void flagDropped(ArenaMember member)
Spawns a flag at the position of the player dropping a flag

Parameters:
member -
team -

flagCaptured

public void flagCaptured(ArenaMember member,
                         int flagTeam)
Called when a player carrying an enemy teams flag enters their flag platform and their flag is still on it. Awards a point to the team of the flag capturer then despawns all other flags and sets up the system to respawn the flags again.

Parameters:
attackerOid: - the oid of the player who captured the flag

activateAbility

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

setFlagClickable

public void setFlagClickable(ArenaFlag flag,
                             boolean allTeams)
Sets the flag clickable to either every team in the game, or just the opposing teams of the flag.

Parameters:
flag -
allTeams -

completeTutorial

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

getAbilityList

protected java.util.LinkedList<java.lang.Integer> getAbilityList(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

getFlagMesh

public java.lang.String getFlagMesh()

getFlagDisplayID

public int getFlagDisplayID(int team)

releaseRequest

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


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