Atavism Version 2018.1AGIS API

atavism.agis.objects
Class Duel

java.lang.Object
  extended by atavism.agis.objects.Duel
All Implemented Interfaces:
java.io.Serializable

public class Duel
extends java.lang.Object
implements java.io.Serializable

The Duel class handles a single duel between two teams. It has numerous scheduled executors and a state variable to control the flow of the duel 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 Duel.DuelStart
          Starts the arena.
 class Duel.PositionCheck
           
 
Field Summary
protected  java.util.ArrayList<java.lang.Boolean>[] activeFighters
           
protected  Point centerLoc
           
static java.lang.String DUEL_FLAG_MODEL
           
protected  int duelID
           
protected  int duelType
           
protected  OID flagOid
           
protected  java.util.ArrayList<java.lang.Integer>[] oobTimer
           
protected  java.util.ArrayList<java.lang.Integer> teamHealths
           
protected  java.lang.String[] teamLeader
           
protected  java.util.ArrayList<OID>[] teams
           
protected  java.lang.Integer testTimer
          Iterates through every player in the duel and makes sure they are still within 30m of the center point of the duel.
protected  int timeUntilStart
           
 
Constructor Summary
Duel()
          The default constructor.
Duel(java.lang.String[] teamLeaders, java.util.ArrayList<OID>[] oids, int type, int id, Point centerLoc, OID flagOid)
          Constructor that takes in two lists that contain the oids of the players on each team.
 
Method Summary
 void addKillScore(OID attackerOid, OID victimOid)
          This will be called whenever one player kills another.
 void checkActivePlayers()
          This function runs through all the players in both teams to see if any teams have no active players left.
 void disconnectedPlayer(OID oid, java.lang.String playerName)
          Removes a player from the arena.
 java.util.ArrayList<java.lang.Boolean>[] getActiveFighters()
           
 Point getCenter()
           
 int getDuelID()
           
 int getDuelType()
           
 OID getFlagOid()
           
 java.util.ArrayList<java.lang.Integer>[] getOobTimers()
           
 int getState()
           
 java.util.ArrayList<OID> getTeam(int team)
           
 java.lang.String[] getTeamLeaders()
           
 java.util.ArrayList<OID>[] getTeams()
           
 void removePlayer(OID oid)
          Removes a player from the arena.
 void setActiveFighters(java.util.ArrayList<java.lang.Boolean>[] activeFighters)
           
 void setCenter(Point centerLoc)
           
 void setDuelID(int duelID)
           
 void setDuelType(int duelType)
           
 void setFlagOid(OID flagOid)
           
 void setOobTimers(java.util.ArrayList<java.lang.Integer>[] oobTimer)
           
 void setState(int state)
           
 void setTeam(int team, java.util.ArrayList<OID> teams)
           
 void setTeamLeaders(java.lang.String[] teamLeader)
           
 void setTeams(java.util.ArrayList<OID>[] teams)
           
 void setup()
          This is run once the Duel object is created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

duelID

protected int duelID

duelType

protected int duelType

teams

protected java.util.ArrayList<OID>[] teams

activeFighters

protected java.util.ArrayList<java.lang.Boolean>[] activeFighters

oobTimer

protected java.util.ArrayList<java.lang.Integer>[] oobTimer

centerLoc

protected Point centerLoc

teamLeader

protected java.lang.String[] teamLeader

flagOid

protected OID flagOid

timeUntilStart

protected int timeUntilStart

testTimer

protected java.lang.Integer testTimer
Iterates through every player in the duel and makes sure they are still within 30m of the center point of the duel.


teamHealths

protected java.util.ArrayList<java.lang.Integer> teamHealths

DUEL_FLAG_MODEL

public static final java.lang.String DUEL_FLAG_MODEL
See Also:
Constant Field Values
Constructor Detail

Duel

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


Duel

public Duel(java.lang.String[] teamLeaders,
            java.util.ArrayList<OID>[] oids,
            int type,
            int id,
            Point centerLoc,
            OID flagOid)
Constructor that takes in two lists that contain the oids of the players on each team.

Parameters:
oids: - the oids of the players involved in this duel
type: - the duel type
loc: - the centre point of the duel
id: - the identification number of the duel
Method Detail

setup

public void setup()
This is run once the Duel object is created. It will be responsible for sending the setup extension message to all players and then getting DuelStart() to be activated in 5 seconds.


checkActivePlayers

public void checkActivePlayers()
This function runs through all the players in both teams to see if any teams have no active players left. If a team is found, the other team is the winner.


removePlayer

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

Parameters:
oid: - The player being removed from the arena

disconnectedPlayer

public void disconnectedPlayer(OID oid,
                               java.lang.String playerName)
Removes a player from the arena.

Parameters:
oid: - The player being removed from the 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.

Parameters:
attackerOid: - the oid of the attacker
victimOid: - the oid of the victim

getDuelID

public int getDuelID()

setDuelID

public void setDuelID(int duelID)

getDuelType

public int getDuelType()

setDuelType

public void setDuelType(int duelType)

getState

public int getState()

setState

public void setState(int state)

getTeams

public java.util.ArrayList<OID>[] getTeams()

setTeams

public void setTeams(java.util.ArrayList<OID>[] teams)

getTeam

public java.util.ArrayList<OID> getTeam(int team)

setTeam

public void setTeam(int team,
                    java.util.ArrayList<OID> teams)

getActiveFighters

public java.util.ArrayList<java.lang.Boolean>[] getActiveFighters()

setActiveFighters

public void setActiveFighters(java.util.ArrayList<java.lang.Boolean>[] activeFighters)

getOobTimers

public java.util.ArrayList<java.lang.Integer>[] getOobTimers()

setOobTimers

public void setOobTimers(java.util.ArrayList<java.lang.Integer>[] oobTimer)

getTeamLeaders

public java.lang.String[] getTeamLeaders()

setTeamLeaders

public void setTeamLeaders(java.lang.String[] teamLeader)

getCenter

public Point getCenter()

setCenter

public void setCenter(Point centerLoc)

getFlagOid

public OID getFlagOid()

setFlagOid

public void setFlagOid(OID flagOid)


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