falyptus

Untitled

Jun 9th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public void tryCaC(Player perso, int cellID)
  2.     {
  3.         Fighter caster = getFighterByPerso(perso);
  4.        
  5.         if(caster == null)return;
  6.        
  7.         if(_ordreJeu.get(_curPlayer).getGUID() != caster.getGUID())//Si ce n'est pas a lui de jouer
  8.             return;
  9.        
  10.         if(perso.getObjetByPos(Constants.ITEM_POS_ARME) == null)//S'il n'a pas de CaC
  11.         {
  12.             tryCastSpell(caster, World.getSort(0).getStatsByLevel(1), cellID);
  13.         }else
  14.         {
  15.             Item arme = perso.getObjetByPos(Constants.ITEM_POS_ARME);
  16.            
  17.             //Pierre d'âmes = EC
  18.             if(arme.getTemplate().getType() == 83)
  19.             {
  20.                 SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 305, perso.getGUID()+"", "");//Echec Critique Cac
  21.                 SocketManager.GAME_SEND_GAF_PACKET_TO_FIGHT(this, 7, 0, perso.getGUID());//Fin de l'action
  22.                 try{
  23.                     Thread.sleep(500);
  24.                 }catch(Exception e){}
  25.                 endTurn();
  26.             }
  27.            
  28.             int PACost = arme.getTemplate().getPACost();
  29.            
  30.             if(_curFighterPA < PACost)//S'il n'a pas assez de PA
  31.             {
  32.                
  33.                 return;
  34.             }
  35.             SocketManager.GAME_SEND_GAS_PACKET_TO_FIGHT(this, 7, perso.getGUID());
  36.             boolean isEc = arme.getTemplate().getTauxEC() != 0 && Formulas.getRandomValue(1, arme.getTemplate().getTauxEC()) == arme.getTemplate().getTauxEC();
  37.             if(isEc)
  38.             {
  39.                 GameServer.addToLog(perso.getName()+" Echec critique sur le CaC ");
  40.                 SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 305, perso.getGUID()+"", "");//Echec Critique Cac
  41.                 SocketManager.GAME_SEND_GAF_PACKET_TO_FIGHT(this, 7, 0, perso.getGUID());//Fin de l'action
  42.                 endTurn();
  43.             }else
  44.             {
  45.                 SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 303, perso.getGUID()+"", cellID+"");
  46.                 boolean isCC = caster.testIfCC(arme.getTemplate().getTauxCC());
  47.                 if(isCC)
  48.                 {
  49.                     GameServer.addToLog(perso.getName()+" Coup critique sur le CaC");
  50.                     SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 301, perso.getGUID()+"", "0");
  51.                 }
  52.                
  53.                 //Si le joueur est invisible
  54.                 if(caster.isHide())caster.unHide();
  55.                
  56.                 ArrayList<SpellEffect> effets = arme.getEffects();
  57.                 if(isCC)
  58.                 {
  59.                     effets = arme.getCritEffects();
  60.                 }
  61.                 for(SpellEffect SE : effets)
  62.                 {
  63.                     if(_state != Constants.FIGHT_STATE_ACTIVE)break;
  64.                     ArrayList<Fighter> cibles = Pathfinding.getCiblesByZoneByWeapon(this,arme.getTemplate().getType(),_map.getCase(cellID),caster.getFightCell().getID());
  65.                     SE.setTurn(0);
  66.                     SE.applyToFight(this, caster, cibles);
  67.                 }
  68.                 _curFighterPA-= PACost;
  69.                 SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 102,perso.getGUID()+"",perso.getGUID()+",-"+PACost);
  70.                 SocketManager.GAME_SEND_GAF_PACKET_TO_FIGHT(this, 7, 0, perso.getGUID());
  71.                 verifIfTeamAllDead();
  72.             }
  73.         }
  74.     }
Advertisement
Add Comment
Please, Sign In to add comment