Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Créer une nouvelle classe Challenge
- package objects;
- import java.util.ArrayList;
- import java.util.List;
- import common.SocketManager;
- import objects.Fight.Fighter;
- public class Challenge
- {
- /*
- * challengeOK = Réussi (Packet OK)
- * challengeKO = Perdu (Packet KO)
- */
- private int type;
- private int xpWin;
- private int dropWin;
- private boolean challengeKO = false;
- private boolean challengeOK = false;
- private Fight fight;
- private Fighter fighter;
- private List<Fight.Fighter> gameList = new ArrayList<Fighter>();
- Personnage perso;
- public Challenge(Fight fight, int type, int xp, int drop)
- {
- this.challengeKO = true;
- this.fight = fight;
- this.type = type;
- this.xpWin = xp;
- this.dropWin = drop;
- gameList.clear();
- gameList.addAll(fight.get_ordreJeu());
- }
- public int getXp() { return xpWin; }
- public int getDrop() { return dropWin; }
- public boolean getWin() { return challengeOK; }
- public boolean getLose() { return challengeKO; }
- public void challengeOK(){
- challengeOK = true;
- challengeKO = false;
- SocketManager.GAME_SEND_CHALLENGE_FIGHT(fight, 7, "GdOK" + type);
- }
- public void challengeKO(Fighter fighter){
- String name = fighter.getPersonnage().get_name();
- challengeKO = false;
- SocketManager.GAME_SEND_CHALLENGE_FIGHT(fight, 7, "GdKO" + type);
- SocketManager.GAME_SEND_CHALLENGE_FIGHT(fight, 7, "Im0188;" + name);
- }
- public void showFightPerso() {
- if (!challengeKO || fighter == null || fighter.get_fightCell() == null || perso == null) return;
- StringBuilder packet = new StringBuilder();
- packet.append("Gf").append(fighter.getGUID()).append("|").append(fighter.get_fightCell().getID());
- SocketManager.send(perso, packet.toString());
- }
- public void showFighter() {
- if (!challengeKO || fighter == null || fighter.get_fightCell() == null) return;
- StringBuilder packet = new StringBuilder();
- packet.append("Gf").append(fighter.getGUID()).append("|").append(fighter.get_fightCell().getID());
- SocketManager.GAME_SEND_CHALLENGE_FIGHT(fight, 7, packet.toString());
- }
- public void fightStart() {
- if (!challengeKO) return;
- switch (type)
- {
- }
- }
- public void fightEnd() {
- if (!challengeKO) return;
- switch(type){
- }
- challengeOK();
- }
- public void fighterDie(Fighter fighter) {
- if(!challengeKO) return;
- switch (type) {
- }
- }
- public void fightAttack() {
- if (!challengeKO) return;
- switch(type) {
- }
- }
- public void monsterDie(){
- if(!challengeKO) return;
- switch(type) {
- }
- }
- public void persoMove(){
- if(!challengeKO) return;
- switch(type) {
- }
- }
- public void persoAction(){
- if(!challengeKO || fighter.getTeam() == 1)
- return;
- switch(type) {
- }
- return;
- }
- public void persoCac(){
- if(!challengeKO) return;
- switch(type){
- }
- }
- public void persoSpell(){
- if(!challengeKO) return;
- switch(type){
- }
- }
- public void fightStartTurn(){
- if(!challengeKO) return;
- switch(type){
- }
- }
- public void fightEndTurn(){
- if(!challengeKO) return;
- switch(type){
- }
- }
- }
- // SocketManager
- public static void GAME_SEND_CHALLENGE_FIGHT(Fight fight, int challenge, String packet) {
- for(Fighter fighter : fight.getFighters(challenge))
- {
- if(fighter.hasLeft())continue;
- if(fighter.getPersonnage() == null || ! fighter.getPersonnage().isOnline())continue;
- send(fighter.getPersonnage(),packet);
- }
- }
- // Carte
- public boolean hasEndFightAction(int actionId) {
- return _endFightAction.containsKey(actionId);
- }
- // Formulas
- public static int getRandomChallenge(Personnage _perso)
- {
- int challenge = 0;
- if(_perso.get_lvl() < 6) {
- return 0;
- } else{
- challenge++;
- }
- if(_perso.get_curCarte().hasEndFightAction( 0 ))
- {
- challenge++;
- }
- return challenge;
- }
Advertisement
Add Comment
Please, Sign In to add comment