Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void tryCaC(Personnage 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
- {
- if (_curFighterPA < 4)//S'il n'a pas assez de PA
- {
- return;
- }
- SocketManager.GAME_SEND_GAS_PACKET_TO_FIGHT(this, 7, perso.get_GUID());
- //Si le joueur est invisible
- if (caster.isHide()) {
- caster.unHide(-1);
- }
- Fighter target = _map.getCase(cellID).getFirstFighter();
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 303, perso.get_GUID() + "", cellID + "");
- if (target != null) {
- int dmg = Formulas.getRandomJet("1d5+0");
- //et pour les item type feu eau agi ?
- int finalDommage = Formulas.calculFinalDommage(this, caster, target, Constants.ELEMENT_NEUTRE, dmg, false, true, -1);
- finalDommage = SpellEffect.applyOnHitBuffs(finalDommage, target, caster, this);//S'il y a des buffs sp�ciaux
- if (finalDommage > target.getPDV()) {
- finalDommage = target.getPDV();//Target va mourrir
- }
- target.removePDV(finalDommage);
- finalDommage = -(finalDommage);
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 100, caster.getGUID() + "", target.getGUID() + "," + finalDommage);
- }
- _curFighterPA -= 4;
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 102, perso.get_GUID() + "", perso.get_GUID() + ",-4");
- SocketManager.GAME_SEND_GAF_PACKET_TO_FIGHT(this, 7, 0, perso.get_GUID());
- if (target.getPDV() <= 0) {
- onFighterDie(target, target);
- }
- verifIfTeamAllDead();
- } else {
- Objet 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.get_GUID() + "", "");//Echec Critique Cac
- SocketManager.GAME_SEND_GAF_PACKET_TO_FIGHT(this, 7, 0, perso.get_GUID());//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.get_GUID());
- boolean isEc = arme.getTemplate().getTauxEC() != 0 && Formulas.getRandomValue(1, arme.getTemplate().getTauxEC()) == arme.getTemplate().getTauxEC();
- if (isEc) {
- if (Ancestra.CONFIG_DEBUG) {
- GameServer.addToLog(perso.get_name() + " Echec critique sur le CaC ");
- }
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 305, perso.get_GUID() + "", "");//Echec Critique Cac
- SocketManager.GAME_SEND_GAF_PACKET_TO_FIGHT(this, 7, 0, perso.get_GUID());//Fin de l'action
- endTurn();
- } else {
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 303, perso.get_GUID() + "", cellID + "");
- boolean isCC = caster.testIfCC(arme.getTemplate().getTauxCC());
- if (isCC) {
- if (Ancestra.CONFIG_DEBUG) {
- GameServer.addToLog(perso.get_name() + " Coup critique sur le CaC");
- }
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 301, perso.get_GUID() + "", "0");
- }
- //Si le joueur est invisible
- if (caster.isHide()) {
- caster.unHide(-1);
- }
- 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.get_fightCell().getID());
- SE.setTurn(0);
- SE.applyToFight(this, caster, cibles, true);
- }
- _curFighterPA -= PACost;
- SocketManager.GAME_SEND_GA_PACKET_TO_FIGHT(this, 7, 102, perso.get_GUID() + "", perso.get_GUID() + ",-" + PACost);
- SocketManager.GAME_SEND_GAF_PACKET_TO_FIGHT(this, 7, 0, perso.get_GUID());
- verifIfTeamAllDead();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment