Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void tryCaC(Player perso, int cellID)
- {
- Fighter caster = getFighterByPerso(perso);
- if(caster == null)return;
- if(_ordreJeu.get(_curPlayer).getGUID() != caster.getGUID())//Si ce n'est pas a lui de jouer
- return;
- if(perso.getObjetByPos(Constants.ITEM_POS_ARME) == null)//S'il n'a pas de CaC
- {
- tryCastSpell(caster, World.getSort(0).getStatsByLevel(1), cellID);
- }else
- {
- Item arme = perso.getObjetByPos(Constants.ITEM_POS_ARME);
- //Pierre d'âmes = EC
- if(arme.getTemplate().getType() == 83)
- {
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 305, perso.getGUID()+"", "");//Echec Critique Cac
- SocketManager.GAME_SEND_GAF_PACKET_TO_FIGHT(this, 7, 0, perso.getGUID());//Fin de l'action
- try{
- Thread.sleep(500);
- }catch(Exception e){}
- endTurn();
- }
- int PACost = arme.getTemplate().getPACost();
- if(_curFighterPA < PACost)//S'il n'a pas assez de PA
- {
- return;
- }
- SocketManager.GAME_SEND_GAS_PACKET_TO_FIGHT(this, 7, perso.getGUID());
- boolean isEc = arme.getTemplate().getTauxEC() != 0 && Formulas.getRandomValue(1, arme.getTemplate().getTauxEC()) == arme.getTemplate().getTauxEC();
- if(isEc)
- {
- GameServer.addToLog(perso.getName()+" Echec critique sur le CaC ");
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 305, perso.getGUID()+"", "");//Echec Critique Cac
- SocketManager.GAME_SEND_GAF_PACKET_TO_FIGHT(this, 7, 0, perso.getGUID());//Fin de l'action
- endTurn();
- }else
- {
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 303, perso.getGUID()+"", cellID+"");
- boolean isCC = caster.testIfCC(arme.getTemplate().getTauxCC());
- if(isCC)
- {
- GameServer.addToLog(perso.getName()+" Coup critique sur le CaC");
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 301, perso.getGUID()+"", "0");
- }
- //Si le joueur est invisible
- if(caster.isHide())caster.unHide();
- ArrayList<SpellEffect> effets = arme.getEffects();
- if(isCC)
- {
- effets = arme.getCritEffects();
- }
- for(SpellEffect SE : effets)
- {
- if(_state != Constants.FIGHT_STATE_ACTIVE)break;
- ArrayList<Fighter> cibles = Pathfinding.getCiblesByZoneByWeapon(this,arme.getTemplate().getType(),_map.getCase(cellID),caster.getFightCell().getID());
- SE.setTurn(0);
- SE.applyToFight(this, caster, cibles);
- }
- _curFighterPA-= PACost;
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 102,perso.getGUID()+"",perso.getGUID()+",-"+PACost);
- SocketManager.GAME_SEND_GAF_PACKET_TO_FIGHT(this, 7, 0, perso.getGUID());
- verifIfTeamAllDead();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment