Atavism Version 2018.1AGIS API

atavism.agis.objects
Class DuelChallenge

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

public class DuelChallenge
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 DuelChallenge.ChallengeExpire
          Starts the arena.
 class DuelChallenge.PositionCheck
           
 
Field Summary
protected  java.util.ArrayList<java.lang.Boolean>[] accepted
           
protected  Point centerLoc
           
protected  java.lang.String challenged
           
protected  int challengeID
           
protected  java.lang.String challenger
           
protected  int duelType
           
protected  OID flagOid
           
protected  int state
           
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.
 
Constructor Summary
DuelChallenge()
          The default constructor.
DuelChallenge(java.lang.String challenger, java.lang.String challenged, java.util.ArrayList<OID>[] oids, int type, int id, OID instanceOid)
          Constructor that takes in the challenger, the challenged, and all players involved and creates a new DuelChallenge object.
 
Method Summary
 java.util.ArrayList<java.lang.Boolean>[] getAccepted()
           
 Point getCenter()
           
 java.lang.String getChallenged()
           
 int getChallengeID()
           
 java.lang.String getChallenger()
           
 int getDuelType()
           
 OID getFlagOid()
           
 int getState()
           
 java.util.ArrayList<OID>[] getTeam()
           
 java.util.ArrayList<OID> getTeam(int team)
           
 void playerAccept(OID acceptOid)
          Sets the players accepted property to true.
 void playerDeclined(OID delineOid)
          Cancels the duel challenge because a player does not wish to partake in the duel.
 void playerDisconnected(OID delineOid, java.lang.String name)
          Cancels the duel challenge because a player has disconnected.
 void setAccepted(java.util.ArrayList<java.lang.Boolean>[] accepted)
           
 void setCenter(Point centerLoc)
           
 void setChallenged(java.lang.String challenged)
           
 void setChallengeID(int challengeID)
           
 void setChallenger(java.lang.String challenger)
           
 void setDuelType(int duelType)
           
 void setFlagOid(OID flagOid)
           
 void setState(int state)
           
 void setTeam(java.util.ArrayList<OID>[] teams)
           
 void setTeam(int team, java.util.ArrayList<OID> teams)
           
 void setup(OID instanceOid)
          This is run once the Duel Challenge object is created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

challengeID

protected int challengeID

duelType

protected int duelType

centerLoc

protected Point centerLoc

teams

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

accepted

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

challenger

protected java.lang.String challenger

challenged

protected java.lang.String challenged

state

protected int state

flagOid

protected OID flagOid

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.

Constructor Detail

DuelChallenge

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


DuelChallenge

public DuelChallenge(java.lang.String challenger,
                     java.lang.String challenged,
                     java.util.ArrayList<OID>[] oids,
                     int type,
                     int id,
                     OID instanceOid)
Constructor that takes in the challenger, the challenged, and all players involved and creates a new DuelChallenge object.

Parameters:
challenger: - the oid of the challenger
challenged: - the oid of the player who was challenged
oids: - a list of all players involved broken up into teams
type: - the type of duel
id: - the identification number of the arena
Method Detail

setup

public void setup(OID instanceOid)
This is run once the Duel Challenge object is created. It will be responsible for starting two timers, one for the challenge expiration (which occurs in 20 seconds) and the other being a position check to make sure no one in this duel challenge has wandered too far away.


playerAccept

public void playerAccept(OID acceptOid)
Sets the players accepted property to true. This is called when a player sends a /duelAccept command to the server.

Parameters:
acceptOid: - the oid of the player who has accepted this duel.

playerDeclined

public void playerDeclined(OID delineOid)
Cancels the duel challenge because a player does not wish to partake in the duel. This is called when a player sends a /duelDecline command to the server.

Parameters:
oid: - the oid of the player who declined the duel

playerDisconnected

public void playerDisconnected(OID delineOid,
                               java.lang.String name)
Cancels the duel challenge because a player has disconnected.

Parameters:
oid: - the oid of the player who disconnected
name: - the name of the player who disconnected

getChallengeID

public int getChallengeID()

setChallengeID

public void setChallengeID(int challengeID)

getDuelType

public int getDuelType()

setDuelType

public void setDuelType(int duelType)

getState

public int getState()

setState

public void setState(int state)

getTeam

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

setTeam

public void setTeam(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)

getAccepted

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

setAccepted

public void setAccepted(java.util.ArrayList<java.lang.Boolean>[] accepted)

getChallenger

public java.lang.String getChallenger()

setChallenger

public void setChallenger(java.lang.String challenger)

getChallenged

public java.lang.String getChallenged()

setChallenged

public void setChallenged(java.lang.String challenged)

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.