Package org.moparscape.msc.gs.model

Examples of org.moparscape.msc.gs.model.Projectile


    }
    if (affectedMob instanceof Npc) {
      Npc npc = (Npc) affectedMob;
      npc.getSyndicate().addDamage(owner, damage, Damage.RANGE_DAMAGE);
    }
    Projectile projectile = new Projectile(owner, affectedMob, 2);

    ArrayList<Player> playersToInform = new ArrayList<Player>();
    playersToInform.addAll(owner.getViewArea().getPlayersInView());
    playersToInform.addAll(affectedMob.getViewArea().getPlayersInView());
    for (Player p : playersToInform) {
View Full Code Here


              }
              if (!checkAndRemoveRunes(owner, spell)) {
                return;
              }

              Projectile projectilez = new Projectile(owner,
                  affectedMob, 1);
              ArrayList<Player> playersToInformm = new ArrayList<Player>();
              playersToInformm.addAll(owner.getViewArea()
                  .getPlayersInView());
              playersToInformm.addAll(affectedMob.getViewArea()
                  .getPlayersInView());
              for (Player p : playersToInformm) {
                p.informOfProjectile(projectilez);
                p.informOfModifiedHits(affectedMob);
              }

              finalizeSpell(owner, spell);

              owner.getActionSender().sendInventory();
              owner.getActionSender().sendStat(6);
              return;
            case 19: // Crumble undead

              if (affectedMob instanceof Player) {
                owner.getActionSender()
                    .sendMessage(
                        "You can not use this spell on a Player");
                return;
              }
              if (!checkAndRemoveRunes(owner, spell)) {
                return;
              }
              Npc n = (Npc) affectedMob;
              int damaga = Formulae.Rand(1, 5);
              boolean foundd = false;
              if (n.undead) {
                foundd = true;
                damaga = Formulae
                    .Rand(3,
                        Constants.GameServer.CRUMBLE_UNDEAD_MAX);
              }

              if (!foundd) {
                owner.getActionSender()
                    .sendMessage(
                        "You must use this spell on undead monsters only");
                return;
              }
              if (Formulae.Rand(0, 8) == 2)
                damaga = 0;

              Projectile projectilee = new Projectile(owner,
                  affectedMob, 1);
              affectedMob.setLastDamage(damaga);
              int newp = affectedMob.getHits() - damaga;
              affectedMob.setHits(newp);
              ArrayList<Player> playersToInforms = new ArrayList<Player>();
              playersToInforms.addAll(owner.getViewArea()
                  .getPlayersInView());
              playersToInforms.addAll(affectedMob.getViewArea()
                  .getPlayersInView());
              for (Player p : playersToInforms) {
                p.informOfProjectile(projectilee);
                p.informOfModifiedHits(affectedMob);
              }
              if (newp <= 0) {
                affectedMob.killedBy(owner, owner.isDueling());
                if (owner instanceof Player
                    && affectedMob instanceof Npc) {
                  ((Npc) affectedMob).getSyndicate()
                      .distributeExp((Npc) affectedMob);
                }
              }
              finalizeSpell(owner, spell);

              owner.getActionSender().sendInventory();
              owner.getActionSender().sendStat(6);
              return;
            case 42: // vulnerability
            case 45: // Enfeeble
            case 47: // Stun
              owner.getActionSender().sendMessage(
                  "@or1@This spell is not yet implemented.");
              break;
            case 25:
              if (owner.getLocation().inWilderness()) {
                owner.getActionSender().sendMessage(
                    "Can not use this spell in wilderness");
                return;
              }
              if (affectedMob instanceof Npc) {
                if (((Npc) affectedMob).getID() == 477) {
                  player.getActionSender()
                      .sendMessage(
                          "The dragon seems immune to this spell");
                  return;
                }
              }
              boolean flagispro = false;
              ListIterator<InvItem> iterator22 = owner
                  .getInventory().getItems().listIterator();
              while (iterator22.hasNext()) {
                InvItem cape = (InvItem) iterator22.next();
                if (cape.id == 1000 && cape.wielded) {
                  flagispro = flagispro || true;
                }
                // else {flag = false;}
              }
              if (flagispro) {
                if (!owner.isCharged()) {
                  owner.getActionSender().sendMessage(
                      "@red@You are not charged!");
                }

                if (!checkAndRemoveRunes(owner, spell)) {
                  return;
                }
                if (affectedMob instanceof Player
                    && !owner.isDueling()) {
                  Player affectedPlayer = (Player) affectedMob;
                  owner.setSkulledOn(affectedPlayer);
                }
                int damag = Formulae.calcSpellHit(20,
                    owner.getMagicPoints());
                if (affectedMob instanceof Player) {
                  Player affectedPlayer = (Player) affectedMob;
                  affectedPlayer
                      .getActionSender()
                      .sendMessage(
                          owner.getUsername()
                              + " is shooting at you!");
                }
                Projectile projectil = new Projectile(owner,
                    affectedMob, 1);
                // godSpellObject(affectedMob, 33);
                affectedMob.setLastDamage(damag);
                int newhp = affectedMob.getHits() - damag;
                affectedMob.setHits(newhp);
                ArrayList<Player> playersToInfor = new ArrayList<Player>();
                playersToInfor.addAll(owner.getViewArea()
                    .getPlayersInView());
                playersToInfor.addAll(affectedMob.getViewArea()
                    .getPlayersInView());
                for (Player p : playersToInfor) {
                  p.informOfProjectile(projectil);
                  p.informOfModifiedHits(affectedMob);
                }
                if (affectedMob instanceof Player) {
                  Player affectedPlayer = (Player) affectedMob;
                  affectedPlayer.getActionSender()
                      .sendStat(3);
                }
                if (newhp <= 0) {
                  affectedMob.killedBy(owner,
                      owner.isDueling());
                }
                owner.getActionSender().sendInventory();
                owner.getActionSender().sendStat(6);
                finalizeSpell(owner, spell);
                break;
              } else {
                owner.getActionSender()
                    .sendMessage(
                        "You need to be wearing the Iban Staff to cast this spell!");
                return;
              }
            case 33:
              if (owner.getLocation().inWilderness()) {
                owner.getActionSender().sendMessage(
                    "Can not use this spell in wilderness");
                return;
              }
              if (affectedMob instanceof Npc) {
                if (((Npc) affectedMob).getID() == 477) {
                  player.getActionSender()
                      .sendMessage(
                          "The dragon seems immune to this spell");
                  return;
                }
              }
              boolean flag = false;
              ListIterator<InvItem> iterator = owner
                  .getInventory().getItems().listIterator();
              while (iterator.hasNext()) {
                InvItem cape = iterator.next();
                if (cape.id == 1217 && cape.wielded) {
                  flag = true;
                }
                // else {flag = false;}
              }
              if (flag) {
                if (!owner.isCharged()) {
                  owner.getActionSender().sendMessage(
                      "@red@You are not charged!");
                }

                if (!checkAndRemoveRunes(owner, spell)) {
                  return;
                }
                if (affectedMob instanceof Player
                    && !owner.isDueling()) {
                  Player affectedPlayer = (Player) affectedMob;
                  owner.setSkulledOn(affectedPlayer);
                }
                int damag = Formulae.calcGodSpells(owner,
                    affectedMob);
                // int damag = Formulae.calcSpellHit(max,
                // owner.getMagicPoints());
                if (affectedMob instanceof Player) {
                  Player affectedPlayer = (Player) affectedMob;
                  affectedPlayer
                      .getActionSender()
                      .sendMessage(
                          owner.getUsername()
                              + " is shooting at you!");
                }
                Projectile projectil = new Projectile(owner,
                    affectedMob, 1);
                godSpellObject(affectedMob, 33);
                affectedMob.setLastDamage(damag);
                int newhp = affectedMob.getHits() - damag;
                affectedMob.setHits(newhp);
                ArrayList<Player> playersToInfor = new ArrayList<Player>();
                playersToInfor.addAll(owner.getViewArea()
                    .getPlayersInView());
                playersToInfor.addAll(affectedMob.getViewArea()
                    .getPlayersInView());
                for (Player p : playersToInfor) {
                  p.informOfProjectile(projectil);
                  p.informOfModifiedHits(affectedMob);
                }
                if (affectedMob instanceof Player) {
                  Player affectedPlayer = (Player) affectedMob;
                  affectedPlayer.getActionSender()
                      .sendStat(3);
                }
                if (newhp <= 0) {
                  affectedMob.killedBy(owner,
                      owner.isDueling());
                }
                owner.getActionSender().sendInventory();
                owner.getActionSender().sendStat(6);
                finalizeSpell(owner, spell);
                break;
              } else {
                owner.getActionSender()
                    .sendMessage(
                        "You need to be wearing the Staff of Guthix to cast this spell!");
                return;
              }
            case 34:
              if (affectedMob instanceof Npc) {
                if (((Npc) affectedMob).getID() == 477) {
                  player.getActionSender()
                      .sendMessage(
                          "The dragon seems immune to this spell");
                  return;
                }
              }
              if (owner.getLocation().inWilderness()) {
                owner.getActionSender().sendMessage(
                    "Can not use this spell in wilderness");
                return;
              }
              boolean bool = false;
              ListIterator<InvItem> iterat = owner.getInventory()
                  .getItems().listIterator();
              while (iterat.hasNext()) {
                InvItem cape = iterat.next();
                if (cape.id == 1218 && cape.wielded) {
                  bool = bool || true;
                }
                // else {flag = false;}
              }
              if (bool) {
                if (!owner.isCharged()) {
                  owner.getActionSender().sendMessage(
                      "@red@You are not charged!");
                }

                if (!checkAndRemoveRunes(owner, spell)) {
                  return;
                }
                if (affectedMob instanceof Player
                    && !owner.isDueling()) {
                  Player affectedPlayer = (Player) affectedMob;
                  owner.setSkulledOn(affectedPlayer);
                }
                // int damag = Rand(0, 25);
                int damag = Formulae.calcGodSpells(owner,
                    affectedMob);
                if (affectedMob instanceof Player) {
                  Player affectedPlayer = (Player) affectedMob;
                  affectedPlayer
                      .getActionSender()
                      .sendMessage(
                          owner.getUsername()
                              + " is shooting at you!");
                }
                Projectile projectil = new Projectile(owner,
                    affectedMob, 1);
                godSpellObject(affectedMob, 34);
                affectedMob.setLastDamage(damag);
                int newhp = affectedMob.getHits() - damag;
                affectedMob.setHits(newhp);
                ArrayList<Player> playersToInfor = new ArrayList<Player>();
                playersToInfor.addAll(owner.getViewArea()
                    .getPlayersInView());
                playersToInfor.addAll(affectedMob.getViewArea()
                    .getPlayersInView());
                for (Player p : playersToInfor) {
                  p.informOfProjectile(projectil);
                  p.informOfModifiedHits(affectedMob);
                }
                if (affectedMob instanceof Player) {
                  Player affectedPlayer = (Player) affectedMob;
                  affectedPlayer.getActionSender()
                      .sendStat(3);
                }
                if (newhp <= 0) {
                  affectedMob.killedBy(owner,
                      owner.isDueling());
                }
                owner.getActionSender().sendInventory();
                owner.getActionSender().sendStat(6);
                finalizeSpell(owner, spell);
                break;
              } else {
                owner.getActionSender()
                    .sendMessage(
                        "You need to be wearing the Staff of Saradomin to cast this spell!");
                return;
              }
            case 35:
              if (affectedMob instanceof Npc) {
                if (((Npc) affectedMob).getID() == 477) {
                  player.getActionSender()
                      .sendMessage(
                          "The dragon seems immune to this spell");
                  return;
                }
              }
              if (owner.getLocation().inWilderness()) {
                owner.getActionSender().sendMessage(
                    "Can not use this spell in wilderness");
                return;
              }
              boolean flag2 = false;
              ListIterator<InvItem> iterato = owner
                  .getInventory().getItems().listIterator();
              while (iterato.hasNext()) {
                InvItem cape = iterato.next();
                if (cape.id == 1216 && cape.wielded) {
                  flag2 = flag2 || true;
                }
                // else {flag = false;}
              }
              if (flag2) {
                if (!owner.isCharged()) {
                  owner.getActionSender().sendMessage(
                      "@red@You are not charged!");
                }

                if (!checkAndRemoveRunes(owner, spell)) {
                  return;
                }
                if (affectedMob instanceof Player
                    && !owner.isDueling()) {
                  Player affectedPlayer = (Player) affectedMob;
                  owner.setSkulledOn(affectedPlayer);
                }
                // int damag = Rand(0, 25);
                int damag = Formulae.calcGodSpells(owner,
                    affectedMob);
                if (affectedMob instanceof Player) {
                  Player affectedPlayer = (Player) affectedMob;
                  affectedPlayer
                      .getActionSender()
                      .sendMessage(
                          owner.getUsername()
                              + " is shooting at you!");
                }
                Projectile projectil = new Projectile(owner,
                    affectedMob, 1);
                godSpellObject(affectedMob, 35);
                affectedMob.setLastDamage(damag);
                int newhp = affectedMob.getHits() - damag;
                affectedMob.setHits(newhp);
                ArrayList<Player> playersToInfor = new ArrayList<Player>();
                playersToInfor.addAll(owner.getViewArea()
                    .getPlayersInView());
                playersToInfor.addAll(affectedMob.getViewArea()
                    .getPlayersInView());
                for (Player p : playersToInfor) {
                  p.informOfProjectile(projectil);
                  p.informOfModifiedHits(affectedMob);
                }
                if (affectedMob instanceof Player) {
                  Player affectedPlayer = (Player) affectedMob;
                  affectedPlayer.getActionSender()
                      .sendStat(3);
                }
                if (newhp <= 0) {
                  affectedMob.killedBy(owner,
                      owner.isDueling());
                }
                owner.getActionSender().sendInventory();
                owner.getActionSender().sendStat(6);
                finalizeSpell(owner, spell);
                break;
              } else {
                owner.getActionSender()
                    .sendMessage(
                        "You need to be wearing the Staff of Zaramorak to cast this spell");
                return;
              }

            default:
              if (spell.getReqLevel() == 62
                  || spell.getReqLevel() == 65
                  || spell.getReqLevel() == 70
                  || spell.getReqLevel() == 75) {
                if (!Config.members) {
                  player.getActionSender()
                      .sendMessage(
                          "Must be on a members server to use this");
                  return;
                }
                if (player.getLocation().inWilderness()
                    && Config.f2pWildy) {
                  player.getActionSender()
                      .sendMessage(
                          "You can not cast this Members spell in F2P Wilderness");
                  return;
                }
              }
              if (!checkAndRemoveRunes(owner, spell)) {
                return;
              }

              int max = -1;
              for (int i = 0; i < Constants.GameServer.SPELLS.length; i++) {
                if (spell.getReqLevel() == Constants.GameServer.SPELLS[i][0])
                  max = Constants.GameServer.SPELLS[i][1];
              }
              if (player.getMagicPoints() > 30)
                max += 1;
              int damage = Formulae.calcSpellHit(max,
                  owner.getMagicPoints());
              if (affectedMob instanceof Player) {
                Player affectedPlayer = (Player) affectedMob;
                affectedPlayer.getActionSender().sendMessage(
                    owner.getUsername()
                        + " is shooting at you!");
              }

              if (affectedMob instanceof Npc) {
                Npc npcc = (Npc) affectedMob;
                npcc.getSyndicate().addDamage(owner, damage,
                    Damage.MAGIC_DAMAGE);
              }
              Projectile projectile = new Projectile(owner,
                  affectedMob, 1);
              affectedMob.setLastDamage(damage);
              int newHp = affectedMob.getHits() - damage;
              affectedMob.setHits(newHp);
View Full Code Here

TOP

Related Classes of org.moparscape.msc.gs.model.Projectile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.