Skip to content

Instantly share code, notes, and snippets.

@theresajayne
Created November 29, 2018 14:23
Show Gist options
  • Save theresajayne/3410df9c55d4b0bdc708ab7ea1322369 to your computer and use it in GitHub Desktop.
Save theresajayne/3410df9c55d4b0bdc708ab7ea1322369 to your computer and use it in GitHub Desktop.
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FileDialog;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.awt.image.CropImageFilter;
import java.awt.image.FilteredImageSource;
import java.awt.image.ImageObserver;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Random;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.DataLine.Info;
import javax.sound.sampled.FloatControl.Type;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.CompoundBorder;
import javax.swing.plaf.metal.MetalLookAndFeel;
public class dmnew extends JFrame implements ActionListener, MouseListener, Runnable {
static JFrame frame = null;
static Thread runner;
static int SLEEPTIME = 45;
static boolean NOTRANS;
static boolean NODARK;
static int bonesflag = -1;
static int counter;
static int endcounter;
static int darkcounter;
static int moncycle = 1;
static boolean didquit = false;
static boolean gameover = false;
static boolean alldead = false;
static boolean waitcredits = true;
static String endanim = "fuseend.gif";
static String endsound = "fuseend.wav";
static int leveldark = 15;
static int darkfactor = 255;
static int magictorch = 0;
static int numheroes = 0;
static int herolookx;
static int herolooky;
static int magicvision = 0;
static int floatcounter = 0;
static int dispell = 0;
static int slowcount = 0;
static int freezelife = 0;
static boolean herolook;
static boolean nomovement;
static boolean mapchanging;
static boolean cloudchanging;
static boolean fluxchanging;
static Collection mapstochange = new ArrayList(5);
static Collection cloudstochange = new ArrayList(3);
static HashMap fluxcages = new HashMap(10);
static Random randGen;
static int sleeper;
static boolean climbing = false;
static boolean doorkeyflag = false;
boolean sleeping = false;
boolean viewing = false;
boolean gamefrozen = false;
static JLabel freezelabel;
static JLabel loadinglabel;
static boolean needredraw = false;
boolean needdrawdungeon = true;
int spellready = 0;
int weaponready = 0;
String spellclass = null;
static int leader = 0;
static int walkdcount = 2;
static int walkdelay = 2;
static ArrayList walkqueue = new ArrayList(4);
static ArrayList weaponqueue = new ArrayList(2);
static ArrayList actionqueue = new ArrayList(1);
static ArrayList clickqueue = new ArrayList(1);
static Image back;
static Image doortrack;
static Image altaranim;
static Image mondeathpic;
static Image[] cloudpic = new Image[3];
static Image cloudpicin;
static Image hsheet;
static Image openchest;
static Image poisonedpic;
static Image scrollpic;
static Image deadheropic;
static Image ressreincpic;
static Image hurtweapon;
static Image hurthand;
static Image hurthead;
static Image hurttorso;
static Image hurtlegs;
static Image hurtfeet;
static Image[][] cagepic;
static Image[][] mondarkpic;
static int maxmonnum = 1;
static final int[][] cagex = new int[][]{{0, 0, 384}, {0, 64, 328}, {0, 120, 298}, {0, 148, 278}};
static final int[] cagey = new int[]{0, 22, 50, 62};
static MediaTracker ImageTracker;
static Toolkit tk = Toolkit.getDefaultToolkit();
Cursor dmcursor;
File gamefile;
static FileDialog chooser;
static dmnew.DungView dview;
dmnew.DungMove dmove;
dmnew.DungClick dclick;
dmnew.WeaponSheet weaponsheet;
dmnew.SpellSheet spellsheet;
static dmnew.Message message;
dmnew.Formation formation;
dmnew.Holding holding;
ArrayList compass;
static int compassface;
ImageTilePanel imagePane = new ImageTilePanel();
JPanel contentPane = new JPanel();
JPanel hpanel = new JPanel(false);
JPanel eastpanel = new JPanel(false);
JPanel ecpanel = new JPanel(false);
JPanel centerpanel = new JPanel(false);
JPanel maincenterpan = new JPanel(false);
static dmnew.Hero[] hero = new dmnew.Hero[4];
static dmnew.Hero mirrorhero;
dmnew.HeroClick hclick;
dmnew.SheetClick sheetclick;
static dmnew.HeroSheet herosheet;
static boolean sheet;
CardLayout centerlay;
static int mapwidth;
static int mapheight;
static int numlevels;
static MapObject[][][] DungeonMap;
MapObject[][] visibleg = new MapObject[4][5];
static Wall outWall;
static int partyx;
static int partyy;
static int level;
static int facing = 0;
static int[] heroatsub = new int[]{-1, -1, -1, -1};
static boolean mirrorback;
static boolean iteminhand = false;
static Item inhand = null;
static Item fistfoot;
static ArrayList dmprojs = new ArrayList(4);
static Hashtable dmmons = new Hashtable(23);
static final String[] LEVELNAMES = new String[]{"Neophyte", "Novice", "Apprentice", "Journeyman", "Crafstman", "Artisan", "Adept", "Expert", "LO Master", "UM Master", "ON Master", "EE Master", "PAL Master", "MON Master", "ArchMaster"};
static final int NORTH = 0;
static final int WEST = 1;
static final int SOUTH = 2;
static final int EAST = 3;
static final int FORWARD = 3;
static final int LEFT = 2;
static final int BACK = 1;
static final int RIGHT = 0;
static final int ITEM = 0;
static final int SPELL = 1;
static final int WEAPONHIT = 0;
static final int SPELLHIT = 1;
static final int POISONHIT = 2;
static final int DOORHIT = 3;
static final int STORMHIT = 4;
static final int PROJWEAPONHIT = 5;
static final int FUSEHIT = 6;
static final int DRAINHIT = 7;
static final int[][] SYMBOLCOST = new int[][]{{2, 3, 4, 5, 6, 7}, {3, 4, 6, 7, 9, 10}, {4, 6, 8, 10, 12, 14}, {5, 7, 10, 12, 15, 17}, {6, 9, 12, 15, 18, 21}, {7, 10, 14, 17, 21, 24}, {4, 6, 8, 10, 12, 14}, {5, 7, 10, 12, 15, 17}, {6, 9, 12, 15, 18, 21}, {7, 10, 14, 17, 21, 24}, {7, 10, 14, 17, 21, 24}, {9, 13, 18, 22, 27, 31}, {2, 3, 4, 5, 6, 7}, {2, 3, 4, 5, 6, 7}, {3, 4, 6, 7, 9, 10}, {4, 6, 8, 10, 12, 14}, {6, 9, 12, 15, 18, 21}, {7, 10, 14, 17, 21, 24}};
public dmnew() {
super("Dungeon Master Java");
this.pack();
this.imagePane.setLayout(new BoxLayout(this.imagePane, 1));
this.contentPane.setLayout(new BorderLayout(5, 5));
this.contentPane.setOpaque(false);
this.contentPane.setPreferredSize(new Dimension(662, 582));
this.contentPane.setMaximumSize(new Dimension(662, 582));
this.imagePane.setBackground(Color.black);
this.imagePane.add(Box.createVerticalGlue());
this.imagePane.add(this.contentPane);
this.imagePane.add(Box.createVerticalGlue());
this.setContentPane(this.imagePane);
sleeper = 0;
ImageTracker = new MediaTracker(this);
randGen = new Random();
outWall = new Wall();
outWall.canPassImmaterial = false;
fistfoot = new Item(6);
back = tk.createImage("Maps" + File.separator + "back.gif");
doortrack = tk.createImage("Maps" + File.separator + "doortrack.gif");
altaranim = tk.getImage("Maps" + File.separator + "altaranim.gif");
mondeathpic = tk.createImage("Monsters" + File.separator + "mondeath.png");
cloudpic[0] = tk.createImage("Spells" + File.separator + "poisoncloud1.gif");
cloudpic[1] = tk.createImage("Spells" + File.separator + "poisoncloud2.gif");
cloudpic[2] = tk.createImage("Spells" + File.separator + "poisoncloud3.gif");
cloudpicin = tk.createImage("Spells" + File.separator + "poisoncloud0.gif");
hsheet = tk.createImage("hsheet.gif");
openchest = tk.createImage("openchest.gif");
poisonedpic = tk.createImage("poisoned.gif");
scrollpic = tk.createImage("scroll.gif");
deadheropic = tk.createImage("dead.gif");
ressreincpic = tk.createImage("ressreinc.gif");
hurtweapon = tk.createImage("hurt_weapon.gif");
hurthand = tk.createImage("hurt_hand.gif");
hurthead = tk.createImage("hurt_head.gif");
hurttorso = tk.createImage("hurt_torso.gif");
hurtlegs = tk.createImage("hurt_legs.gif");
hurtfeet = tk.createImage("hurt_feet.gif");
ImageTracker.addImage(back, 0);
ImageTracker.addImage(doortrack, 0);
ImageTracker.addImage(mondeathpic, 0);
ImageTracker.addImage(cloudpic[0], 0);
ImageTracker.addImage(cloudpic[1], 0);
ImageTracker.addImage(cloudpic[2], 0);
ImageTracker.addImage(cloudpicin, 0);
ImageTracker.addImage(hsheet, 0);
ImageTracker.addImage(openchest, 0);
ImageTracker.addImage(poisonedpic, 0);
ImageTracker.addImage(scrollpic, 0);
ImageTracker.addImage(ressreincpic, 0);
ImageTracker.addImage(hurtweapon, 0);
ImageTracker.addImage(hurthand, 0);
ImageTracker.addImage(hurthead, 0);
ImageTracker.addImage(hurttorso, 0);
ImageTracker.addImage(hurtlegs, 0);
ImageTracker.addImage(hurtfeet, 0);
cagepic = new Image[4][3];
int var2;
for(int var1 = 0; var1 < 4; ++var1) {
for(var2 = 0; var2 < 3; ++var2) {
cagepic[var1][var2] = tk.getImage("Maps" + File.separator + "fluxcage" + var1 + "" + (var2 + 1) + ".gif");
ImageTracker.addImage(cagepic[var1][var2], 1);
}
}
this.dmove = new dmnew.DungMove();
this.addKeyListener(this.dmove);
this.contentPane.setBackground(Color.black);
this.setBackground(Color.black);
this.dmcursor = new Cursor(12);
this.hclick = new dmnew.HeroClick();
this.hpanel.setOpaque(false);
this.hpanel.setMinimumSize(new Dimension(420, 130));
this.hpanel.setMaximumSize(new Dimension(420, 130));
this.hpanel.setPreferredSize(new Dimension(420, 130));
for(var2 = 0; var2 < numheroes; ++var2) {
hero[var2].addMouseListener(this.hclick);
}
message = new dmnew.Message();
this.formation = new dmnew.Formation();
this.holding = new dmnew.Holding();
this.compass = new ArrayList();
JPanel var3 = new JPanel();
var3.setOpaque(false);
var3.add(this.hpanel);
var3.setPreferredSize(new Dimension(662, 134));
var3.setBackground(Color.black);
var3.add(Box.createHorizontalStrut(20));
var3.add(this.formation);
this.contentPane.add("North", var3);
this.eastpanel.setOpaque(false);
this.eastpanel.setLayout(new BoxLayout(this.eastpanel, 1));
this.ecpanel.setOpaque(false);
this.ecpanel.setPreferredSize(new Dimension(160, 40));
this.ecpanel.setMaximumSize(new Dimension(160, 40));
this.ecpanel.add(this.holding);
this.eastpanel.add(this.ecpanel);
this.eastpanel.add(Box.createVerticalStrut(10));
this.eastpanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
this.contentPane.add("South", message);
this.contentPane.add("East", this.eastpanel);
this.contentPane.add("West", Box.createHorizontalGlue());
dview = new dmnew.DungView();
this.dclick = new dmnew.DungClick();
dview.addMouseListener(this.dclick);
this.centerlay = new CardLayout();
this.centerpanel.setLayout(this.centerlay);
this.centerpanel.setMinimumSize(new Dimension(448, 326));
this.centerpanel.setMaximumSize(new Dimension(448, 326));
this.centerpanel.setPreferredSize(new Dimension(448, 326));
this.centerpanel.setSize(448, 326);
this.centerpanel.setOpaque(false);
this.maincenterpan.setBorder(BorderFactory.createBevelBorder(1, new Color(60, 60, 80), new Color(20, 20, 40)));
this.maincenterpan.setBackground(Color.black);
this.maincenterpan.setLayout(new BoxLayout(this.maincenterpan, 1));
this.maincenterpan.add(Box.createVerticalGlue());
this.sheetclick = new dmnew.SheetClick();
herosheet = new dmnew.HeroSheet();
BufferedImage var4 = new BufferedImage(200, 100, 5);
Graphics var5 = var4.getGraphics();
var5.setFont(new Font("TimesRoman", 1, 14));
var5.setColor(new Color(70, 70, 70));
var5.drawString("Game Frozen", 63, 63);
var5.setColor(Color.white);
var5.drawString("Game Frozen", 60, 60);
freezelabel = new JLabel(new ImageIcon(var4));
freezelabel.setSize(448, 326);
freezelabel.setBackground(Color.black);
BufferedImage var6 = new BufferedImage(200, 100, 5);
Graphics var7 = var6.getGraphics();
var7.setFont(new Font("TimesRoman", 1, 14));
var7.setColor(new Color(70, 70, 70));
var7.drawString("Loading Game...", 63, 63);
var7.setColor(Color.white);
var7.drawString("Loading Game...", 60, 60);
loadinglabel = new JLabel(new ImageIcon(var6));
loadinglabel.setSize(448, 326);
loadinglabel.setBackground(Color.black);
this.centerpanel.add("dview", dview);
this.centerpanel.add("herosheet", herosheet);
this.centerpanel.add("freeze", freezelabel);
this.centerpanel.add("load", loadinglabel);
this.maincenterpan.add(this.centerpanel);
this.maincenterpan.add(Box.createVerticalGlue());
this.contentPane.add("Center", this.maincenterpan);
dview.offscreen = new BufferedImage(448, 326, 5);
dview.offg = dview.offscreen.createGraphics();
dview.offg.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
dview.offg.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
dview.offg2 = dview.offscreen.createGraphics();
dview.offg2.setComposite(AlphaComposite.getInstance(3, 0.38F));
dview.offg2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
dview.offg2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
herosheet.offscreen = this.createImage(448, 326);
herosheet.offg = (Graphics2D)herosheet.offscreen.getGraphics();
this.requestFocus();
this.hupdate();
message.repaint();
this.setSize(662, 582);
this.setCursor(this.dmcursor);
this.ecpanel.setSize(90, 40);
chooser = new FileDialog(this);
chooser.setLocation(tk.getScreenSize().width / 2 - chooser.getSize().width / 2, tk.getScreenSize().height / 2 - chooser.getSize().height / 2);
new Title(this);
}
public boolean loadMap(File var1) {
try {
FileInputStream var2 = new FileInputStream(var1);
ObjectInputStream var3 = new ObjectInputStream(var2);
boolean var4 = var3.readBoolean();
var3.readBoolean();
if (var4) {
var3.readInt();
var3.readInt();
var3.readInt();
var3.readInt();
}
counter = var3.readInt();
darkcounter = var3.readInt();
darkfactor = var3.readInt();
magictorch = var3.readInt();
magicvision = var3.readInt();
floatcounter = var3.readInt();
dispell = var3.readInt();
slowcount = var3.readInt();
freezelife = var3.readInt();
mapchanging = var3.readBoolean();
cloudchanging = var3.readBoolean();
fluxchanging = var3.readBoolean();
level = var3.readInt();
partyx = var3.readInt();
partyy = var3.readInt();
facing = var3.readInt();
leader = var3.readInt();
var3.readObject();
iteminhand = var3.readBoolean();
if (iteminhand) {
inhand = (Item)var3.readObject();
}
this.spellready = var3.readInt();
this.weaponready = var3.readInt();
mirrorback = var3.readBoolean();
compassface = facing;
int var5 = var3.readInt();
for(int var9 = 0; var9 < var5; ++var9) {
boolean var7 = var3.readBoolean();
int var6 = var3.readInt();
if (var6 > maxmonnum) {
maxmonnum = var6;
}
dmnew.Monster var8;
if (var6 < 28) {
var8 = new dmnew.Monster(var6, var3.readInt(), var3.readInt(), var3.readInt());
} else {
var8 = new dmnew.Monster(var6, var3.readInt(), var3.readInt(), var3.readInt(), var3.readUTF(), var3.readUTF(), var3.readUTF(), var3.readBoolean(), var3.readBoolean(), var3.readBoolean());
}
var8.subsquare = var3.readInt();
var8.health = var3.readInt();
var8.maxhealth = var3.readInt();
var8.mana = var3.readInt();
var8.maxmana = var3.readInt();
var8.facing = var3.readInt();
var8.currentai = var3.readInt();
var8.defaultai = var3.readInt();
var8.HITANDRUN = var3.readBoolean();
var8.isImmaterial = var3.readBoolean();
var8.wasfrightened = var3.readBoolean();
var8.hurt = var3.readBoolean();
var8.wasstuck = var3.readBoolean();
var8.ispoisoned = var3.readBoolean();
if (var8.ispoisoned) {
var8.poisonpow = var3.readInt();
var8.poisoncounter = var3.readInt();
}
var8.timecounter = var3.readInt();
var8.movecounter = var3.readInt();
var8.randomcounter = var3.readInt();
var8.runcounter = var3.readInt();
var8.carrying = (ArrayList)var3.readObject();
var8.gamewin = var3.readBoolean();
if (var8.gamewin) {
var8.endanim = var3.readUTF();
var8.endsound = var3.readUTF();
}
var8.hurtitem = var3.readInt();
var8.needitem = var3.readInt();
var8.needhandneck = var3.readInt();
var8.power = var3.readInt();
var8.defense = var3.readInt();
var8.magicresist = var3.readInt();
var8.speed = var3.readInt();
var8.movespeed = var3.readInt();
var8.attackspeed = var3.readInt();
var8.poison = var3.readInt();
var8.fearresist = var3.readInt();
var8.hasmagic = var3.readBoolean();
if (var8.hasmagic) {
var8.castpower = var3.readInt();
var8.manapower = var3.readInt();
var8.numspells = var3.readInt();
if (var8.numspells > 0) {
var8.knownspells = (String[])var3.readObject();
} else {
var8.hasmagic = false;
}
var8.minproj = var3.readInt();
var8.hasheal = var3.readBoolean();
var8.hasdrain = var3.readBoolean();
}
var8.useammo = var3.readBoolean();
if (var8.useammo) {
var8.ammo = var3.readInt();
}
var8.pickup = var3.readInt();
var8.powerboost = var3.readInt();
var8.defenseboost = var3.readInt();
var8.magicresistboost = var3.readInt();
var8.speedboost = var3.readInt();
var8.manapowerboost = var3.readInt();
var8.movespeedboost = var3.readInt();
var8.attackspeedboost = var3.readInt();
var8.silenced = var3.readBoolean();
if (var8.silenced) {
var8.silencecount = var3.readInt();
}
var8.isdying = var7;
dmmons.put(var8.level + "," + var8.x + "," + var8.y + "," + var8.subsquare, var8);
}
int var10 = var3.readInt();
for(int var14 = 0; var14 < var10; ++var14) {
boolean var12 = var3.readBoolean();
boolean var11 = var3.readBoolean();
dmnew.Projectile var13;
if (var11) {
var13 = new dmnew.Projectile((Item)var3.readObject(), var3.readInt(), var3.readInt(), var3.readInt(), var3.readInt(), var3.readInt(), var3.readInt(), var3.readBoolean(), var3.readBoolean());
} else {
var13 = new dmnew.Projectile((Spell)var3.readObject(), var3.readInt(), var3.readInt(), var3.readInt(), var3.readInt(), var3.readInt(), var3.readInt(), var3.readInt(), var3.readInt(), var3.readBoolean(), var3.readBoolean());
}
var13.isending = var12;
dmprojs.add(var13);
}
var3.readInt();
numlevels = var3.readInt();
mapwidth = var3.readInt();
mapheight = var3.readInt();
DungeonMap = new MapObject[numlevels][mapwidth][mapheight];
int var16;
int var17;
for(int var15 = 0; var15 < numlevels; ++var15) {
for(var16 = 0; var16 < mapwidth; ++var16) {
for(var17 = 0; var17 < mapheight; ++var17) {
DungeonMap[var15][var16][var17] = loadMapObject(var3);
}
}
}
if (mapchanging) {
var16 = var3.readInt();
for(var17 = 0; var17 < var16; ++var17) {
mapstochange.add(var3.readObject());
}
}
mondarkpic = new Image[maxmonnum + 1][12];
Item.darkpic = new Image[Item.maxitemnum + 1][3];
var2.close();
ImageTracker.waitForID(0);
ImageTracker.waitForID(1);
Item.doFlaskBones();
Item.ImageTracker.waitForID(4);
updateDark();
return true;
} catch (InterruptedException var18) {
System.out.println("Interrupted!");
return true;
} catch (Exception var19) {
message.setMessage("Unable to load map!", 4);
System.out.println("Unable to load map.");
var19.printStackTrace();
if (!this.isShowing()) {
JOptionPane.showMessageDialog(this, "Unable to load map!", "Error!", 0);
} else {
JOptionPane.showMessageDialog(this, "Unable to load map!\nApplication may be corrupted.\nLoad another or exit and restart.", "Error!", 0);
}
return false;
}
}
public void startNew() {
numheroes = 1;
heroatsub[0] = 0;
hero[0].isleader = true;
hero[0].addMouseListener(this.hclick);
this.hpanel.add(hero[0]);
this.spellsheet = new dmnew.SpellSheet();
this.weaponsheet = new dmnew.WeaponSheet();
this.eastpanel.add(this.spellsheet);
this.eastpanel.add(Box.createVerticalStrut(20));
this.eastpanel.add(this.weaponsheet);
this.eastpanel.add(Box.createVerticalStrut(10));
this.formation.addNewHero();
hero[0].repaint();
this.spellsheet.update();
this.weaponsheet.update();
herosheet.addMouseListener(this.sheetclick);
updateDark();
}
public static void main(String[] var0) {
for(int var1 = var0.length; var1 > 0; --var1) {
if (var0[var1 - 1].equals("-notrans")) {
NOTRANS = true;
} else if (var0[var1 - 1].equals("-dark")) {
NODARK = false;
}
}
try {
MetalLookAndFeel.setCurrentTheme(new DungTheme());
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception var3) {
var3.printStackTrace();
}
frame = new dmnew();
frame.setDefaultCloseOperation(0);
WindowAdapter var2 = new WindowAdapter() {
public void windowClosing(WindowEvent var1) {
System.exit(0);
}
};
frame.addWindowListener(var2);
}
public void start() {
if (runner == null) {
runner = new Thread(this);
}
runner.start();
}
public void run() {
counter = 0;
endcounter = 0;
darkcounter = 0;
while(!didquit) {
label438:
while(true) {
while(true) {
if (endcounter >= 20) {
break label438;
}
int var16;
if (!nomovement && (!this.needdrawdungeon || sheet)) {
String var1;
int var2;
int var3;
if (!clickqueue.isEmpty()) {
var1 = (String)clickqueue.remove(0);
var2 = Integer.parseInt(var1.substring(0, var1.indexOf(",")));
var3 = Integer.parseInt(var1.substring(var1.indexOf(",") + 1));
this.dclick.processClick(var2, var3);
} else if (!actionqueue.isEmpty()) {
var1 = (String)actionqueue.remove(0);
if (var1.equals("s")) {
if (this.gamefile != null || this.setGameFile(false)) {
this.saveGame();
}
} else if (var1.equals("l")) {
if (this.gamefile != null || this.setGameFile(true)) {
if (this.loadGame(false, numheroes == 0)) {
this.hpanel.repaint();
this.changeCursor();
} else {
nomovement = false;
actionqueue.add("l");
}
}
} else if (var1.equals("o")) {
var2 = (new OptionsDialog(frame, numheroes == 0)).getValue();
if (var2 == 1) {
if (this.setGameFile(true)) {
if (this.loadGame(false, numheroes == 0)) {
this.hpanel.repaint();
} else {
nomovement = false;
actionqueue.add("o");
}
}
} else if (var2 == 2) {
if (this.setGameFile(false)) {
this.saveGame();
}
} else if (var2 == 3 || var2 == 4) {
File var18 = null;
if (var2 == 4) {
chooser.setDirectory("Dungeons");
chooser.setMode(0);
chooser.setTitle("Load a Custom Dungeon Map");
chooser.show();
String var4 = chooser.getFile();
if (var4 != null) {
var18 = new File(chooser.getDirectory() + var4);
}
} else {
var18 = new File("Dungeons" + File.separator + "dungeon.dat");
}
if (var18 != null) {
int var6 = -1;
int var7 = -1;
int var8 = -1;
int var9 = -1;
boolean var5;
boolean var19;
try {
FileInputStream var10 = new FileInputStream(var18);
ObjectInputStream var11 = new ObjectInputStream(var10);
var19 = var11.readBoolean();
var5 = var11.readBoolean();
if (var19) {
var6 = var11.readInt();
var7 = var11.readInt();
var8 = var11.readInt();
var9 = var11.readInt();
}
var10.close();
} catch (Exception var15) {
System.out.println("Unable to load from map.");
var15.printStackTrace(System.out);
JOptionPane.showMessageDialog(frame, "Unable to load map!", "Error!", 0);
nomovement = false;
actionqueue.add("o");
break label438;
}
dmmons.clear();
dmprojs.clear();
mapchanging = false;
cloudchanging = false;
fluxchanging = false;
mapstochange.clear();
cloudstochange.clear();
fluxcages.clear();
this.hpanel.removeAll();
message.clear();
if (numheroes > 0) {
this.spellsheet.casterButton[this.spellready].setText("");
this.spellsheet.casterButton[this.spellready].setPreferredSize(new Dimension(16, 20));
this.spellsheet.casterButton[this.spellready].setMaximumSize(new Dimension(16, 20));
this.spellready = 0;
hero[0] = null;
hero[1] = null;
hero[2] = null;
hero[3] = null;
heroatsub[0] = -1;
heroatsub[1] = -1;
heroatsub[2] = -1;
heroatsub[3] = -1;
numheroes = 0;
}
if (var19) {
JDialog var23 = new JDialog(frame, "Dungeon Master Java - New Game", true);
CreateCharacter var24 = new CreateCharacter(frame, var18, var19, var5, var6, var7, var8, var9, true, var23);
var23.getContentPane().add(var24.getContentPane());
var23.setSize(500, 400);
var23.setLocation(tk.getScreenSize().width / 2 - var24.getSize().width / 2, tk.getScreenSize().height / 2 - var24.getSize().height / 2);
var23.setResizable(false);
WindowAdapter var12 = new WindowAdapter() {
public void windowClosing(WindowEvent var1) {
System.exit(0);
}
};
var23.addWindowListener(var12);
frame.hide();
var23.show();
} else {
this.loadMap(var18);
}
message.repaint();
if (sheet) {
this.centerlay.show(this.centerpanel, "dview");
sheet = false;
}
if (hero[0] != null) {
if (this.spellsheet == null) {
this.startNew();
} else {
numheroes = 1;
heroatsub[0] = 0;
hero[0].isleader = true;
hero[0].addMouseListener(this.hclick);
this.hpanel.add(hero[0]);
this.formation.addNewHero();
hero[0].repaint();
updateDark();
this.spellsheet.casterButton[0].setEnabled(true);
this.spellsheet.update();
this.weaponsheet.weaponButton[0].setEnabled(true);
this.weaponsheet.update();
this.spellsheet.casterButton[0].doClick();
this.weaponsheet.weaponButton[0].doClick();
}
} else {
numheroes = 0;
this.eastpanel.removeAll();
this.eastpanel.add(this.ecpanel);
this.eastpanel.add(Box.createVerticalStrut(10));
this.formation.addNewHero();
updateDark();
}
this.hpanel.repaint();
this.contentPane.validate();
frame.show();
}
}
}
}
++counter;
if (bonesflag > -1) {
this.ressurrection(bonesflag);
bonesflag = -1;
--counter;
} else if (counter != 1 && counter != 5) {
if (counter == 7) {
for(var16 = 0; var16 < numheroes; ++var16) {
hero[var16].timePass();
}
byte var17 = 1;
if (this.sleeping) {
var17 = 2;
}
for(var3 = 0; var3 < var17; ++var3) {
if (magicvision > 0) {
--magicvision;
if (magicvision == 0) {
needredraw = true;
}
}
if (dispell > 0) {
--dispell;
if (dispell == 0) {
needredraw = true;
}
}
if (floatcounter > 0) {
--floatcounter;
if (floatcounter == 0) {
climbing = false;
message.setMessage("Slowfall wears off.", 4);
}
}
if (slowcount > 0) {
--slowcount;
if (slowcount == 0) {
message.setMessage("Slow wears off.", 4);
}
}
if (freezelife > 0) {
--freezelife;
}
}
message.timePass();
} else if (counter == 3) {
this.monstertime();
} else if (counter == 2 && darkfactor > leveldark) {
++darkcounter;
if (this.sleeping) {
darkcounter += 4;
}
if (darkcounter > 400) {
var16 = leveldark;
magictorch -= 20;
if (magictorch < 0) {
magictorch = 0;
}
var16 += magictorch;
for(var2 = 0; var2 < numheroes; ++var2) {
if (hero[var2].weapon.number == 9) {
((Torch)hero[var2].weapon).burnDown();
var16 += ((Torch)hero[var2].weapon).lightboost;
}
if (hero[var2].hand != null && hero[var2].hand.number == 9) {
((Torch)hero[var2].hand).burnDown();
var16 += ((Torch)hero[var2].hand).lightboost;
}
}
if (var16 > 255) {
var16 = 255;
}
darkfactor = var16;
darkcounter = 0;
this.hupdate();
if (sheet) {
herosheet.repaint();
}
needredraw = true;
}
}
} else {
if (mapchanging) {
this.mapChange();
}
if (counter == 5) {
if (cloudchanging) {
this.cloudChange();
}
if (fluxchanging) {
this.fluxChange();
}
}
}
for(; !weaponqueue.isEmpty(); this.weaponsheet.update()) {
var1 = (String)weaponqueue.remove(0);
var2 = Integer.parseInt(var1.substring(0, 1));
var3 = Integer.parseInt(var1.substring(1, 2));
int var20 = Integer.parseInt(var1.substring(2));
if (!hero[var2].isdead && hero[var2].weapon.number == var20) {
hero[var2].useweapon(var3);
}
}
if (counter % 2 == 0) {
if (!dmprojs.isEmpty()) {
this.projectiles();
}
if (!walkqueue.isEmpty()) {
if (walkdcount == walkdelay) {
var16 = 0;
walkdelay = 2;
if (slowcount > 0) {
boolean var22 = true;
while(true) {
while(var16 < numheroes && var22) {
if (!hero[var16].isdead && (hero[var16].feet == null || hero[var16].feet.number != 187)) {
var22 = false;
} else {
++var16;
}
}
if (!var22) {
walkdelay = 8;
}
break;
}
} else {
for(; var16 < numheroes && walkdelay != 8; ++var16) {
if (!hero[var16].isdead && (hero[var16].feet == null || hero[var16].feet.number != 187)) {
if (!hero[var16].hurtfeet && !hero[var16].hurtlegs && hero[var16].load <= hero[var16].maxload) {
if (hero[var16].hurttorso || hero[var16].load > hero[var16].maxload * 3.0F / 4.0F) {
walkdelay = 4;
}
} else {
walkdelay = 8;
}
}
}
}
walkdcount = walkdelay;
}
--walkdcount;
if (walkdcount == 0) {
var16 = (Integer)walkqueue.remove(0);
if (var16 >= 0) {
this.dmove.partyMove(var16);
} else if (var16 == -1) {
this.dmove.turnLeft();
} else {
this.dmove.turnRight();
}
walkdcount = walkdelay;
}
}
if (needredraw) {
needredraw = false;
this.needdrawdungeon = true;
dview.repaint();
if (facing != compassface) {
this.compassUpdate();
}
}
} else if (herolook) {
herolook = false;
nomovement = true;
dview.removeMouseListener(this.dclick);
boolean var21 = false;
for(var2 = 0; var2 < numheroes; ++var2) {
hero[var2].removeMouseListener(this.hclick);
if (!var21 && heroatsub[var2] == -1) {
mirrorhero.subsquare = var2;
var21 = true;
}
}
if (!var21) {
mirrorhero.subsquare = numheroes;
if (mirrorhero.subsquare == 2 && heroatsub[3] == -1) {
mirrorhero.subsquare = 3;
}
}
mirrorhero.heronumber = numheroes;
this.hpanel.add(mirrorhero);
this.hpanel.validate();
herosheet.setHero(mirrorhero, 0);
sheet = true;
this.centerlay.show(this.centerpanel, "herosheet");
}
}
try {
Thread.sleep((long)SLEEPTIME);
} catch (InterruptedException var14) {
}
if (counter > 7) {
counter = 0;
} else if (gameover) {
counter = -2;
++endcounter;
if (endcounter == 1) {
this.removeKeyListener(this.dmove);
dview.removeMouseListener(this.dclick);
if (!alldead) {
for(var16 = 0; var16 < numheroes; ++var16) {
hero[var16].removeMouseListener(this.hclick);
}
endcounter += 18;
}
}
}
}
}
if (gameover) {
if (alldead) {
this.gameOver();
} else {
this.gameWin();
}
gameover = false;
alldead = false;
}
try {
Thread.sleep((long)SLEEPTIME);
} catch (InterruptedException var13) {
}
}
System.exit(0);
}
public void stop() {
if (runner != null && runner.isAlive()) {
runner.interrupt();
runner = null;
}
}
public void changeCursor() {
if (iteminhand) {
this.dmcursor = tk.createCustomCursor(inhand.pic, new Point(10, 10), "dmc");
} else {
this.dmcursor = new Cursor(12);
}
this.setCursor(this.dmcursor);
this.holding.repaint();
}
public static void updateDark() {
int var0 = leveldark + magictorch;
for(int var1 = 0; var1 < numheroes; ++var1) {
if (hero[var1].weapon.number == 9) {
var0 += ((Torch)hero[var1].weapon).lightboost;
}
if (hero[var1].hand != null && hero[var1].hand.number == 9) {
var0 += ((Torch)hero[var1].hand).lightboost;
}
}
if (var0 > 255) {
var0 = 255;
}
darkfactor = var0;
needredraw = true;
}
public void hupdate() {
for(int var1 = 0; var1 < numheroes; ++var1) {
hero[var1].repaint();
}
}
public void compassUpdate() {
if (numheroes != 0) {
Iterator var2 = this.compass.iterator();
while(var2.hasNext()) {
Compass var1 = (Compass)var2.next();
var1.setPic(facing);
if (inhand == var1) {
this.changeCursor();
}
}
compassface = facing;
for(int var3 = 0; var3 < numheroes; ++var3) {
hero[var3].repaint();
}
this.weaponsheet.update();
}
}
public void projectiles() {
int var2 = 0;
while(true) {
while(var2 < dmprojs.size()) {
dmnew.Projectile var1 = (dmnew.Projectile)dmprojs.get(var2);
int var3;
int var4;
if (var1.isending) {
dmprojs.remove(var2);
--DungeonMap[var1.level][var1.x][var1.y].numProjs;
if (var1.level == level) {
var3 = var1.x - partyx;
if (var3 < 0) {
var3 *= -1;
}
var4 = var1.y - partyy;
if (var4 < 0) {
var4 *= -1;
}
if (var3 < 5 && var4 < 5) {
needredraw = true;
}
}
} else if (!var1.needsfirstdraw) {
var1.update();
if (var1.isending && var1.it != null) {
dmprojs.remove(var2);
} else {
++var2;
}
} else {
var1.needsfirstdraw = false;
if (var1.level == level) {
var3 = var1.x - partyx;
if (var3 < 0) {
var3 *= -1;
}
var4 = var1.y - partyy;
if (var4 < 0) {
var4 *= -1;
}
if (var3 < 5 && var4 < 5) {
needredraw = true;
}
}
++var2;
}
}
return;
}
}
public void monstertime() {
moncycle = moncycle % 2 + 1;
Enumeration var1 = dmmons.elements();
while(var1.hasMoreElements()) {
((dmnew.Monster)var1.nextElement()).timePass();
}
}
public void mapChange() {
Teleport.currentcycle = (Teleport.lastcycle + 1) % 2;
int var2 = 0;
while(var2 < mapstochange.size()) {
MapPoint var1 = (MapPoint)((ArrayList)mapstochange).get(var2);
if (!DungeonMap[var1.level][var1.x][var1.y].changeState()) {
((ArrayList)mapstochange).remove(var2);
} else {
++var2;
}
}
if (mapstochange.isEmpty()) {
mapchanging = false;
}
Teleport.lastcycle = Teleport.currentcycle;
Teleport.currentcycle = 2;
}
public void cloudChange() {
Iterator var2 = cloudstochange.iterator();
while(var2.hasNext()) {
dmnew.PoisonCloud var1 = (dmnew.PoisonCloud)var2.next();
if (!var1.update()) {
var2.remove();
} else if (this.sleeping && !var1.update()) {
var2.remove();
}
}
if (cloudstochange.isEmpty()) {
cloudchanging = false;
}
}
public void fluxChange() {
Iterator var2 = fluxcages.values().iterator();
while(var2.hasNext()) {
dmnew.FluxCage var1 = (dmnew.FluxCage)var2.next();
if (!var1.update()) {
var2.remove();
} else if (this.sleeping && !var1.update()) {
var2.remove();
}
}
if (fluxcages.isEmpty()) {
fluxchanging = false;
needredraw = true;
}
}
public void ressurrection(int var1) {
nomovement = true;
this.removeKeyListener(this.dmove);
dview.removeMouseListener(this.dclick);
dview.repaint();
playSound("altar.wav", -1, -1);
try {
Thread.sleep(2800L);
} catch (InterruptedException var5) {
}
altaranim.flush();
boolean var2 = false;
for(int var3 = 0; var3 < numheroes; ++var3) {
if (!var2 && heroatsub[var3] == -1) {
hero[var1].subsquare = var3;
heroatsub[var3] = var1;
var2 = true;
}
}
if (!var2) {
hero[var1].subsquare = numheroes;
heroatsub[numheroes] = var1;
}
this.formation.addNewHero();
hero[var1].hurtcounter = 0;
hero[var1].addMouseListener(this.hclick);
hero[var1].isdead = false;
this.spellsheet.casterButton[var1].setEnabled(true);
this.weaponsheet.update();
hero[var1].health = 1;
hero[var1].splready = true;
int var4 = randGen.nextInt(hero[var1].maxstamina / 50 + 1);
if (var4 > 10) {
var4 = 10;
}
dmnew.Hero var10000 = hero[var1];
var10000.maxstamina -= var4;
if (hero[var1].maxstamina < 10) {
hero[var1].maxstamina = 10;
}
hero[var1].stamina = hero[var1].maxstamina / 2 + 1;
var4 = randGen.nextInt(3);
var10000 = hero[var1];
var10000.vitality -= var4;
if (hero[var1].vitality < 1) {
hero[var1].vitality = 1;
}
hero[var1].setMaxLoad();
this.hupdate();
needredraw = true;
this.addKeyListener(this.dmove);
dview.addMouseListener(this.dclick);
nomovement = false;
}
public static void playSound(String var0, int var1, int var2) {
try {
AudioInputStream var3 = AudioSystem.getAudioInputStream(new File("Sounds" + File.separator + var0));
AudioFormat var4 = var3.getFormat();
Info var5 = new Info(class$javax$sound$sampled$Clip == null ? (class$javax$sound$sampled$Clip = class$("javax.sound.sampled.Clip")) : class$javax$sound$sampled$Clip, var3.getFormat(), (int)var3.getFrameLength() * var4.getFrameSize());
Clip var6 = (Clip)AudioSystem.getLine(var5);
var6.open(var3);
double var7 = 1.5D;
if (var1 != -1 || var2 != -1) {
int var9 = var1 - partyx;
int var10 = var2 - partyy;
if (var9 != 0 || var10 != 0) {
double var11 = 0.0D;
var7 -= (double)((int)(Math.sqrt((double)(var10 * var10 + var9 * var9)) + 0.5D)) * 0.2D;
if (var7 < 0.0D) {
var6.close();
return;
}
switch(facing) {
case 0:
if (var9 > 0) {
var11 += 0.75D;
if (var10 > 2 || var10 < -2) {
var11 -= 0.25D;
}
} else if (var9 < 0) {
var11 -= 0.75D;
if (var10 > 2 || var10 < -2) {
var11 += 0.25D;
}
}
break;
case 1:
if (var10 > 0) {
var11 -= 0.75D;
if (var9 > 2 || var9 < -2) {
var11 += 0.25D;
}
} else if (var10 < 0) {
var11 += 0.75D;
if (var9 > 2 || var9 < -2) {
var11 -= 0.25D;
}
}
break;
case 2:
if (var9 > 0) {
var11 -= 0.75D;
if (var10 > 2 || var10 < -2) {
var11 += 0.25D;
}
} else if (var9 < 0) {
var11 += 0.75D;
if (var10 > 2 || var10 < -2) {
var11 -= 0.25D;
}
}
break;
case 3:
if (var10 > 0) {
var11 += 0.75D;
if (var9 > 2 || var9 < -2) {
var11 -= 0.25D;
}
} else if (var10 < 0) {
var11 -= 0.75D;
if (var9 > 2 || var9 < -2) {
var11 += 0.25D;
}
}
}
FloatControl var13 = (FloatControl)var6.getControl(Type.PAN);
var13.setValue((float)var11);
}
}
FloatControl var15 = (FloatControl)var6.getControl(Type.MASTER_GAIN);
float var16 = (float)(Math.log(var7) / Math.log(10.0D) * 20.0D);
var15.setValue(var16);
var6.start();
} catch (Exception var14) {
}
}
public void saveGame() {
try {
nomovement = true;
if (this.gamefile.exists()) {
String var1 = this.gamefile.getPath();
File var2 = new File(var1 + ".bak");
if (var2.exists()) {
var2.delete();
}
this.gamefile.renameTo(var2);
this.gamefile = new File(var1);
}
FileOutputStream var12 = new FileOutputStream(this.gamefile);
ObjectOutputStream var13 = new ObjectOutputStream(var12);
var13.writeBoolean(false);
var13.writeBoolean(false);
var13.writeInt(counter);
var13.writeInt(darkcounter);
var13.writeInt(darkfactor);
var13.writeInt(magictorch);
var13.writeInt(magicvision);
var13.writeInt(floatcounter);
var13.writeInt(dispell);
var13.writeInt(slowcount);
var13.writeInt(freezelife);
var13.writeBoolean(mapchanging);
var13.writeBoolean(cloudchanging);
var13.writeBoolean(fluxchanging);
var13.writeInt(level);
var13.writeInt(partyx);
var13.writeInt(partyy);
var13.writeInt(facing);
var13.writeInt(leader);
var13.writeObject(heroatsub);
var13.writeBoolean(iteminhand);
if (iteminhand) {
var13.writeObject(inhand);
}
var13.writeInt(this.spellready);
var13.writeInt(this.weaponready);
var13.writeBoolean(mirrorback);
var13.writeInt(dmmons.size());
Enumeration var4 = dmmons.elements();
dmnew.Monster var3;
while(var4.hasMoreElements()) {
var3 = (dmnew.Monster)var4.nextElement();
var13.writeBoolean(var3.isdying);
var13.writeInt(var3.number);
var13.writeInt(var3.x);
var13.writeInt(var3.y);
var13.writeInt(var3.level);
if (var3.number > 27) {
var13.writeUTF(var3.name);
var13.writeUTF(var3.picstring);
var13.writeUTF(var3.soundstring);
var13.writeBoolean(var3.canusestairs);
var13.writeBoolean(var3.isflying);
var13.writeBoolean(var3.ignoremons);
}
var13.writeInt(var3.subsquare);
var13.writeInt(var3.health);
var13.writeInt(var3.maxhealth);
var13.writeInt(var3.mana);
var13.writeInt(var3.maxmana);
var13.writeInt(var3.facing);
var13.writeInt(var3.currentai);
var13.writeInt(var3.defaultai);
var13.writeBoolean(var3.HITANDRUN);
var13.writeBoolean(var3.isImmaterial);
var13.writeBoolean(var3.wasfrightened);
var13.writeBoolean(var3.hurt);
var13.writeBoolean(var3.wasstuck);
var13.writeBoolean(var3.ispoisoned);
if (var3.ispoisoned) {
var13.writeInt(var3.poisonpow);
var13.writeInt(var3.poisoncounter);
}
var13.writeInt(var3.timecounter);
var13.writeInt(var3.movecounter);
var13.writeInt(var3.randomcounter);
var13.writeInt(var3.runcounter);
var13.writeObject(var3.carrying);
var13.writeBoolean(var3.gamewin);
if (var3.gamewin) {
var13.writeUTF(var3.endanim);
var13.writeUTF(var3.endsound);
}
var13.writeInt(var3.hurtitem);
var13.writeInt(var3.needitem);
var13.writeInt(var3.needhandneck);
var13.writeInt(var3.power);
var13.writeInt(var3.defense);
var13.writeInt(var3.magicresist);
var13.writeInt(var3.speed);
var13.writeInt(var3.movespeed);
var13.writeInt(var3.attackspeed);
var13.writeInt(var3.poison);
var13.writeInt(var3.fearresist);
var13.writeBoolean(var3.hasmagic);
if (var3.hasmagic) {
var13.writeInt(var3.castpower);
var13.writeInt(var3.manapower);
var13.writeInt(var3.numspells);
if (var3.numspells > 0) {
var13.writeObject(var3.knownspells);
}
var13.writeInt(var3.minproj);
var13.writeBoolean(var3.hasheal);
var13.writeBoolean(var3.hasdrain);
}
var13.writeBoolean(var3.useammo);
if (var3.useammo) {
var13.writeInt(var3.ammo);
}
var13.writeInt(var3.pickup);
var13.writeInt(var3.powerboost);
var13.writeInt(var3.defenseboost);
var13.writeInt(var3.magicresistboost);
var13.writeInt(var3.speedboost);
var13.writeInt(var3.manapowerboost);
var13.writeInt(var3.movespeedboost);
var13.writeInt(var3.attackspeedboost);
var13.writeBoolean(var3.silenced);
if (var3.silenced) {
var13.writeInt(var3.silencecount);
}
}
var3 = null;
var13.writeInt(dmprojs.size());
Iterator var6 = dmprojs.iterator();
dmnew.Projectile var5;
while(var6.hasNext()) {
var5 = (dmnew.Projectile)var6.next();
var13.writeBoolean(var5.isending);
if (var5.it != null) {
var13.writeBoolean(true);
var13.writeObject(var5.it);
} else {
var13.writeBoolean(false);
var13.writeObject(var5.sp);
}
var13.writeInt(var5.level);
var13.writeInt(var5.x);
var13.writeInt(var5.y);
var13.writeInt(var5.dist);
var13.writeInt(var5.direction);
var13.writeInt(var5.subsquare);
if (var5.sp != null) {
var13.writeInt(var5.powdrain);
var13.writeInt(var5.powcount);
}
var13.writeBoolean(var5.justthrown);
var13.writeBoolean(var5.notelnext);
}
var5 = null;
var13.writeInt(numheroes);
for(int var7 = 0; var7 < numheroes; ++var7) {
var13.writeUTF(hero[var7].picname);
var13.writeInt(hero[var7].subsquare);
var13.writeInt(hero[var7].number);
var13.writeUTF(hero[var7].name);
var13.writeUTF(hero[var7].lastname);
var13.writeInt(hero[var7].maxhealth);
var13.writeInt(hero[var7].health);
var13.writeInt(hero[var7].maxstamina);
var13.writeInt(hero[var7].stamina);
var13.writeInt(hero[var7].maxmana);
var13.writeInt(hero[var7].mana);
var13.writeFloat(hero[var7].load);
var13.writeInt(hero[var7].food);
var13.writeInt(hero[var7].water);
var13.writeInt(hero[var7].strength);
var13.writeInt(hero[var7].vitality);
var13.writeInt(hero[var7].dexterity);
var13.writeInt(hero[var7].intelligence);
var13.writeInt(hero[var7].wisdom);
var13.writeInt(hero[var7].defense);
var13.writeInt(hero[var7].magicresist);
var13.writeInt(hero[var7].strengthboost);
var13.writeInt(hero[var7].vitalityboost);
var13.writeInt(hero[var7].dexterityboost);
var13.writeInt(hero[var7].intelligenceboost);
var13.writeInt(hero[var7].wisdomboost);
var13.writeInt(hero[var7].defenseboost);
var13.writeInt(hero[var7].magicresistboost);
var13.writeInt(hero[var7].flevel);
var13.writeInt(hero[var7].nlevel);
var13.writeInt(hero[var7].plevel);
var13.writeInt(hero[var7].wlevel);
var13.writeInt(hero[var7].fxp);
var13.writeInt(hero[var7].nxp);
var13.writeInt(hero[var7].pxp);
var13.writeInt(hero[var7].wxp);
var13.writeBoolean(hero[var7].isdead);
var13.writeBoolean(hero[var7].splready);
var13.writeBoolean(hero[var7].wepready);
var13.writeBoolean(hero[var7].ispoisoned);
if (hero[var7].ispoisoned) {
var13.writeInt(hero[var7].poison);
var13.writeInt(hero[var7].poisoncounter);
}
var13.writeBoolean(hero[var7].silenced);
if (hero[var7].silenced) {
var13.writeInt(hero[var7].silencecount);
}
var13.writeBoolean(hero[var7].hurtweapon);
var13.writeBoolean(hero[var7].hurthand);
var13.writeBoolean(hero[var7].hurthead);
var13.writeBoolean(hero[var7].hurttorso);
var13.writeBoolean(hero[var7].hurtlegs);
var13.writeBoolean(hero[var7].hurtfeet);
var13.writeInt(hero[var7].timecounter);
var13.writeInt(hero[var7].walkcounter);
var13.writeInt(hero[var7].spellcount);
var13.writeInt(hero[var7].weaponcount);
var13.writeInt(hero[var7].kuswordcount);
var13.writeInt(hero[var7].rosbowcount);
var13.writeUTF(hero[var7].currentspell);
if (hero[var7].weapon == fistfoot) {
var13.writeBoolean(false);
} else {
var13.writeBoolean(true);
var13.writeObject(hero[var7].weapon);
}
if (hero[var7].hand == null) {
var13.writeBoolean(false);
} else {
var13.writeBoolean(true);
var13.writeObject(hero[var7].hand);
}
if (hero[var7].head == null) {
var13.writeBoolean(false);
} else {
var13.writeBoolean(true);
var13.writeObject(hero[var7].head);
}
if (hero[var7].torso == null) {
var13.writeBoolean(false);
} else {
var13.writeBoolean(true);
var13.writeObject(hero[var7].torso);
}
if (hero[var7].legs == null) {
var13.writeBoolean(false);
} else {
var13.writeBoolean(true);
var13.writeObject(hero[var7].legs);
}
if (hero[var7].feet == null) {
var13.writeBoolean(false);
} else {
var13.writeBoolean(true);
var13.writeObject(hero[var7].feet);
}
if (hero[var7].neck == null) {
var13.writeBoolean(false);
} else {
var13.writeBoolean(true);
var13.writeObject(hero[var7].neck);
}
if (hero[var7].pouch1 == null) {
var13.writeBoolean(false);
} else {
var13.writeBoolean(true);
var13.writeObject(hero[var7].pouch1);
}
if (hero[var7].pouch2 == null) {
var13.writeBoolean(false);
} else {
var13.writeBoolean(true);
var13.writeObject(hero[var7].pouch2);
}
var13.writeObject(hero[var7].quiver);
var13.writeObject(hero[var7].pack);
}
var13.writeInt(numlevels);
var13.writeInt(mapwidth);
var13.writeInt(mapheight);
for(int var8 = 0; var8 < numlevels; ++var8) {
for(int var9 = 0; var9 < mapwidth; ++var9) {
for(int var10 = 0; var10 < mapheight; ++var10) {
DungeonMap[var8][var9][var10].save(var13);
}
}
}
if (mapchanging) {
var13.writeInt(mapstochange.size());
Iterator var14 = mapstochange.iterator();
while(var14.hasNext()) {
var13.writeObject(var14.next());
}
}
Iterator var17;
if (cloudchanging) {
var13.writeInt(cloudstochange.size());
var17 = cloudstochange.iterator();
while(var17.hasNext()) {
dmnew.PoisonCloud var15 = (dmnew.PoisonCloud)var17.next();
var13.writeInt(var15.level);
var13.writeInt(var15.x);
var13.writeInt(var15.y);
var13.writeInt(var15.stage);
var13.writeInt(var15.stagecounter);
}
}
if (fluxchanging) {
var13.writeInt(fluxcages.size());
var17 = fluxcages.values().iterator();
while(var17.hasNext()) {
dmnew.FluxCage var16 = (dmnew.FluxCage)var17.next();
var13.writeInt(var16.level);
var13.writeInt(var16.x);
var13.writeInt(var16.y);
var13.writeInt(var16.counter);
}
}
var13.flush();
var12.close();
message.setMessage("Game Saved.", 4);
} catch (Exception var11) {
message.setMessage("Unable to save game!", 4);
System.out.println("Unable to save game!");
JOptionPane.showMessageDialog(this, "Unable to save game!", "Error!", 0);
var11.printStackTrace();
nomovement = false;
}
nomovement = false;
}
public boolean setGameFile(boolean var1) {
chooser.setDirectory("Saves");
String var2;
if (var1) {
chooser.setMode(0);
chooser.setTitle("Load a Saved Game");
chooser.show();
var2 = chooser.getFile();
} else {
chooser.setMode(1);
chooser.setTitle("Save This Game");
chooser.show();
var2 = chooser.getFile();
}
if (var2 != null) {
this.gamefile = new File(chooser.getDirectory() + var2);
return true;
} else {
return false;
}
}
public boolean loadGame(boolean var1) {
return this.loadGame(var1, false);
}
public boolean loadGame(boolean var1, boolean var2) {
try {
if (!var1) {
if (!var2) {
this.spellsheet.setVisible(false);
this.weaponsheet.setVisible(false);
this.formation.setVisible(false);
this.formation.ischanging = false;
}
this.centerlay.show(this.centerpanel, "load");
}
nomovement = true;
FileInputStream var3 = new FileInputStream(this.gamefile);
ObjectInputStream var4 = new ObjectInputStream(var3);
int var5;
if (!var1) {
dmmons.clear();
dmprojs.clear();
mapchanging = false;
cloudchanging = false;
fluxchanging = false;
mapstochange.clear();
cloudstochange.clear();
fluxcages.clear();
walkqueue.clear();
weaponqueue.clear();
actionqueue.clear();
this.viewing = false;
if (!var2) {
this.hpanel.removeAll();
for(var5 = 0; var5 < numheroes; ++var5) {
hero[var5] = null;
}
this.spellsheet.casterButton[this.spellready].setText("");
this.spellsheet.casterButton[this.spellready].setPreferredSize(new Dimension(16, 20));
this.spellsheet.casterButton[this.spellready].setMaximumSize(new Dimension(16, 20));
}
}
var4.readBoolean();
var4.readBoolean();
counter = var4.readInt();
darkcounter = var4.readInt();
darkfactor = var4.readInt();
magictorch = var4.readInt();
magicvision = var4.readInt();
floatcounter = var4.readInt();
dispell = var4.readInt();
slowcount = var4.readInt();
freezelife = var4.readInt();
mapchanging = var4.readBoolean();
cloudchanging = var4.readBoolean();
fluxchanging = var4.readBoolean();
level = var4.readInt();
partyx = var4.readInt();
partyy = var4.readInt();
facing = var4.readInt();
leader = var4.readInt();
heroatsub = (int[])var4.readObject();
iteminhand = var4.readBoolean();
if (iteminhand) {
inhand = (Item)var4.readObject();
if (inhand.number == 8) {
this.compass.add(inhand);
}
}
this.spellready = var4.readInt();
this.weaponready = var4.readInt();
mirrorback = var4.readBoolean();
var5 = var4.readInt();
for(int var9 = 0; var9 < var5; ++var9) {
boolean var7 = var4.readBoolean();
int var6 = var4.readInt();
if (var6 > maxmonnum) {
maxmonnum = var6;
}
dmnew.Monster var8;
if (var6 < 28) {
var8 = new dmnew.Monster(var6, var4.readInt(), var4.readInt(), var4.readInt());
} else {
var8 = new dmnew.Monster(var6, var4.readInt(), var4.readInt(), var4.readInt(), var4.readUTF(), var4.readUTF(), var4.readUTF(), var4.readBoolean(), var4.readBoolean(), var4.readBoolean());
}
var8.subsquare = var4.readInt();
var8.health = var4.readInt();
var8.maxhealth = var4.readInt();
var8.mana = var4.readInt();
var8.maxmana = var4.readInt();
var8.facing = var4.readInt();
var8.currentai = var4.readInt();
var8.defaultai = var4.readInt();
var8.HITANDRUN = var4.readBoolean();
var8.isImmaterial = var4.readBoolean();
var8.wasfrightened = var4.readBoolean();
var8.hurt = var4.readBoolean();
var8.wasstuck = var4.readBoolean();
var8.ispoisoned = var4.readBoolean();
if (var8.ispoisoned) {
var8.poisonpow = var4.readInt();
var8.poisoncounter = var4.readInt();
}
var8.timecounter = var4.readInt();
var8.movecounter = var4.readInt();
var8.randomcounter = var4.readInt();
var8.runcounter = var4.readInt();
var8.carrying = (ArrayList)var4.readObject();
var8.gamewin = var4.readBoolean();
if (var8.gamewin) {
var8.endanim = var4.readUTF();
var8.endsound = var4.readUTF();
}
var8.hurtitem = var4.readInt();
var8.needitem = var4.readInt();
var8.needhandneck = var4.readInt();
var8.power = var4.readInt();
var8.defense = var4.readInt();
var8.magicresist = var4.readInt();
var8.speed = var4.readInt();
var8.movespeed = var4.readInt();
var8.attackspeed = var4.readInt();
var8.poison = var4.readInt();
var8.fearresist = var4.readInt();
var8.hasmagic = var4.readBoolean();
if (var8.hasmagic) {
var8.castpower = var4.readInt();
var8.manapower = var4.readInt();
var8.numspells = var4.readInt();
if (var8.numspells > 0) {
var8.knownspells = (String[])var4.readObject();
} else {
var8.hasmagic = false;
}
var8.minproj = var4.readInt();
var8.hasheal = var4.readBoolean();
var8.hasdrain = var4.readBoolean();
}
var8.useammo = var4.readBoolean();
if (var8.useammo) {
var8.ammo = var4.readInt();
}
var8.pickup = var4.readInt();
var8.powerboost = var4.readInt();
var8.defenseboost = var4.readInt();
var8.magicresistboost = var4.readInt();
var8.speedboost = var4.readInt();
var8.manapowerboost = var4.readInt();
var8.movespeedboost = var4.readInt();
var8.attackspeedboost = var4.readInt();
var8.silenced = var4.readBoolean();
if (var8.silenced) {
var8.silencecount = var4.readInt();
}
var8.isdying = var7;
dmmons.put(var8.level + "," + var8.x + "," + var8.y + "," + var8.subsquare, var8);
}
int var10 = var4.readInt();
for(int var14 = 0; var14 < var10; ++var14) {
boolean var12 = var4.readBoolean();
boolean var11 = var4.readBoolean();
dmnew.Projectile var13;
if (var11) {
var13 = new dmnew.Projectile((Item)var4.readObject(), var4.readInt(), var4.readInt(), var4.readInt(), var4.readInt(), var4.readInt(), var4.readInt(), var4.readBoolean(), var4.readBoolean());
} else {
var13 = new dmnew.Projectile((Spell)var4.readObject(), var4.readInt(), var4.readInt(), var4.readInt(), var4.readInt(), var4.readInt(), var4.readInt(), var4.readInt(), var4.readInt(), var4.readBoolean(), var4.readBoolean());
}
var13.isending = var12;
dmprojs.add(var13);
}
numheroes = var4.readInt();
int var16;
for(int var15 = 0; var15 < numheroes; ++var15) {
hero[var15] = new dmnew.Hero(var4.readUTF());
hero[var15].heronumber = var15;
hero[var15].subsquare = var4.readInt();
hero[var15].number = var4.readInt();
hero[var15].name = var4.readUTF();
hero[var15].lastname = var4.readUTF();
hero[var15].maxhealth = var4.readInt();
hero[var15].health = var4.readInt();
hero[var15].maxstamina = var4.readInt();
hero[var15].stamina = var4.readInt();
hero[var15].maxmana = var4.readInt();
hero[var15].mana = var4.readInt();
hero[var15].load = var4.readFloat();
hero[var15].food = var4.readInt();
hero[var15].water = var4.readInt();
hero[var15].strength = var4.readInt();
hero[var15].vitality = var4.readInt();
hero[var15].dexterity = var4.readInt();
hero[var15].intelligence = var4.readInt();
hero[var15].wisdom = var4.readInt();
hero[var15].defense = var4.readInt();
hero[var15].magicresist = var4.readInt();
hero[var15].strengthboost = var4.readInt();
hero[var15].vitalityboost = var4.readInt();
hero[var15].dexterityboost = var4.readInt();
hero[var15].intelligenceboost = var4.readInt();
hero[var15].wisdomboost = var4.readInt();
hero[var15].defenseboost = var4.readInt();
hero[var15].magicresistboost = var4.readInt();
hero[var15].flevel = var4.readInt();
hero[var15].nlevel = var4.readInt();
hero[var15].plevel = var4.readInt();
hero[var15].wlevel = var4.readInt();
hero[var15].fxp = var4.readInt();
hero[var15].nxp = var4.readInt();
hero[var15].pxp = var4.readInt();
hero[var15].wxp = var4.readInt();
hero[var15].isdead = var4.readBoolean();
hero[var15].splready = var4.readBoolean();
hero[var15].wepready = var4.readBoolean();
hero[var15].ispoisoned = var4.readBoolean();
if (hero[var15].ispoisoned) {
hero[var15].poison = var4.readInt();
hero[var15].poisoncounter = var4.readInt();
}
hero[var15].silenced = var4.readBoolean();
if (hero[var15].silenced) {
hero[var15].silencecount = var4.readInt();
}
hero[var15].hurtweapon = var4.readBoolean();
hero[var15].hurthand = var4.readBoolean();
hero[var15].hurthead = var4.readBoolean();
hero[var15].hurttorso = var4.readBoolean();
hero[var15].hurtlegs = var4.readBoolean();
hero[var15].hurtfeet = var4.readBoolean();
hero[var15].timecounter = var4.readInt();
hero[var15].walkcounter = var4.readInt();
hero[var15].spellcount = var4.readInt();
hero[var15].weaponcount = var4.readInt();
hero[var15].kuswordcount = var4.readInt();
hero[var15].rosbowcount = var4.readInt();
hero[var15].currentspell = var4.readUTF();
if (var4.readBoolean()) {
hero[var15].weapon = (Item)var4.readObject();
if (hero[var15].weapon.number == 9) {
((Torch)hero[var15].weapon).setPic();
}
} else {
hero[var15].weapon = fistfoot;
}
if (var4.readBoolean()) {
hero[var15].hand = (Item)var4.readObject();
if (hero[var15].hand.number == 9) {
((Torch)hero[var15].hand).setPic();
}
}
if (var4.readBoolean()) {
hero[var15].head = (Item)var4.readObject();
}
if (var4.readBoolean()) {
hero[var15].torso = (Item)var4.readObject();
}
if (var4.readBoolean()) {
hero[var15].legs = (Item)var4.readObject();
}
if (var4.readBoolean()) {
hero[var15].feet = (Item)var4.readObject();
}
if (var4.readBoolean()) {
hero[var15].neck = (Item)var4.readObject();
if (hero[var15].neck.number == 89) {
leveldark += 60;
}
}
if (var4.readBoolean()) {
hero[var15].pouch1 = (Item)var4.readObject();
}
if (var4.readBoolean()) {
hero[var15].pouch2 = (Item)var4.readObject();
}
hero[var15].quiver = (Item[])var4.readObject();
hero[var15].pack = (Item[])var4.readObject();
hero[var15].setMaxLoad();
if (var15 == leader) {
hero[var15].isleader = true;
}
hero[var15].setVisible(true);
this.hpanel.add(hero[var15]);
if (!hero[var15].isdead) {
hero[var15].addMouseListener(this.hclick);
}
if ((var1 || var2) && var15 == numheroes - 1) {
this.spellsheet = new dmnew.SpellSheet();
this.weaponsheet = new dmnew.WeaponSheet();
this.eastpanel.add(this.spellsheet);
this.eastpanel.add(Box.createVerticalStrut(20));
this.eastpanel.add(this.weaponsheet);
this.eastpanel.add(Box.createVerticalStrut(10));
for(var16 = 0; var16 < numheroes; ++var16) {
this.spellsheet.casterButton[var16].setEnabled(true);
}
herosheet.addMouseListener(this.sheetclick);
}
if (!var1 && !var2) {
this.spellsheet.casterButton[var15].setEnabled(true);
}
}
for(var16 = 0; var16 < numheroes; ++var16) {
hero[var16].doCompass();
}
this.compassUpdate();
this.hpanel.validate();
this.formation.addNewHero();
numlevels = var4.readInt();
mapwidth = var4.readInt();
mapheight = var4.readInt();
DungeonMap = new MapObject[numlevels][mapwidth][mapheight];
int var18;
int var19;
for(int var17 = 0; var17 < numlevels; ++var17) {
for(var18 = 0; var18 < mapwidth; ++var18) {
for(var19 = 0; var19 < mapheight; ++var19) {
DungeonMap[var17][var18][var19] = loadMapObject(var4);
}
}
}
if (mapchanging) {
var18 = var4.readInt();
for(var19 = 0; var19 < var18; ++var19) {
mapstochange.add(var4.readObject());
}
}
int var20;
if (cloudchanging) {
var19 = var4.readInt();
for(var20 = 0; var20 < var19; ++var20) {
dmnew.PoisonCloud var23 = new dmnew.PoisonCloud(var4.readInt(), var4.readInt(), var4.readInt(), var4.readInt());
var23.stagecounter = var4.readInt();
cloudstochange.add(var23);
}
}
if (fluxchanging) {
var19 = var4.readInt();
for(var20 = 0; var20 < var19; ++var20) {
dmnew.FluxCage var24 = new dmnew.FluxCage(var4.readInt(), var4.readInt(), var4.readInt());
var24.counter = var4.readInt();
fluxcages.put(var24.level + "," + var24.x + "," + var24.y, var24);
}
}
mondarkpic = new Image[maxmonnum + 1][12];
Item.darkpic = new Image[Item.maxitemnum + 1][3];
var3.close();
this.spellsheet.casterButton[this.spellready].doClick();
sheet = false;
ImageTracker.waitForID(0);
ImageTracker.waitForID(1);
ImageTracker.waitForID(2);
Item.ImageTracker.waitForID(4);
System.gc();
this.spellsheet.setVisible(true);
this.weaponsheet.setVisible(true);
this.formation.setVisible(true);
this.hupdate();
this.spellsheet.update();
this.weaponsheet.update();
this.weaponsheet.weaponButton[this.weaponready].setSelected(true);
this.changeCursor();
message.clear();
updateDark();
this.contentPane.validate();
nomovement = false;
this.centerlay.show(this.centerpanel, "dview");
message.setMessage("Game Loaded.", 4);
return true;
} catch (InterruptedException var21) {
System.out.println("Interrupted!");
if (!var1) {
if (!sheet) {
this.centerlay.show(this.centerpanel, "dview");
} else {
this.centerlay.show(this.centerpanel, "hsheet");
}
}
return true;
} catch (Exception var22) {
if (!var1) {
if (!sheet) {
this.centerlay.show(this.centerpanel, "dview");
} else {
this.centerlay.show(this.centerpanel, "hsheet");
}
}
message.setMessage("Unable to load game!", 4);
System.out.println("Unable to load game.");
if (!this.isShowing()) {
JOptionPane.showMessageDialog(this, "Unable to load game!", "Error!", 0);
} else {
JOptionPane.showMessageDialog(this, "Unable to load game!\nApplication may be corrupted.\nLoad another game or exit and restart.", "Error!", 0);
}
var22.printStackTrace();
return false;
}
}
public static MapObject loadMapObject(ObjectInputStream var0) throws IOException, ClassNotFoundException {
Object var2 = null;
ArrayList var14 = null;
char var1 = var0.readChar();
boolean var3 = var0.readBoolean();
boolean var4 = var0.readBoolean();
boolean var5 = var0.readBoolean();
boolean var6 = var0.readBoolean();
boolean var7 = var0.readBoolean();
boolean var8 = var0.readBoolean();
boolean var9 = var0.readBoolean();
int var13 = var0.readInt();
boolean var10 = var0.readBoolean();
boolean var11 = var0.readBoolean();
boolean var12 = var0.readBoolean();
if (var12) {
var14 = (ArrayList)var0.readObject();
}
switch(var1) {
case '!':
var2 = new Stormbringer(var0.readBoolean());
case '"':
case '#':
case '$':
case '%':
case '&':
case '\'':
case '(':
case ')':
case '*':
case '+':
case ',':
case '-':
case '.':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case ':':
case ';':
case '<':
case '=':
case '?':
case '@':
case 'A':
case 'B':
case 'C':
case 'E':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'Q':
case 'R':
case 'T':
case 'U':
case 'V':
case 'X':
case 'Y':
case 'Z':
case '^':
case '_':
case '`':
case 'b':
case 'c':
case 'e':
case 'h':
case 'i':
case 'j':
case 'k':
case 'n':
case 'o':
case 'q':
case 'r':
case 'u':
case 'v':
case 'x':
case 'z':
case '{':
case '|':
default:
break;
case '/':
var2 = new WallSwitch(var0.readInt());
((MapObject)var2).load(var0);
break;
case '0':
var2 = new Floor();
break;
case '1':
if (var7) {
var2 = new Wall();
} else {
var2 = outWall;
}
break;
case '2':
var2 = new FakeWall();
break;
case '>':
var2 = new Stairs(var0.readInt(), var0.readBoolean());
break;
case 'D':
var2 = new Decoration(var0.readInt(), var0.readInt());
break;
case 'F':
var2 = new FDecoration(var0.readInt());
break;
case 'G':
var2 = new PowerGem(var0.readBoolean());
break;
case 'P':
var2 = new Pillar(var0.readInt(), var0.readBoolean());
break;
case 'S':
var2 = new MultFloorSwitch2();
((MapObject)var2).load(var0);
break;
case 'W':
var2 = new GameWinSquare(var0.readUTF(), var0.readUTF());
break;
case '[':
var2 = new Alcove();
((MapObject)var2).load(var0);
break;
case '\\':
var2 = new MultWallSwitch2(var0.readInt());
((MapObject)var2).load(var0);
break;
case ']':
var2 = new OneAlcove(var0.readInt());
((MapObject)var2).load(var0);
break;
case 'a':
var2 = new Altar(var0.readInt());
((MapObject)var2).load(var0);
break;
case 'd':
var2 = new Door((MapPoint)var0.readObject(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readBoolean(), var0.readBoolean(), var0.readBoolean(), var0.readInt(), var0.readBoolean(), var0.readInt(), var0.readInt(), var0.readBoolean(), var0.readInt());
((Door)var2).changecount = var0.readInt();
((Door)var2).isclosing = var0.readBoolean();
if (((Door)var2).isBreakable && !((Door)var2).isBroken) {
((Door)var2).breakpoints = var0.readInt();
}
break;
case 'f':
var2 = new Fountain(var0.readInt());
break;
case 'g':
var2 = new Generator(var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), (dmnew)frame, var0.readInt(), var0.readBoolean(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readBoolean(), new MonsterData(var0));
((Generator)var2).delaying = var0.readBoolean();
if (((Generator)var2).monster.number > maxmonnum) {
maxmonnum = ((Generator)var2).monster.number;
}
break;
case 'l':
int var15 = var0.readInt();
var2 = new Launcher(var0.readInt(), var0.readInt(), var0.readInt(), (dmnew)frame, var15, var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readBoolean(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readBoolean());
((MapObject)var2).load(var0);
break;
case 'm':
var2 = new Mirror(var0.readInt());
if (!var0.readBoolean()) {
((Mirror)var2).wasUsed = false;
((Mirror)var2).hero = (dmnew)frame.new Hero(var0.readUTF());
} else {
((Mirror)var2).wasUsed = true;
}
((MapObject)var2).load(var0);
break;
case 'p':
var2 = new Pit(var0.readInt(), var0.readInt(), var0.readInt(), var0.readBoolean(), var0.readBoolean(), var0.readBoolean(), var0.readBoolean(), var0.readBoolean(), var0.readBoolean(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readBoolean(), var0.readInt(), var0.readInt(), var0.readBoolean());
((Pit)var2).blinkcounter = var0.readInt();
((Pit)var2).delaying = var0.readBoolean();
((Pit)var2).delaycounter = var0.readInt();
((Pit)var2).resetting = var0.readBoolean();
((Pit)var2).resetcounter = var0.readInt();
break;
case 's':
var2 = new FloorSwitch();
((MapObject)var2).load(var0);
break;
case 't':
var2 = new Teleport(var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readInt(), var0.readBoolean(), var0.readBoolean(), var0.readInt(), var0.readInt(), var0.readBoolean(), var0.readBoolean(), var0.readBoolean(), var0.readBoolean(), var0.readBoolean(), var0.readInt(), var0.readInt(), var0.readBoolean(), var0.readBoolean(), var0.readInt(), var0.readBoolean(), var0.readInt(), var0.readBoolean());
break;
case 'w':
var2 = new Writing2(var0.readInt(), (String[])var0.readObject());
break;
case 'y':
var2 = new FulYaPit((MapPoint)var0.readObject(), var0.readInt(), (MapPoint)var0.readObject(), (MapPoint)var0.readObject());
break;
case '}':
var2 = new Sconce(var0.readInt());
((MapObject)var2).load(var0);
}
((MapObject)var2).canHoldItems = var3;
((MapObject)var2).isPassable = var4;
((MapObject)var2).canPassProjs = var5;
((MapObject)var2).canPassMons = var6;
((MapObject)var2).canPassImmaterial = var7;
((MapObject)var2).drawItems = var8;
((MapObject)var2).drawFurtherItems = var9;
((MapObject)var2).numProjs = var13;
((MapObject)var2).hasParty = var10;
((MapObject)var2).hasMons = var11;
((MapObject)var2).hasItems = var12;
if (var12) {
((MapObject)var2).mapItems = var14;
}
return (MapObject)var2;
}
public void gameOver() {
ImageIcon var1 = new ImageIcon(tk.getImage("theend.gif"));
JButton var2 = new JButton("Load Game");
JButton var3 = new JButton("New Game");
JButton var4 = new JButton("New Custom");
JButton var5 = new JButton("Quit");
var2.addActionListener(this);
var3.addActionListener(this);
var4.addActionListener(this);
var5.addActionListener(this);
JLabel var6 = new JLabel(var1);
JPanel var7 = new JPanel();
var7.setOpaque(false);
var7.setBackground(new Color(0, 0, 64));
var7.setSize(448, 72);
var7.add(var2);
var7.add(var3);
var7.add(var4);
var7.add(var5);
this.eastpanel.setVisible(false);
this.contentPane.remove(message);
this.contentPane.add("South", var7);
this.centerpanel.add(var6, "endgame");
this.centerlay.show(this.centerpanel, "endgame");
this.contentPane.paint(this.contentPane.getGraphics());
}
public void actionPerformed(ActionEvent var1) {
if (var1.getActionCommand().equals("Load Game")) {
nomovement = true;
if (!this.setGameFile(true)) {
nomovement = false;
return;
}
this.centerpanel.removeAll();
this.contentPane.removeAll();
this.hpanel.setVisible(true);
this.eastpanel.setVisible(true);
this.spellsheet.setVisible(false);
this.weaponsheet.setVisible(false);
message.clear();
this.centerpanel.add("freeze", freezelabel);
this.centerpanel.add(herosheet, "herosheet");
this.centerpanel.add(dview, "dview");
this.centerpanel.add("load", loadinglabel);
JPanel var2 = new JPanel();
var2.add(this.hpanel);
var2.setPreferredSize(new Dimension(662, 134));
var2.setOpaque(false);
var2.setBackground(Color.black);
var2.add(Box.createHorizontalStrut(20));
var2.add(this.formation);
this.contentPane.add("North", var2);
this.contentPane.add("South", message);
this.contentPane.add("East", this.eastpanel);
this.contentPane.add("West", Box.createHorizontalGlue());
this.contentPane.add("Center", this.maincenterpan);
this.addKeyListener(this.dmove);
dview.addMouseListener(this.dclick);
endcounter = 0;
this.contentPane.doLayout();
this.centerpanel.doLayout();
this.centerlay.show(this.centerpanel, "load");
this.contentPane.doLayout();
this.paint(this.getGraphics());
this.loadGame(false);
} else if (!var1.getActionCommand().equals("New Game") && !var1.getActionCommand().equals("New Custom")) {
didquit = true;
} else {
nomovement = true;
File var13;
if (var1.getActionCommand().equals("New Custom")) {
chooser.setDirectory("Dungeons");
chooser.setMode(0);
chooser.setTitle("Load a Custom Dungeon Map");
chooser.show();
String var3 = chooser.getFile();
if (var3 == null) {
return;
}
var13 = new File(chooser.getDirectory() + var3);
} else {
var13 = new File("Dungeons" + File.separator + "dungeon.dat");
}
System.gc();
int var5 = -1;
int var6 = -1;
int var7 = -1;
int var8 = -1;
boolean var4;
boolean var14;
try {
FileInputStream var9 = new FileInputStream(var13);
ObjectInputStream var10 = new ObjectInputStream(var9);
var14 = var10.readBoolean();
var4 = var10.readBoolean();
if (var14) {
var5 = var10.readInt();
var6 = var10.readInt();
var7 = var10.readInt();
var8 = var10.readInt();
}
var9.close();
} catch (Exception var12) {
System.out.println("Unable to load from map.");
var12.printStackTrace(System.out);
JOptionPane.showMessageDialog(this, "Unable to load map!", "Error!", 0);
return;
}
dmmons.clear();
dmprojs.clear();
mapchanging = false;
cloudchanging = false;
fluxchanging = false;
mapstochange.clear();
cloudstochange.clear();
fluxcages.clear();
this.hpanel.removeAll();
this.spellsheet.casterButton[this.spellready].setText("");
this.spellsheet.casterButton[this.spellready].setPreferredSize(new Dimension(16, 20));
this.spellsheet.casterButton[this.spellready].setMaximumSize(new Dimension(16, 20));
hero[0] = null;
hero[1] = null;
hero[2] = null;
hero[3] = null;
heroatsub[0] = -1;
heroatsub[1] = -1;
heroatsub[2] = -1;
heroatsub[3] = -1;
numheroes = 0;
message.clear();
if (var14) {
JDialog var15 = new JDialog(frame, "Dungeon Master Java - New Game", true);
CreateCharacter var17 = new CreateCharacter(frame, var13, var14, var4, var5, var6, var7, var8, true, var15);
var15.getContentPane().add(var17.getContentPane());
var15.setSize(500, 400);
var15.setLocation(tk.getScreenSize().width / 2 - var17.getSize().width / 2, tk.getScreenSize().height / 2 - var17.getSize().height / 2);
var15.setResizable(false);
WindowAdapter var11 = new WindowAdapter() {
public void windowClosing(WindowEvent var1) {
System.exit(0);
}
};
var15.addWindowListener(var11);
frame.hide();
var15.show();
} else {
this.loadMap(var13);
}
message.repaint();
this.centerlay.show(this.centerpanel, "dview");
sheet = false;
if (hero[0] != null) {
numheroes = 1;
heroatsub[0] = 0;
hero[0].isleader = true;
hero[0].addMouseListener(this.hclick);
this.hpanel.add(hero[0]);
this.formation.addNewHero();
hero[0].repaint();
updateDark();
this.spellready = 0;
this.spellsheet.casterButton[0].setEnabled(true);
this.spellsheet.update();
this.weaponsheet.weaponButton[0].setEnabled(true);
this.weaponsheet.update();
this.spellsheet.casterButton[0].doClick();
this.weaponsheet.weaponButton[0].doClick();
} else {
numheroes = 0;
this.eastpanel.removeAll();
this.eastpanel.add(this.ecpanel);
this.eastpanel.add(Box.createVerticalStrut(10));
this.formation.addNewHero();
updateDark();
this.spellready = 0;
}
this.centerpanel.removeAll();
this.contentPane.removeAll();
this.hpanel.setVisible(true);
this.eastpanel.setVisible(true);
this.centerpanel.add("load", loadinglabel);
this.centerpanel.add("freeze", freezelabel);
this.centerpanel.add(herosheet, "herosheet");
this.centerpanel.add(dview, "dview");
JPanel var16 = new JPanel();
var16.add(this.hpanel);
var16.setPreferredSize(new Dimension(662, 134));
var16.setOpaque(false);
var16.setBackground(Color.black);
var16.add(Box.createHorizontalStrut(20));
var16.add(this.formation);
this.contentPane.add("North", var16);
this.contentPane.add("South", message);
this.contentPane.add("East", this.eastpanel);
this.contentPane.add("West", Box.createHorizontalGlue());
this.contentPane.add("Center", this.maincenterpan);
this.centerlay.show(this.centerpanel, "dview");
this.hupdate();
this.addKeyListener(this.dmove);
dview.addMouseListener(this.dclick);
endcounter = 0;
frame.show();
nomovement = false;
}
}
public void gameWin() {
this.eastpanel.setVisible(false);
message.clear();
ImageIcon var1 = new ImageIcon(tk.getImage("Endings" + File.separator + endanim));
var1.setImageObserver(this);
JLabel var2 = new JLabel(var1);
var2.setBackground(Color.black);
this.centerpanel.add(var2, "endgame");
playSound(endsound, -1, -1);
this.centerlay.show(this.centerpanel, "endgame");
while(waitcredits) {
try {
Thread.currentThread();
Thread.sleep(500L);
} catch (InterruptedException var5) {
}
}
if (!endanim.equals("stormend.gif")) {
try {
Thread.currentThread();
Thread.sleep(3000L);
} catch (InterruptedException var4) {
}
}
var1.setImageObserver((ImageObserver)null);
this.contentPane.removeAll();
var2.setIcon(new ImageIcon("Endings" + File.separator + "credits.gif"));
this.contentPane.add(var2);
var2.addMouseListener(this);
var1.getImage().flush();
}
public boolean imageUpdate(Image var1, int var2, int var3, int var4, int var5, int var6) {
waitcredits = super.imageUpdate(var1, var2, var3, var4, var5, var6);
return waitcredits;
}
public void mousePressed(MouseEvent var1) {
if (!waitcredits) {
waitcredits = true;
JButton var2 = new JButton("Load Game");
JButton var3 = new JButton("New Game");
JButton var4 = new JButton("New Custom");
JButton var5 = new JButton("Quit");
var2.addActionListener(this);
var3.addActionListener(this);
var4.addActionListener(this);
var5.addActionListener(this);
JPanel var6 = new JPanel();
var6.setOpaque(false);
var6.setBackground(new Color(0, 0, 64));
var6.setSize(448, 72);
var6.add(var2);
var6.add(var3);
var6.add(var4);
var6.add(var5);
this.contentPane.add("South", var6);
this.contentPane.validate();
}
}
public void mouseEntered(MouseEvent var1) {
}
public void mouseExited(MouseEvent var1) {
}
public void mouseClicked(MouseEvent var1) {
}
public void mouseReleased(MouseEvent var1) {
}
class Hero extends JComponent {
String name;
String lastname;
String picname;
Image pic;
Item weapon;
Item head;
Item torso;
Item legs;
Item feet;
Item hand;
Item neck;
Item pouch1;
Item pouch2;
Item[] pack;
Item[] quiver;
int heronumber;
int subsquare;
int number;
int maxmana;
int maxhealth;
int maxstamina;
int mana;
int health;
int stamina;
int food;
int water;
int strength;
int vitality;
int dexterity;
int intelligence;
int wisdom;
int defense;
int magicresist;
int flevel;
int nlevel;
int plevel;
int wlevel;
int fxp;
int nxp;
int pxp;
int wxp;
int strengthboost;
int intelligenceboost;
int wisdomboost;
int dexterityboost;
int vitalityboost;
int defenseboost;
int magicresistboost;
float maxload;
float load;
boolean isleader;
boolean isdead;
boolean splready;
boolean wepready;
boolean ispoisoned;
boolean silenced;
boolean hurthead;
boolean hurttorso;
boolean hurtlegs;
boolean hurtfeet;
boolean hurthand;
boolean hurtweapon;
int silencecount;
int hit;
int poison;
int spellcount;
int weaponcount;
int timecounter;
int hurtcounter;
int hitcounter;
int poisoncounter;
int walkcounter;
int kuswordcount;
int rosbowcount;
String currentspell;
public Hero(String var2) {
this.weapon = dmnew.fistfoot;
this.head = null;
this.torso = null;
this.legs = null;
this.feet = null;
this.hand = null;
this.neck = null;
this.pouch1 = null;
this.pouch2 = null;
this.pack = new Item[16];
this.quiver = new Item[6];
this.fxp = 0;
this.nxp = 0;
this.pxp = 0;
this.wxp = 0;
this.isleader = false;
this.isdead = false;
this.splready = true;
this.wepready = true;
this.ispoisoned = false;
this.silenced = false;
this.hurthead = false;
this.hurttorso = false;
this.hurtlegs = false;
this.hurtfeet = false;
this.hurthand = false;
this.hurtweapon = false;
this.silencecount = 0;
this.poison = 0;
this.spellcount = 0;
this.weaponcount = 0;
this.timecounter = 0;
this.hurtcounter = 0;
this.hitcounter = 0;
this.poisoncounter = 0;
this.walkcounter = 0;
this.kuswordcount = 0;
this.rosbowcount = 0;
this.currentspell = "";
this.setPreferredSize(new Dimension(100, 124));
this.setBackground(Color.black);
this.picname = var2;
this.pic = dmnew.tk.getImage(var2);
}
public Hero(String var2, String var3, String var4, int var5, int var6, int var7, int var8, int var9, int var10, int var11, int var12, int var13, int var14, int var15, int var16, int var17, int var18) {
this.weapon = dmnew.fistfoot;
this.head = null;
this.torso = null;
this.legs = null;
this.feet = null;
this.hand = null;
this.neck = null;
this.pouch1 = null;
this.pouch2 = null;
this.pack = new Item[16];
this.quiver = new Item[6];
this.fxp = 0;
this.nxp = 0;
this.pxp = 0;
this.wxp = 0;
this.isleader = false;
this.isdead = false;
this.splready = true;
this.wepready = true;
this.ispoisoned = false;
this.silenced = false;
this.hurthead = false;
this.hurttorso = false;
this.hurtlegs = false;
this.hurtfeet = false;
this.hurthand = false;
this.hurtweapon = false;
this.silencecount = 0;
this.poison = 0;
this.spellcount = 0;
this.weaponcount = 0;
this.timecounter = 0;
this.hurtcounter = 0;
this.hitcounter = 0;
this.poisoncounter = 0;
this.walkcounter = 0;
this.kuswordcount = 0;
this.rosbowcount = 0;
this.currentspell = "";
this.setPreferredSize(new Dimension(100, 124));
this.setBackground(Color.black);
this.picname = var2;
this.pic = dmnew.tk.getImage(this.picname);
this.name = var3;
this.lastname = var4;
this.flevel = var5;
this.nlevel = var6;
this.wlevel = var7;
this.plevel = var8;
this.maxhealth = var9;
this.health = var9;
this.maxstamina = var10;
this.stamina = var10;
this.maxmana = var11;
this.mana = var11;
this.strength = var12;
this.dexterity = var13;
this.vitality = var14;
this.intelligence = var15;
this.wisdom = var16;
this.defense = var17;
this.magicresist = var18;
this.setMaxLoad();
this.load = 0.0F;
this.food = 1000;
this.water = 1000;
}
public void setMaxLoad() {
this.maxload = (float)(this.strength * 4 / 5);
if (this.stamina < this.maxstamina / 5) {
this.maxload = this.maxload * 2.0F / 3.0F;
} else if (this.stamina < this.maxstamina / 3) {
this.maxload = this.maxload * 4.0F / 5.0F;
}
}
public void setLoad() {
if (this.head != null) {
this.load += this.head.weight;
}
if (this.neck != null) {
this.load += this.neck.weight;
}
if (this.torso != null) {
this.load += this.torso.weight;
}
if (this.legs != null) {
this.load += this.legs.weight;
}
if (this.feet != null) {
this.load += this.feet.weight;
}
if (this.hand != null) {
this.load += this.hand.weight;
}
if (this.weapon != null) {
this.load += this.weapon.weight;
}
if (this.pouch1 != null) {
this.load += this.pouch1.weight;
}
if (this.pouch2 != null) {
this.load += this.pouch2.weight;
}
for(int var1 = 0; var1 < 6; ++var1) {
if (this.quiver[var1] != null) {
this.load += this.quiver[var1].weight;
}
}
for(int var2 = 0; var2 < 16; ++var2) {
if (this.pack[var2] != null) {
this.load += this.pack[var2].weight;
}
}
}
public void setDefense() {
if (this.weapon != null && (this.weapon.type == 0 || this.weapon.type == 1)) {
this.weapon.equipEffect(this);
}
if (this.head != null) {
this.head.equipEffect(this);
}
if (this.neck != null) {
this.neck.equipEffect(this);
}
if (this.torso != null) {
this.torso.equipEffect(this);
}
if (this.hand != null) {
this.hand.equipEffect(this);
}
if (this.legs != null) {
this.legs.equipEffect(this);
}
if (this.feet != null) {
this.feet.equipEffect(this);
}
}
public void doCompass() {
if (this.weapon.number == 8) {
dmnew.this.compass.add(this.weapon);
}
if (this.hand != null && this.hand.number == 8) {
dmnew.this.compass.add(this.hand);
}
for(int var1 = 0; var1 < 16; ++var1) {
if (this.pack[var1] != null) {
if (this.pack[var1].number == 8) {
dmnew.this.compass.add(this.pack[var1]);
} else if (this.pack[var1].number == 5) {
for(int var2 = 0; var2 < 6; ++var2) {
Item var3 = ((Chest)this.pack[var1]).itemAt(var2);
if (var3 != null && var3.number == 8) {
dmnew.this.compass.add(var3);
}
}
}
}
}
}
public void eatdrink() {
dmnew.Hero var10000;
if (dmnew.inhand.type == 7) {
this.food += dmnew.inhand.foodvalue;
if (this.food > 1000) {
this.food = 1000;
}
dmnew.iteminhand = false;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
dmnew.inhand = null;
} else if (dmnew.inhand.number != 72 && (dmnew.inhand.number != 73 || ((Waterskin)dmnew.inhand).drinks <= 0)) {
if (!dmnew.inhand.ispotion) {
return;
}
if (!this.usePotion(dmnew.inhand)) {
return;
}
dmnew.inhand = new Item(7);
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= 0.2F;
} else {
this.water += dmnew.inhand.foodvalue;
if (this.water > 1000) {
this.water = 1000;
}
if (dmnew.inhand.number == 72) {
dmnew.inhand = new Item(7);
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= 0.2F;
} else if (dmnew.inhand.number == 73) {
--((Waterskin)dmnew.inhand).drinks;
if (((Waterskin)dmnew.inhand).drinks == 0) {
((Waterskin)dmnew.inhand).swapPics();
}
Item var2 = dmnew.inhand;
var2.weight -= 0.2F;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= 0.2F;
}
}
dmnew.playSound("gulp.wav", -1, -1);
}
public void timePass() {
if (!this.isdead) {
byte var1 = 1;
if (dmnew.this.sleeping) {
var1 = 2;
}
for(int var2 = 0; var2 < var1; ++var2) {
if (this.hurtcounter > 0) {
--this.hurtcounter;
this.repaint();
}
if (!this.wepready && this.weaponcount >= -1) {
--this.weaponcount;
if (this.hitcounter > 0) {
--this.hitcounter;
if (this.hitcounter == 0) {
dmnew.this.weaponsheet.update();
}
}
if (this.weaponcount <= 0) {
this.wepready = true;
if (this.hitcounter > 0) {
this.hitcounter = 0;
}
dmnew.this.weaponsheet.update();
}
}
if (this.silencecount > 0) {
--this.silencecount;
if (this.weapon.number == 215) {
--this.silencecount;
}
if (this.silencecount <= 0) {
this.silencecount = 0;
this.silenced = false;
}
}
if (this.kuswordcount > 0) {
--this.kuswordcount;
if (this.kuswordcount == 0) {
this.weapon = dmnew.fistfoot;
this.repaint();
dmnew.this.weaponsheet.update();
}
} else if (this.rosbowcount > 0) {
--this.rosbowcount;
if (this.rosbowcount == 0) {
this.weapon = dmnew.fistfoot;
this.repaint();
dmnew.this.weaponsheet.update();
}
}
}
if (this.ispoisoned) {
++this.poisoncounter;
this.poisoncounter += dmnew.sleeper;
if (this.poisoncounter > 30) {
this.poisoncounter = 0;
if (this.poison > 15) {
this.poison = 15;
}
this.damage(this.poison, 2);
this.repaint();
if (dmnew.sheet && this.equals(dmnew.herosheet.hero) && !dmnew.this.sleeping && !dmnew.this.viewing) {
dmnew.herosheet.repaint();
}
}
}
++this.timecounter;
this.timecounter += dmnew.sleeper;
if (this.timecounter > 250) {
this.timecounter = 0;
if (!dmnew.this.sleeping && this.weapon.number == 215) {
this.vitalize(-this.maxstamina / 20);
if (!dmnew.this.sleeping && dmnew.numheroes > 1 && dmnew.randGen.nextInt(60) == 0) {
int var3;
for(var3 = dmnew.randGen.nextInt(dmnew.numheroes); dmnew.hero[var3].equals(this); var3 %= dmnew.numheroes) {
++var3;
}
dmnew.hero[var3].damage(dmnew.hero[var3].maxhealth, 4);
dmnew.message.setMessage("Stormbringer feeds...", 5);
this.maxhealth += dmnew.hero[var3].maxhealth / 10;
this.maxstamina += dmnew.hero[var3].maxstamina / 10;
this.maxmana += dmnew.hero[var3].maxmana / 10;
this.strength += dmnew.hero[var3].strength / 10;
this.vitality += dmnew.hero[var3].vitality / 10;
this.intelligence += dmnew.hero[var3].intelligence / 10;
this.health = this.maxhealth;
this.stamina = this.maxstamina;
this.mana = this.maxmana;
this.setMaxLoad();
this.repaint();
}
}
boolean var4 = this.hurtweapon || this.hurthand || this.hurthead || this.hurttorso || this.hurtlegs || this.hurtfeet;
this.food -= 8;
this.water -= 6;
if (!var4) {
this.heal(this.vitality / 8 + 1);
} else {
this.heal(this.vitality / 12 + 1);
}
this.stamcheck();
if (!var4) {
this.vitalize(this.vitality / 8 + 1);
} else {
this.vitalize(this.vitality / 16 + 1);
}
if (!this.hurthead) {
this.energize((this.intelligence + this.wisdom) / 16 + 1);
} else {
this.energize((this.intelligence + this.wisdom) / 24 + 1);
}
if (dmnew.randGen.nextInt(100) + 20 < this.vitality || dmnew.randGen.nextInt(10) == 0) {
--this.poison;
}
if (this.poison <= 0) {
this.ispoisoned = false;
}
if (this.strengthboost > 0) {
--this.strengthboost;
--this.strength;
} else if (this.strengthboost < 0) {
++this.strengthboost;
++this.strength;
}
if (this.dexterityboost > 0) {
--this.dexterityboost;
--this.dexterity;
} else if (this.dexterityboost < 0) {
++this.dexterityboost;
++this.dexterity;
}
if (this.vitalityboost > 0) {
--this.vitalityboost;
--this.vitality;
} else if (this.vitalityboost < 0) {
++this.vitalityboost;
++this.vitality;
}
if (this.intelligenceboost > 0) {
--this.intelligenceboost;
--this.intelligence;
} else if (this.intelligenceboost < 0) {
++this.intelligenceboost;
++this.intelligence;
}
if (this.wisdomboost > 0) {
--this.wisdomboost;
--this.wisdom;
} else if (this.wisdomboost < 0) {
++this.wisdomboost;
++this.wisdom;
}
if (this.defenseboost > 0) {
--this.defenseboost;
--this.defense;
} else if (this.defenseboost < 0) {
++this.defenseboost;
++this.defense;
}
if (this.magicresistboost > 0) {
--this.magicresistboost;
--this.magicresist;
} else if (this.magicresistboost < 0) {
++this.magicresistboost;
++this.magicresist;
}
this.setMaxLoad();
this.repaint();
if (dmnew.sheet && this.equals(dmnew.herosheet.hero) && !dmnew.this.sleeping && !dmnew.this.viewing) {
dmnew.herosheet.repaint();
}
}
if (dmnew.sleeper > 0 || this.timecounter % 25 == 0) {
this.stamcheck();
}
}
}
public void stamcheck() {
if (this.food < 50) {
this.vitalize(-this.maxstamina / 25 - 1);
if (this.food < 11) {
this.food = 10;
}
} else if (this.food < 100) {
this.vitalize(-this.maxstamina / 50 - 1);
}
if (this.water < 75) {
this.vitalize(-this.maxstamina / 25 - 1);
if (this.water < 11) {
this.water = 10;
}
} else if (this.water < 100) {
this.vitalize(-this.maxstamina / 50 - 1);
}
if (this.load > this.maxload * 2.0F) {
this.vitalize(-this.maxstamina / 50 - 1);
}
int var1 = (int)((float)this.stamina / (float)this.maxstamina * 100.0F);
if (var1 < 20) {
int var2 = (int)((float)this.maxhealth / 10.0F) + dmnew.randGen.nextInt(8);
this.damage(var2, 2);
if (dmnew.sheet && this.equals(dmnew.herosheet.hero) && !dmnew.this.sleeping && !dmnew.this.viewing) {
dmnew.herosheet.repaint();
}
}
this.repaint();
}
public void useweapon(int var1) {
int var2;
int var3;
boolean var4;
if (this.weapon.function[var1][0].equals("Shoot")) {
if (this.hand != null && this.hand.projtype == this.weapon.projtype && (double)this.hand.weight <= 1.0D) {
if (this.weapon.name.toLowerCase().indexOf("bow") != -1) {
dmnew.playSound("bow.wav", -1, -1);
} else {
dmnew.playSound("swing.wav", -1, -1);
}
this.hand.shotpow = dmnew.randGen.nextInt() % 10 + this.weapon.power[var1] * this.strength / 24 + this.weapon.power[var1] * this.nlevel / 4;
if (this.hand.shotpow <= 0) {
this.hand.shotpow = dmnew.randGen.nextInt(4) + 1;
}
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
this.wepThrow(this.hand, var2);
this.hand = null;
this.repaint();
var3 = 1;
for(var4 = false; var3 < 6 && !var4; ++var3) {
if (this.quiver[var3] != null && this.quiver[var3].projtype == this.weapon.projtype) {
this.hand = this.quiver[var3];
this.quiver[var3] = null;
var4 = true;
}
}
if (!var4 && this.quiver[0] != null) {
this.hand = this.quiver[0];
this.quiver[0] = null;
if (this.hand.number == 9) {
((Torch)this.hand).setPic();
dmnew.updateDark();
}
if (this.hand.projtype != this.weapon.projtype) {
Item var5 = this.weapon;
this.weapon = this.hand;
this.hand = var5;
this.hand.unEquipEffect(this);
this.weapon.equipEffect(this);
}
}
this.weaponcount = this.weapon.speed[var1];
if (this.dexterity < 40) {
++this.weaponcount;
if (this.dexterity < 30) {
this.weaponcount += 2;
if (this.dexterity < 20) {
this.weaponcount += 2;
if (this.dexterity < 10) {
this.weaponcount += 4;
}
}
}
} else if (this.dexterity > 50) {
--this.weaponcount;
if (this.dexterity > 70) {
--this.weaponcount;
if (this.dexterity > 90) {
--this.weaponcount;
}
}
}
if (this.hurthand || this.hurtweapon) {
this.weaponcount += 4;
}
if (this.weaponcount < 1) {
this.weaponcount = 1;
}
if (this.stamina < this.maxstamina / 5 || this.load > this.maxload) {
this.weaponcount += 4;
}
this.gainxp(this.weapon.function[var1][1].charAt(0), 1);
this.vitalize(-dmnew.randGen.nextInt((int)this.weapon.weight / 2 + this.weapon.power[var1] / 3 + 2));
this.wepready = false;
this.repaint();
} else {
this.hitcounter = 2;
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.missicon);
dmnew.this.weaponsheet.hitlabel.setText("Need Ammo");
this.weaponcount = 2;
}
} else if (this.weapon.function[var1][0].equals("Magic Shot")) {
dmnew.playSound("bow.wav", -1, -1);
Spell var6 = new Spell(this.weapon.power[0]);
var6.power += dmnew.randGen.nextInt((this.nlevel + 1) * 5);
var3 = this.subsquare;
if (var3 == 2) {
var3 = 1;
} else if (var3 == 3) {
var3 = 0;
}
dmnew.this.new Projectile(var6, 50, dmnew.facing, var3);
this.weaponcount = this.weapon.speed[var1];
if (this.dexterity < 40) {
++this.weaponcount;
if (this.dexterity < 30) {
this.weaponcount += 2;
if (this.dexterity < 20) {
this.weaponcount += 2;
if (this.dexterity < 10) {
this.weaponcount += 4;
}
}
}
} else if (this.dexterity > 50) {
--this.weaponcount;
if (this.dexterity > 70) {
--this.weaponcount;
if (this.dexterity > 90) {
--this.weaponcount;
}
}
}
if (this.hurthand || this.hurtweapon) {
this.weaponcount += 4;
}
if (this.weaponcount < 1) {
this.weaponcount = 1;
}
if (this.stamina < this.maxstamina / 5 || this.load > this.maxload) {
this.weaponcount += 4;
}
this.gainxp(this.weapon.function[var1][1].charAt(0), 1);
this.vitalize(-dmnew.randGen.nextInt((int)this.weapon.weight / 2 + this.weapon.power[var1] / 3 + 2));
this.wepready = false;
this.repaint();
} else if (this.weapon.function[var1][0].equals("Drink")) {
if (this.usePotion(this.weapon)) {
dmnew.playSound("gulp.wav", -1, -1);
this.weaponcount = this.weapon.speed[var1];
this.wepready = false;
this.weapon = new Item(7);
this.load -= 0.2F;
this.repaint();
if (dmnew.sheet && dmnew.herosheet.hero.heronumber == this.heronumber) {
dmnew.herosheet.repaint();
}
}
} else {
this.weaponcount = this.weapon.speed[var1];
if (this.dexterity < 40) {
++this.weaponcount;
if (this.dexterity < 30) {
this.weaponcount += 2;
if (this.dexterity < 20) {
this.weaponcount += 2;
if (this.dexterity < 10) {
this.weaponcount += 4;
}
}
}
} else if (this.dexterity > 50) {
--this.weaponcount;
if (this.dexterity > 70) {
--this.weaponcount;
if (this.dexterity > 90) {
--this.weaponcount;
}
}
}
if (this.hurtweapon) {
this.weaponcount += 4;
}
if (this.weaponcount < 1) {
this.weaponcount = 1;
}
if (this.stamina < this.maxstamina / 5 || this.load > this.maxload) {
this.weaponcount += 4;
}
if (!this.weapon.function[var1][0].equals("Climb Down") && !this.weapon.function[var1][0].equals("Climb Up")) {
this.gainxp(this.weapon.function[var1][1].charAt(0), 1);
}
this.vitalize(-dmnew.randGen.nextInt((int)this.weapon.weight / 2 + this.weapon.power[var1] / 3 + 2));
this.wepready = false;
if (this.weapon.function[var1][0].equals("Throw")) {
dmnew.playSound("swing.wav", -1, -1);
this.weapon.shotpow = this.strength / 10 + dmnew.randGen.nextInt(4);
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
this.wepThrow(this.weapon, var2);
this.weapon = dmnew.fistfoot;
this.weapon.unEquipEffect(this);
this.repaint();
var3 = 1;
for(var4 = false; var3 < 6 && !var4; ++var3) {
if (this.quiver[var3] != null) {
this.weapon = this.quiver[var3];
this.quiver[var3] = null;
var4 = true;
}
}
if (!var4 && this.quiver[0] != null) {
this.weapon = this.quiver[0];
this.quiver[0] = null;
if (this.weapon.number == 9) {
((Torch)this.weapon).setPic();
dmnew.updateDark();
}
this.weapon.equipEffect(this);
}
} else if (!this.checkmagic(var1)) {
dmnew.playSound("swing.wav", -1, -1);
if (!this.checkmon(var1)) {
this.checkdoor(var1);
}
}
this.repaint();
}
}
public boolean checkmagic(int var1) {
int var5;
byte var21;
dmnew.Monster var22;
byte var26;
if (this.weapon.function[var1][0].equals("Blow Horn")) {
var26 = 0;
var21 = 0;
if (dmnew.facing == 0) {
var21 = 1;
} else if (dmnew.facing == 1) {
var26 = 1;
} else if (dmnew.facing == 2) {
var21 = -1;
} else {
var26 = -1;
}
for(var5 = 0; var5 < 6; ++var5) {
var22 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + (dmnew.partyx - var26) + "," + (dmnew.partyy - var21) + "," + var5);
if (var22 != null && dmnew.randGen.nextInt(11) < var22.fearresist) {
var22.runcounter += this.weapon.power[var1];
var22.wasfrightened = true;
}
if (var5 == 3) {
++var5;
}
}
return true;
} else if (this.weapon.function[var1][0].equals("Climb Down")) {
var26 = 0;
var21 = 0;
if (dmnew.facing == 0) {
var21 = 1;
} else if (dmnew.facing == 1) {
var26 = 1;
} else if (dmnew.facing == 2) {
var21 = -1;
} else {
var26 = -1;
}
if (dmnew.DungeonMap[dmnew.level][dmnew.partyx - var26][dmnew.partyy - var21].mapchar != 'p' || !((Pit)dmnew.DungeonMap[dmnew.level][dmnew.partyx - var26][dmnew.partyy - var21]).isOpen || dmnew.DungeonMap[dmnew.level][dmnew.partyx - var26][dmnew.partyy - var21].hasMons || dmnew.DungeonMap[dmnew.level + 1][dmnew.partyx - var26][dmnew.partyy - var21].hasMons || dmnew.DungeonMap[dmnew.level + 1][dmnew.partyx - var26][dmnew.partyy - var21].mapchar == 'p' && (dmnew.DungeonMap[dmnew.level + 1][dmnew.partyx - var26][dmnew.partyy - var21].mapchar != 'p' || ((Pit)dmnew.DungeonMap[dmnew.level + 1][dmnew.partyx - var26][dmnew.partyy - var21]).isOpen)) {
dmnew.message.setMessage("Can't Climb Down.", 4);
dmnew.this.weaponsheet.hitlabel.setText("Can't Climb");
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.missicon);
this.hitcounter = 2;
} else {
dmnew.climbing = true;
dmnew.this.dmove.partyMove(3);
this.gainxp('n', 1);
}
return true;
} else {
int var4;
if (this.weapon.function[var1][0].equals("Climb Up")) {
var26 = 0;
var21 = 0;
if (dmnew.facing == 0) {
var21 = 1;
} else if (dmnew.facing == 1) {
var26 = 1;
} else if (dmnew.facing == 2) {
var21 = -1;
} else {
var26 = -1;
}
if (dmnew.level > 0 && dmnew.DungeonMap[dmnew.level - 1][dmnew.partyx][dmnew.partyy].mapchar == 'p' && ((Pit)dmnew.DungeonMap[dmnew.level - 1][dmnew.partyx][dmnew.partyy]).isOpen && dmnew.DungeonMap[dmnew.level - 1][dmnew.partyx - var26][dmnew.partyy - var21].isPassable && !dmnew.DungeonMap[dmnew.level - 1][dmnew.partyx - var26][dmnew.partyy - var21].hasMons) {
--dmnew.level;
dmnew.this.dmove.partyMove(3);
for(var4 = 0; var4 < dmnew.numheroes; ++var4) {
if (!dmnew.hero[var4].isdead) {
dmnew.hero[var4].energize((int)(-dmnew.hero[var4].load));
}
}
this.gainxp('n', 1);
} else {
dmnew.message.setMessage("Can't Climb Up.", 4);
dmnew.this.weaponsheet.hitlabel.setText("Can't Climb");
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.missicon);
this.hitcounter = 2;
}
return true;
} else if (this.weapon.function[var1][0].equals("Detect Illusion")) {
var26 = 0;
var21 = 0;
if (dmnew.facing == 0) {
var21 = 1;
} else if (dmnew.facing == 1) {
var26 = 1;
} else if (dmnew.facing == 2) {
var21 = -1;
} else {
var26 = -1;
}
if (dmnew.randGen.nextInt(16 - this.nlevel) < 5) {
if (dmnew.DungeonMap[dmnew.level][dmnew.partyx - var26][dmnew.partyy - var21].mapchar != '2' && (dmnew.DungeonMap[dmnew.level][dmnew.partyx - var26][dmnew.partyy - var21].mapchar != 'p' || !((Pit)dmnew.DungeonMap[dmnew.level][dmnew.partyx - var26][dmnew.partyy - var21]).isIllusionary)) {
dmnew.message.setMessage(this.name + " senses there is no illusion.", this.heronumber);
} else {
dmnew.message.setMessage(this.name + " senses an illusion.", this.heronumber);
if (dmnew.DungeonMap[dmnew.level][dmnew.partyx - var26][dmnew.partyy - var21].mapchar == 'p') {
((Pit)dmnew.DungeonMap[dmnew.level][dmnew.partyx - var26][dmnew.partyy - var21]).isIllusionary = false;
} else {
Floor var28 = new Floor();
MapObject var24 = dmnew.DungeonMap[dmnew.level][dmnew.partyx - var26][dmnew.partyy - var21];
var28.numProjs = var24.numProjs;
var28.hasMons = var24.hasMons;
var28.hasItems = var24.hasItems;
var28.hasCloud = var24.hasCloud;
if (var28.hasItems) {
while(!var24.mapItems.isEmpty()) {
var28.mapItems.add(var24.mapItems.remove(0));
}
}
dmnew.DungeonMap[dmnew.level][dmnew.partyx - var26][dmnew.partyy - var21] = var28;
}
dmnew.needredraw = true;
}
this.gainxp('n', 1);
} else {
dmnew.message.setMessage(this.name + " fails to sense anything.", 4);
}
return true;
} else if (this.weapon.charges[var1] == 0) {
return false;
} else {
int var25;
if (this.weapon.function[var1][0].equals("Heal")) {
this.heal(this.maxhealth * this.weapon.power[var1] / 100 + 5);
this.repaint();
} else {
int var2;
Spell var3;
int[] var10000;
if (this.weapon.function[var1][0].equals("Fireball")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "44");
for(var4 = var3.gain - 1; var4 >= 0; --var4) {
var10000 = var3.powers;
var10000[var4] += dmnew.randGen.nextInt() % 10 + var4 * this.wlevel;
if (this.wlevel == 15) {
var10000 = var3.powers;
var10000[var4] += dmnew.randGen.nextInt(20);
}
if (var3.powers[var4] < 1) {
var3.powers[var4] = dmnew.randGen.nextInt(4) + 1;
}
}
var3.power = var3.powers[var3.gain - 1];
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var20) {
}
} else if (this.weapon.function[var1][0].equals("Dispell")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "52");
for(var4 = var3.gain - 1; var4 >= 0; --var4) {
var10000 = var3.powers;
var10000[var4] += dmnew.randGen.nextInt() % 10 + var4 * this.wlevel;
if (this.wlevel == 15) {
var10000 = var3.powers;
var10000[var4] += dmnew.randGen.nextInt(20);
}
if (var3.powers[var4] < 1) {
var3.powers[var4] = dmnew.randGen.nextInt(4) + 1;
}
}
var3.power = var3.powers[var3.gain - 1];
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var19) {
}
} else if (this.weapon.function[var1][0].equals("Bolt")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "335");
for(var4 = var3.gain - 1; var4 >= 0; --var4) {
var10000 = var3.powers;
var10000[var4] += dmnew.randGen.nextInt() % 10 + var4 * this.wlevel;
if (this.wlevel == 15) {
var10000 = var3.powers;
var10000[var4] += dmnew.randGen.nextInt(20);
}
if (var3.powers[var4] < 1) {
var3.powers[var4] = dmnew.randGen.nextInt(4) + 1;
}
}
var3.power = var3.powers[var3.gain - 1];
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var18) {
}
} else if (this.weapon.function[var1][0].equals("Venom")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "51");
for(var4 = var3.gain - 1; var4 >= 0; --var4) {
var10000 = var3.powers;
var10000[var4] += dmnew.randGen.nextInt() % 10 + var4 * this.wlevel;
if (this.wlevel == 15) {
var10000 = var3.powers;
var10000[var4] += dmnew.randGen.nextInt(20);
}
if (var3.powers[var4] < 1) {
var3.powers[var4] = dmnew.randGen.nextInt(4) + 1;
}
}
var3.power = var3.powers[var3.gain - 1];
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var17) {
}
} else if (this.weapon.function[var1][0].equals("Ven Cloud")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "31");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var14) {
}
} else {
dmnew.Hero var30;
if (this.weapon.function[var1][0].equals("Shield")) {
for(var2 = 0; var2 < dmnew.numheroes; ++var2) {
if (dmnew.hero[var2].defenseboost < this.weapon.power[var1]) {
var30 = dmnew.hero[var2];
var30.defense -= dmnew.hero[var2].defenseboost;
dmnew.hero[var2].defenseboost = this.weapon.power[var1];
var30 = dmnew.hero[var2];
var30.defense += this.weapon.power[var1];
dmnew.hero[var2].repaint();
}
}
} else if (this.weapon.function[var1][0].equals("SpellShield")) {
for(var2 = 0; var2 < dmnew.numheroes; ++var2) {
if (dmnew.hero[var2].magicresistboost < this.weapon.power[var1]) {
var30 = dmnew.hero[var2];
var30.magicresist -= dmnew.hero[var2].magicresistboost;
dmnew.hero[var2].magicresistboost = this.weapon.power[var1];
var30 = dmnew.hero[var2];
var30.magicresist += this.weapon.power[var1];
dmnew.hero[var2].repaint();
}
}
} else if (this.weapon.function[var1][0].equals("Freeze")) {
var26 = 0;
var21 = 0;
if (dmnew.facing == 0) {
var21 = 1;
} else if (dmnew.facing == 1) {
var26 = 1;
} else if (dmnew.facing == 2) {
var21 = -1;
} else {
var26 = -1;
}
for(var5 = 0; var5 < 6; ++var5) {
var22 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + (dmnew.partyx - var26) + "," + (dmnew.partyy - var21) + "," + var5);
if (var22 != null && var22.number != 26) {
var22.timecounter = -this.weapon.power[var1];
}
if (var5 == 3) {
++var5;
}
}
} else if (this.weapon.function[var1][0].equals("Freeze Life")) {
dmnew.freezelife += this.weapon.power[var1];
} else if (this.weapon.function[var1][0].equals("Sight")) {
dmnew.magicvision += this.weapon.power[var1];
dmnew.needredraw = true;
} else if (this.weapon.function[var1][0].equals("Anti-Ven")) {
this.poison -= this.weapon.power[var1];
if (this.poison <= 0) {
this.ispoisoned = false;
this.poison = 0;
}
this.repaint();
} else if (this.weapon.function[var1][0].equals("Light")) {
dmnew.darkcounter = 0;
dmnew.magictorch += this.weapon.power[var1];
if (dmnew.magictorch > 285) {
dmnew.magictorch = 285;
}
if (dmnew.darkfactor + this.weapon.power[var1] > 255) {
dmnew.darkfactor = 255;
} else {
dmnew.darkfactor += this.weapon.power[var1];
}
dmnew.needredraw = true;
} else if (!this.weapon.function[var1][0].equals("Frighten") && !this.weapon.function[var1][0].equals("Calm")) {
if (this.weapon.function[var1][0].equals("Arc Bolt")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "642");
for(var4 = var3.gain - 1; var4 >= 0; --var4) {
var10000 = var3.powers;
var10000[var4] += dmnew.randGen.nextInt() % 10 + var4 * this.wlevel;
if (this.wlevel == 15) {
var10000 = var3.powers;
var10000[var4] += dmnew.randGen.nextInt(20);
}
if (var3.powers[var4] < 1) {
var3.powers[var4] = dmnew.randGen.nextInt(4) + 1;
}
}
var3.power = var3.powers[var3.gain - 1];
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var16) {
}
} else if (this.weapon.function[var1][0].equals("Slow")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "362");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var13) {
}
} else if (this.weapon.function[var1][0].equals("Slowfall")) {
dmnew.floatcounter += this.weapon.power[var1];
if (!dmnew.climbing) {
dmnew.message.setMessage("Slowfall active.", 4);
}
dmnew.climbing = true;
} else if (this.weapon.function[var1][0].equals("Silence")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "523");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var12) {
}
} else if (this.weapon.function[var1][0].equals("Weakness")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "461");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var11) {
}
} else if (this.weapon.function[var1][0].equals("Feeble Mind")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "363");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var10) {
}
} else if (this.weapon.function[var1][0].equals("Strip Defenses")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "664");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var9) {
}
} else {
int var6;
if (this.weapon.function[var1][0].equals("Drain Life")) {
var2 = dmnew.partyx;
var25 = dmnew.partyy;
if (dmnew.facing == 0) {
--var25;
} else if (dmnew.facing == 1) {
--var2;
} else if (dmnew.facing == 2) {
++var25;
} else {
++var2;
}
var22 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + var2 + "," + var25 + "," + 5);
for(var5 = 3; var22 == null && var5 >= 0; --var5) {
var22 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + var2 + "," + var25 + "," + (var5 - dmnew.facing + 4) % 4);
}
if (var22 == null) {
return true;
}
var6 = var22.damage(this.weapon.power[var1], 7);
if (var6 >= 0) {
this.heal(var6);
dmnew.this.weaponsheet.hitlabel.setText("" + var6);
if (var6 < 50) {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.hiticon3);
} else if (var6 < 100) {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.hiticon2);
} else {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.hiticon);
}
this.hitcounter = 2;
} else {
this.damage(var6, 1);
}
} else if (this.weapon.function[var1][0].equals("Invoke")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
String[] var27 = new String[]{"44", "52", "335", "31", "51", "44"};
var4 = dmnew.randGen.nextInt(this.wlevel / 2) + this.wlevel / 2 + 1;
if (var4 > 6) {
var4 = 6;
}
try {
Spell var23 = new Spell(var4 + var27[dmnew.randGen.nextInt(6)]);
var23.power += dmnew.randGen.nextInt(20) + 20;
for(var6 = var23.gain - 2; var6 >= 0; --var6) {
var10000 = var23.powers;
var10000[var6] += dmnew.randGen.nextInt(20) + 20;
}
dmnew.this.new Projectile(var23, var23.dist, dmnew.facing, var2);
this.energize(-dmnew.randGen.nextInt(10) - 15);
} catch (Exception var15) {
var15.printStackTrace();
}
} else if (this.weapon.function[var1][0].equals("Fuse")) {
var2 = dmnew.partyx;
var25 = dmnew.partyy;
if (dmnew.facing == 0) {
--var25;
} else if (dmnew.facing == 1) {
--var2;
} else if (dmnew.facing == 2) {
++var25;
} else {
++var2;
}
var4 = this.subsquare;
if (var4 == 2) {
var4 = 1;
} else if (var4 == 3) {
var4 = 0;
}
dmnew.this.new Projectile(new Spell(), 1, dmnew.facing, var4);
} else if (this.weapon.function[var1][0].equals("Fluxcage")) {
var2 = dmnew.partyx;
var25 = dmnew.partyy;
if (dmnew.facing == 0) {
--var25;
} else if (dmnew.facing == 1) {
--var2;
} else if (dmnew.facing == 2) {
++var25;
} else {
++var2;
}
if (!(dmnew.DungeonMap[dmnew.level][var2][var25] instanceof Wall)) {
dmnew.this.new FluxCage(dmnew.level, var2, var25);
dmnew.needredraw = true;
}
} else if (this.weapon.function[var1][0].equals("Ruiner")) {
var2 = this.subsquare;
if (var2 == 2) {
var2 = 1;
} else if (var2 == 3) {
var2 = 0;
}
try {
var3 = new Spell(this.weapon.power[var1] + "461");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
var3 = new Spell(this.weapon.power[var1] + "363");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
var3 = new Spell(this.weapon.power[var1] + "362");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
var3 = new Spell(this.weapon.power[var1] + "664");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
var3 = new Spell(this.weapon.power[var1] + "523");
dmnew.this.new Projectile(var3, var3.dist, dmnew.facing, var2);
} catch (Exception var8) {
}
} else if (this.weapon.function[var1][0].equals("True Sight")) {
dmnew.dispell += this.weapon.power[var1];
if (dmnew.dispell == this.weapon.power[var1]) {
dmnew.needredraw = true;
}
}
}
} else {
var26 = 0;
var21 = 0;
if (dmnew.facing == 0) {
var21 = 1;
} else if (dmnew.facing == 1) {
var26 = 1;
} else if (dmnew.facing == 2) {
var21 = -1;
} else {
var26 = -1;
}
for(var5 = 0; var5 < 6; ++var5) {
var22 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + (dmnew.partyx - var26) + "," + (dmnew.partyy - var21) + "," + var5);
if (var22 != null && dmnew.randGen.nextInt(11) < var22.fearresist) {
var22.runcounter += this.weapon.power[var1];
var22.wasfrightened = true;
}
if (var5 == 3) {
++var5;
}
}
}
}
}
if (this.weapon.charges[var1] == -1) {
return true;
} else {
int var10002 = this.weapon.charges[var1]--;
if (this.weapon.charges[var1] < 1) {
--this.weapon.functions;
if (var1 == 1 && this.weapon.functions == 2) {
this.weapon.function[1][0] = this.weapon.function[2][0];
this.weapon.function[1][1] = this.weapon.function[2][1];
this.weapon.power[1] = this.weapon.power[2];
this.weapon.charges[1] = this.weapon.charges[2];
} else if (var1 == 0) {
if (this.weapon.functions <= 0) {
this.load -= this.weapon.weight;
this.weapon = dmnew.fistfoot;
this.repaint();
return true;
}
this.weapon.function[0][0] = this.weapon.function[1][0];
this.weapon.function[0][1] = this.weapon.function[1][1];
this.weapon.power[0] = this.weapon.power[1];
this.weapon.charges[0] = this.weapon.charges[1];
}
if (this.weapon.upic != null) {
boolean var29 = false;
for(var25 = 0; var25 < this.weapon.functions; ++var25) {
if (this.weapon.charges[var25] != 0) {
var29 = true;
}
}
if (!var29) {
this.weapon.pic.flush();
if (this.weapon.temppic != null) {
this.weapon.temppic.flush();
}
this.weapon.pic = this.weapon.upic;
this.weapon.temppic = this.weapon.upic;
this.weapon.picstring = this.weapon.usedupstring;
if (this.weapon.epic != null) {
this.weapon.epic.flush();
this.weapon.epic = this.weapon.upic;
this.weapon.equipstring = this.weapon.usedupstring;
}
this.repaint();
}
}
}
return true;
}
}
}
}
public boolean checkmon(int var1) {
byte var2 = 0;
byte var3 = 0;
if (dmnew.facing == 0) {
var3 = 1;
} else if (dmnew.facing == 1) {
var2 = 1;
} else if (dmnew.facing == 2) {
var3 = -1;
} else {
var2 = -1;
}
if ((this.subsquare != 2 || dmnew.heroatsub[1] == -1) && (this.subsquare != 3 || dmnew.heroatsub[0] == -1)) {
dmnew.Monster var4 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + (dmnew.partyx - var2) + "," + (dmnew.partyy - var3) + "," + 5);
int var6;
int var8;
if (var4 == null) {
boolean[] var5 = new boolean[4];
var6 = dmnew.randGen.nextInt(2) + 2;
int var7 = (var6 - dmnew.facing + 4) % 4;
var4 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + (dmnew.partyx - var2) + "," + (dmnew.partyy - var3) + "," + var7);
var5[var7] = var4 != null && (var4.isImmaterial && !this.weapon.hitsImmaterial || !var4.isImmaterial && this.weapon.function[var1][0].equals("Disrupt"));
if (var4 == null || var5[var7]) {
byte var12;
if (var6 == 2) {
var12 = 3;
} else {
var12 = 2;
}
var7 = (var12 - dmnew.facing + 4) % 4;
var4 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + (dmnew.partyx - var2) + "," + (dmnew.partyy - var3) + "," + var7);
var5[var7] = var4 != null && (var4.isImmaterial && !this.weapon.hitsImmaterial || !var4.isImmaterial && this.weapon.function[var1][0].equals("Disrupt"));
if (var4 == null || var5[var7]) {
var6 = dmnew.randGen.nextInt(2);
var7 = (var6 - dmnew.facing + 4) % 4;
var8 = (3 - var6 - dmnew.facing + 4) % 4;
var4 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + (dmnew.partyx - var2) + "," + (dmnew.partyy - var3) + "," + var7);
var5[var7] = var4 != null && (var4.isImmaterial && !this.weapon.hitsImmaterial || !var4.isImmaterial && this.weapon.function[var1][0].equals("Disrupt"));
if (var4 == null || var5[var8] || var5[var7]) {
if (var6 == 0) {
var12 = 1;
} else {
var12 = 0;
}
var7 = (var12 - dmnew.facing + 4) % 4;
var8 = (3 - var12 - dmnew.facing + 4) % 4;
var4 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + (dmnew.partyx - var2) + "," + (dmnew.partyy - var3) + "," + var7);
if (var5[var8]) {
var4 = null;
} else if (var4 != null && (var4.isImmaterial && !this.weapon.hitsImmaterial || !var4.isImmaterial && this.weapon.function[var1][0].equals("Disrupt"))) {
var4 = null;
}
}
}
}
} else if (var4.isImmaterial && !this.weapon.hitsImmaterial || !var4.isImmaterial && this.weapon.function[var1][0].equals("Disrupt")) {
var4 = null;
}
if (var4 == null) {
return false;
} else {
this.hitcounter = 2;
if (dmnew.randGen.nextInt(20 + this.nlevel) == 0 && this.nlevel < 15) {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.missicon);
dmnew.this.weaponsheet.hitlabel.setText("Critical Miss");
this.weaponcount += 4;
dmnew.message.setMessage(this.name + ": Critical Miss", this.heronumber);
return true;
} else {
int var11 = this.dexterity - var4.speed;
if (this.stamina < this.maxstamina / 4) {
var11 -= 5;
}
if (this.load > this.maxload) {
var11 -= 5;
}
if (this.hurtweapon) {
var11 -= 10;
}
var6 = 0;
if (var4.subsquare != 5 && (var4.subsquare + dmnew.facing) % 4 < 2) {
var11 -= 10;
++var6;
}
boolean var13;
if (var11 > 40) {
var13 = dmnew.randGen.nextInt(8) != 0;
} else if (var11 > 30) {
var13 = dmnew.randGen.nextInt(7) != 0;
} else if (var11 > 20) {
var13 = dmnew.randGen.nextInt(6) != 0;
} else if (var11 > 10) {
var13 = dmnew.randGen.nextInt(5) != 0;
} else if (var11 > 0) {
var13 = dmnew.randGen.nextInt(4) != 0;
} else if (var11 > -10) {
var13 = dmnew.randGen.nextInt(3) != 0;
} else if (var11 > -20) {
var13 = dmnew.randGen.nextInt(2) != 0;
} else if (var11 > -30) {
var13 = dmnew.randGen.nextInt(3) == 0;
} else {
var13 = dmnew.randGen.nextInt(4) == 0;
}
if (var13) {
var8 = dmnew.randGen.nextInt() % 10 + this.weapon.power[var1] * this.strength / 12;
if (var6 > 0) {
var8 = var8 * 2 / 3;
}
if (this.nlevel > 0 && this.weapon.function[var1][1].equals("n")) {
var8 += (dmnew.randGen.nextInt(this.nlevel) + 1) * 3;
}
if (this.hurtweapon) {
var8 /= 2;
}
if (var8 < 1) {
var8 = dmnew.randGen.nextInt(4);
}
if (this.weapon.function[var1][0].equals("Parry")) {
var4.parry = this.heronumber;
} else if (this.dexterity > 50 && dmnew.randGen.nextInt(20 - 2 * this.nlevel / 3) == 0) {
var8 = 3 * var8 / 2;
dmnew.message.setMessage(this.name + ": Critical Hit", this.heronumber);
}
this.gainxp(this.weapon.function[var1][1].charAt(0), 1);
if (var4.hurtitem != 0 && this.weapon.number != var4.hurtitem && this.weapon.number != 215 && (var4.hurtitem != 248 || this.weapon.number != 249)) {
dmnew.message.setMessage(this.name + "'s Weapon Has No Effect.", 4);
return true;
}
int var9 = 0;
if (this.weapon.number == 206 && (var4.number == 3 || var4.number == 21 || var4.number == 23 || var4.defense > 79)) {
var9 = var4.defense;
var4.defense /= 2;
}
if (this.weapon.number != 215) {
var8 = var4.damage(var8, 0);
} else {
var8 = var4.damage(var8, 4);
}
if (var8 < 50) {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.hiticon3);
} else if (var8 < 100) {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.hiticon2);
} else {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.hiticon);
}
dmnew.this.weaponsheet.hitlabel.setText("" + var8);
if (var9 > 0) {
var4.defense = var9;
}
if (this.weapon.poisonous > 0 && dmnew.randGen.nextBoolean()) {
var4.ispoisoned = true;
var4.poisonpow += this.weapon.poisonous;
}
if (this.weapon.function[var1][0].equals("Stun") && var4.number != 26 && var4.health < var4.maxhealth / 3 && dmnew.randGen.nextBoolean()) {
var4.timecounter = -this.weapon.power[var1];
}
if (this.weapon.number == 215 && var8 > 0) {
this.heal(var8);
this.vitalize(var8);
this.energize(var8);
if (var4.isdying && dmnew.numheroes > 1 && dmnew.randGen.nextInt(50) == 0) {
int var10;
for(var10 = dmnew.randGen.nextInt(dmnew.numheroes); dmnew.hero[var10].equals(this); var10 %= dmnew.numheroes) {
++var10;
}
dmnew.hero[var10].damage(dmnew.hero[var10].maxhealth, 4);
dmnew.message.setMessage("Stormbringer feeds...", 5);
this.maxhealth += dmnew.hero[var10].maxhealth / 10;
this.maxstamina += dmnew.hero[var10].maxstamina / 10;
this.maxmana += dmnew.hero[var10].maxmana / 10;
this.strength += dmnew.hero[var10].strength / 10;
this.vitality += dmnew.hero[var10].vitality / 10;
this.intelligence += dmnew.hero[var10].intelligence / 10;
this.health = this.maxhealth;
this.stamina = this.maxstamina;
this.mana = this.maxmana;
this.setMaxLoad();
this.repaint();
}
}
} else {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.missicon);
dmnew.this.weaponsheet.hitlabel.setText("Miss");
}
return true;
}
}
} else if (!dmnew.DungeonMap[dmnew.level][dmnew.partyx - var2][dmnew.partyy - var3].hasMons) {
return false;
} else {
dmnew.message.setMessage(this.name + " can't reach.", 4);
dmnew.this.weaponsheet.hitlabel.setText("Can't Reach");
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.missicon);
this.hitcounter = 2;
return true;
}
}
public void checkdoor(int var1) {
if (this.weapon.number <= 235 && this.weapon.number != 9 && (this.weapon.function[var1][0].equals("Swing") || this.weapon.function[var1][0].equals("Chop") || this.weapon.function[var1][0].equals("Melee") || this.weapon.function[var1][0].equals("Bash") || this.weapon.function[var1][0].equals("Crush") || this.weapon.function[var1][0].equals("Berzerk"))) {
if (this.subsquare == 2 && dmnew.heroatsub[1] != -1 || this.subsquare == 3 && dmnew.heroatsub[0] != -1) {
dmnew.message.setMessage(this.name + " can't reach.", 4);
dmnew.this.weaponsheet.hitlabel.setText("Can't Reach");
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.missicon);
this.hitcounter = 2;
} else {
byte var2 = 0;
byte var3 = 0;
if (dmnew.facing == 0) {
var3 = 1;
} else if (dmnew.facing == 1) {
var2 = 1;
} else if (dmnew.facing == 2) {
var3 = -1;
} else {
var2 = -1;
}
if (dmnew.DungeonMap[dmnew.level][dmnew.partyx - var2][dmnew.partyy - var3].mapchar == 'd') {
int var4 = dmnew.randGen.nextInt() % 10 + this.weapon.power[var1] * this.strength / 12;
((Door)dmnew.DungeonMap[dmnew.level][dmnew.partyx - var2][dmnew.partyy - var3]).breakDoor(var4, true, true);
dmnew.this.weaponsheet.hitlabel.setText("" + var4);
if (var4 < 50) {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.hiticon3);
} else if (var4 < 100) {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.hiticon2);
} else {
dmnew.this.weaponsheet.hitlabel.setIcon(dmnew.this.weaponsheet.hiticon);
}
this.hitcounter = 2;
}
}
}
}
public void gainxp(char var1, int var2) {
switch(var1) {
case 'n':
if (this.nlevel < 15) {
this.nxp += var2;
if (this.nxp > this.nlevel * 30 + 50) {
this.levelgain('n');
}
}
break;
case 'p':
if (this.plevel < 15) {
this.pxp += var2;
if (this.neck != null && this.neck.number == 92) {
++this.pxp;
}
if (this.pxp > this.plevel * 30 + 50) {
this.levelgain('p');
}
}
break;
case 'w':
if (this.wlevel < 15) {
this.wxp += var2;
if (this.wxp > this.wlevel * 30 + 50) {
this.levelgain('w');
}
}
break;
default:
if (this.flevel < 15) {
this.fxp += var2;
if (this.fxp > this.flevel * 30 + 50) {
this.levelgain('f');
}
}
}
}
public void levelgain(char var1) {
int var2;
switch(var1) {
case 'f':
++this.flevel;
this.fxp = 0;
var2 = dmnew.randGen.nextInt(3) + 2;
this.strengthboost -= var2;
var2 = dmnew.randGen.nextInt(2) + 1;
this.dexterityboost -= var2;
var2 = dmnew.randGen.nextInt(3) + 1;
this.vitalityboost -= var2;
var2 = dmnew.randGen.nextInt() % 5 + this.vitality / 4;
if (var2 < 1) {
var2 = 1;
}
this.maxhealth += var2;
var2 = dmnew.randGen.nextInt() % 5 + this.vitality / 4;
if (var2 < 1) {
var2 = 1;
}
this.maxstamina += var2;
this.stamina += var2;
this.setMaxLoad();
dmnew.message.setMessage(this.name + " gains a fighter level!", this.heronumber);
break;
case 'n':
++this.nlevel;
this.nxp = 0;
var2 = dmnew.randGen.nextInt(3) + 1;
this.strengthboost -= var2;
var2 = dmnew.randGen.nextInt(3) + 2;
this.dexterityboost -= var2;
var2 = dmnew.randGen.nextInt(3) + 1;
this.vitalityboost -= var2;
var2 = dmnew.randGen.nextInt() % 5 + this.vitality / 5;
if (var2 < 1) {
var2 = 1;
}
this.maxhealth += var2;
var2 = dmnew.randGen.nextInt() % 5 + this.vitality / 5;
if (var2 < 1) {
var2 = 1;
}
this.maxstamina += var2;
this.stamina += var2;
this.setMaxLoad();
dmnew.message.setMessage(this.name + " gains a ninja level!", this.heronumber);
break;
case 'p':
++this.plevel;
this.pxp = 0;
var2 = dmnew.randGen.nextInt(3) + 2;
this.wisdomboost -= var2;
var2 = dmnew.randGen.nextInt() % 5 + this.vitality / 7;
if (var2 < 1) {
var2 = 1;
}
this.maxhealth += var2;
var2 = dmnew.randGen.nextInt() % 5 + this.vitality / 7;
if (var2 < 1) {
var2 = 1;
}
this.maxstamina += var2;
this.stamina += var2;
var2 = 9 - this.plevel;
if (var2 < 4) {
var2 = 4;
}
var2 = dmnew.randGen.nextInt(5) + this.wisdom / var2;
if (var2 < 1) {
var2 = 1;
}
this.maxmana += var2;
dmnew.message.setMessage(this.name + " gains a priest level!", this.heronumber);
break;
case 'w':
++this.wlevel;
this.wxp = 0;
var2 = dmnew.randGen.nextInt(3) + 2;
this.intelligenceboost -= var2;
var2 = dmnew.randGen.nextInt() % 5 + this.vitality / 7;
if (var2 < 1) {
var2 = 1;
}
this.maxhealth += var2;
var2 = dmnew.randGen.nextInt() % 5 + this.vitality / 7;
if (var2 < 1) {
var2 = 1;
}
this.maxstamina += var2;
this.stamina += var2;
var2 = 9 - this.wlevel;
if (var2 < 4) {
var2 = 4;
}
var2 = dmnew.randGen.nextInt(5) + this.intelligence / var2;
if (var2 < 1) {
var2 = 1;
}
this.maxmana += var2;
dmnew.message.setMessage(this.name + " gains a wizard level!", this.heronumber);
}
}
public void wepThrow(Item var1, int var2) {
int var3 = (this.strength + 5) / 10 - (int)(var1.weight / 2.0F) + dmnew.randGen.nextInt() % 2 + var1.shotpow / 3 + this.nlevel / 2;
if (var3 < 2) {
var3 = 2;
}
if (var3 < this.nlevel) {
var3 = this.nlevel;
}
if (this.nlevel > 0) {
var1.shotpow += dmnew.randGen.nextInt(this.nlevel) + this.nlevel;
}
if (var1.isbomb) {
try {
Spell var5 = new Spell(var1.bombnum);
var5.power = var1.potionpow + dmnew.randGen.nextInt() % 10;
dmnew.this.new Projectile(var5, var3, dmnew.facing, var2);
} catch (Exception var6) {
dmnew.this.new Projectile(var1, var3, dmnew.facing, var2);
}
} else {
dmnew.this.new Projectile(var1, var3, dmnew.facing, var2);
}
this.load -= var1.weight;
}
public int castSpell() {
Spell var1;
try {
var1 = new Spell(this.currentspell);
} catch (Exception var7) {
return 0;
}
this.weaponcount = var1.gain * 6 + 2;
if (this.hurthead) {
this.weaponcount += 4;
}
for(int var2 = 0; var2 < dmnew.numheroes; ++var2) {
if (this.equals(dmnew.hero[var2])) {
this.wepready = false;
if (dmnew.this.weaponready == var2) {
dmnew.this.weaponsheet.update();
}
break;
}
}
if (this.silenced) {
return 5;
} else {
int var3;
if (this.hurthead) {
if (var1.clsgain == 'w') {
if (this.wlevel < 15) {
var3 = dmnew.randGen.nextInt(3);
} else {
var3 = dmnew.randGen.nextInt(5);
}
} else if (this.plevel < 15) {
var3 = dmnew.randGen.nextInt(3);
} else {
var3 = dmnew.randGen.nextInt(5);
}
if (var3 == 0) {
return 5;
}
}
var3 = var1.gain * this.currentspell.length();
int var4;
if (var1.clsgain == 'w') {
var4 = dmnew.randGen.nextInt((this.wlevel + 1) * 2) + this.wlevel + 1;
if (this.wlevel > 8) {
var4 = 24;
} else if (this.wlevel > 6) {
var4 += 4;
} else if (this.wlevel > 4) {
++var4;
}
} else {
var4 = dmnew.randGen.nextInt((this.plevel + 1) * 2) + this.plevel + 1;
if (this.plevel > 8) {
var4 = 24;
} else if (this.plevel > 6) {
var4 += 4;
} else if (this.plevel > 4) {
++var4;
}
}
if (var4 < var3) {
this.gainxp(var1.clsgain, var1.gain);
if (var1.clsgain == 'w') {
dmnew.this.spellclass = "wizard";
} else {
dmnew.this.spellclass = "priest";
}
return 3;
} else {
int var5;
if (var1.clsgain == 'w' && var1.type != 2 && var1.number != 461 && var1.number != 363 && var1.number != 362 && var1.number != 664 && var1.number != 523) {
for(var5 = var1.gain - 1; var5 >= 0; --var5) {
int[] var10000 = var1.powers;
var10000[var5] += dmnew.randGen.nextInt() % 10 + var5 * this.intelligence / 8;
if (this.wlevel == 15) {
var10000 = var1.powers;
var10000[var5] += dmnew.randGen.nextInt(this.intelligence / 8);
}
if (var1.powers[var5] < 1) {
var1.powers[var5] = dmnew.randGen.nextInt(4) + 1;
}
}
var1.power = var1.powers[var1.gain - 1];
} else if (var1.type != 2 && (var1.type != 0 || var1.number == 1 || var1.number == 2 || var1.number == 655)) {
var1.power += dmnew.randGen.nextInt() % 10 + var1.gain * this.wisdom / 8;
if (this.plevel == 15) {
var1.power += dmnew.randGen.nextInt(this.wisdom / 8);
}
if (var1.power < 1) {
var1.power = dmnew.randGen.nextInt(4) + 1;
}
if (var1.power < 4 && (var1.number == 1 || var1.number == 2 || var1.number == 655)) {
var1.power = dmnew.randGen.nextInt(4) + 4;
}
}
if (var1.gain == 6 && var1.number == 4 && this.hand != null && this.weapon != null && (this.hand.number == 83 && !this.hand.bound[0] && this.weapon.number == 282 || this.weapon.number == 83 && !this.weapon.bound[0] && this.hand.number == 282)) {
dmnew.message.setMessage("Fire has been bound.", 4);
if (this.hand.number == 282) {
this.load -= this.hand.weight;
this.hand = null;
this.weapon.bound[0] = true;
if (this.weapon.bound[1] && this.weapon.bound[2] && this.weapon.bound[3]) {
this.load -= this.weapon.weight;
this.weapon = new Item(248);
this.load += this.weapon.weight;
dmnew.message.setMessage("The Firestaff is Complete.", 4);
}
} else {
this.load -= this.weapon.weight;
this.weapon = dmnew.fistfoot;
this.hand.bound[0] = true;
if (this.hand.bound[1] && this.hand.bound[2] && this.hand.bound[3]) {
this.load -= this.hand.weight;
this.hand = new Item(248);
this.load += this.hand.weight;
dmnew.message.setMessage("The Firestaff is Complete.", 4);
}
}
this.repaint();
if (dmnew.sheet) {
dmnew.herosheet.repaint();
}
return 1;
} else if (var1.gain == 6 && var1.number == 2 && this.hand != null && this.weapon != null && (this.hand.number == 83 && !this.hand.bound[1] && this.weapon.number == 283 || this.weapon.number == 83 && !this.weapon.bound[1] && this.hand.number == 283)) {
dmnew.message.setMessage("Water has been bound.", 4);
if (this.hand.number == 283) {
this.load -= this.hand.weight;
this.hand = null;
this.weapon.bound[1] = true;
if (this.weapon.bound[0] && this.weapon.bound[2] && this.weapon.bound[3]) {
this.load -= this.weapon.weight;
this.weapon = new Item(248);
this.load += this.weapon.weight;
dmnew.message.setMessage("The Firestaff is Complete.", 4);
}
} else {
this.load -= this.weapon.weight;
this.weapon = dmnew.fistfoot;
this.hand.bound[1] = true;
if (this.hand.bound[0] && this.hand.bound[2] && this.hand.bound[3]) {
this.load -= this.hand.weight;
this.hand = new Item(248);
this.load += this.hand.weight;
dmnew.message.setMessage("The Firestaff is Complete.", 4);
}
}
this.repaint();
if (dmnew.sheet) {
dmnew.herosheet.repaint();
}
return 1;
} else if (var1.gain != 6 || var1.number != 1 || this.hand == null || this.weapon == null || (this.hand.number != 83 || this.hand.bound[2] || this.weapon.number != 284) && (this.weapon.number != 83 || this.weapon.bound[2] || this.hand.number != 284)) {
if (var1.gain != 6 || var1.number != 3 || this.hand == null || this.weapon == null || (this.hand.number != 83 || this.hand.bound[3] || this.weapon.number != 285) && (this.weapon.number != 83 || this.weapon.bound[3] || this.hand.number != 285)) {
if (var1.number == 3) {
return 0;
} else {
if (var1.type == 0) {
if (this.hand != null && this.hand.number == 7) {
this.load -= this.hand.weight;
this.hand = new Item(var1.potionnum, var1.power, var1.gain);
this.load += this.hand.weight;
} else {
if (this.weapon.number != 7) {
return 2;
}
this.load -= this.weapon.weight;
this.weapon = new Item(var1.potionnum, var1.power, var1.gain);
this.load += this.weapon.weight;
}
dmnew.this.hupdate();
} else if (var1.type == 1) {
var5 = this.subsquare;
if (var5 == 2) {
var5 = 1;
} else if (var5 == 3) {
var5 = 0;
}
dmnew.this.new Projectile(var1, var1.dist, dmnew.facing, var5);
} else if (var1.type == 2) {
var5 = this.specialSpell(var1);
if (var5 == 1) {
this.gainxp(var1.clsgain, var1.gain - 1 + this.currentspell.length());
}
return var5;
}
this.gainxp(var1.clsgain, var1.gain - 1 + this.currentspell.length());
return 1;
}
} else {
dmnew.message.setMessage("Wind has been bound.", 4);
if (this.hand.number == 285) {
this.load -= this.hand.weight;
this.hand = null;
this.weapon.bound[3] = true;
if (this.weapon.bound[0] && this.weapon.bound[1] && this.weapon.bound[2]) {
this.load -= this.weapon.weight;
this.weapon = new Item(248);
this.load += this.weapon.weight;
dmnew.message.setMessage("The Firestaff is Complete.", 4);
}
} else {
this.load -= this.weapon.weight;
this.weapon = dmnew.fistfoot;
this.hand.bound[3] = true;
if (this.hand.bound[0] && this.hand.bound[1] && this.hand.bound[2]) {
this.load -= this.hand.weight;
this.hand = new Item(248);
this.load += this.hand.weight;
dmnew.message.setMessage("The Firestaff is Complete.", 4);
}
}
this.repaint();
if (dmnew.sheet) {
dmnew.herosheet.repaint();
}
return 1;
}
} else {
dmnew.message.setMessage("Earth has been bound.", 4);
if (this.hand.number == 284) {
this.load -= this.hand.weight;
this.hand = null;
this.weapon.bound[2] = true;
if (this.weapon.bound[0] && this.weapon.bound[1] && this.weapon.bound[3]) {
this.load -= this.weapon.weight;
this.weapon = new Item(248);
this.load += this.weapon.weight;
dmnew.message.setMessage("The Firestaff is Complete.", 4);
}
} else {
this.load -= this.weapon.weight;
this.weapon = dmnew.fistfoot;
this.hand.bound[2] = true;
if (this.hand.bound[0] && this.hand.bound[1] && this.hand.bound[3]) {
this.load -= this.hand.weight;
this.hand = new Item(248);
this.load += this.hand.weight;
dmnew.message.setMessage("The Firestaff is Complete.", 4);
}
}
this.repaint();
if (dmnew.sheet) {
dmnew.herosheet.repaint();
}
return 1;
}
}
}
}
public int specialSpell(Spell var1) {
if (var1.number == 325) {
dmnew.magicvision += var1.power;
if (dmnew.magicvision == var1.power) {
dmnew.needredraw = true;
}
} else if (var1.number == 4) {
dmnew.magictorch += var1.power;
if (dmnew.magictorch > 285) {
dmnew.magictorch = 285;
}
if (dmnew.darkfactor + var1.power > 255) {
dmnew.darkfactor = 255;
} else {
dmnew.darkfactor += var1.power;
}
dmnew.needredraw = true;
} else {
dmnew.Hero var10000;
int var2;
if (var1.number == 14) {
if (this.plevel == 15) {
var1.power += 10;
}
for(var2 = 0; var2 < dmnew.numheroes; ++var2) {
if (dmnew.hero[var2].defenseboost < var1.power) {
var10000 = dmnew.hero[var2];
var10000.defense -= dmnew.hero[var2].defenseboost;
dmnew.hero[var2].defenseboost = var1.power;
var10000 = dmnew.hero[var2];
var10000.defense += var1.power;
dmnew.hero[var2].repaint();
}
}
} else if (var1.number == 64) {
if (this.plevel == 15) {
var1.power += 10;
}
for(var2 = 0; var2 < dmnew.numheroes; ++var2) {
if (dmnew.hero[var2].magicresistboost < var1.power) {
var10000 = dmnew.hero[var2];
var10000.magicresist -= dmnew.hero[var2].magicresistboost;
dmnew.hero[var2].magicresistboost = var1.power;
var10000 = dmnew.hero[var2];
var10000.magicresist += var1.power;
dmnew.hero[var2].repaint();
}
}
} else if (var1.number == 344) {
dmnew.floatcounter += var1.power;
if (!dmnew.climbing) {
dmnew.message.setMessage("Slowfall active.", 4);
}
dmnew.climbing = true;
} else if (var1.number == 121) {
if (this.weapon.number == 219 && this.kuswordcount < var1.power) {
this.kuswordcount = var1.power;
this.weapon.power[0] = var1.gain * 2 + 6;
return 1;
}
if (this.weapon != dmnew.fistfoot) {
return 4;
}
this.weapon = new Item(219);
this.weapon.power[0] = var1.gain * 2 + 6;
this.kuswordcount = var1.power;
this.repaint();
} else if (var1.number == 122) {
if (this.weapon.number == 261 && this.rosbowcount < var1.power) {
this.rosbowcount = var1.power;
this.weapon.power[0] = var1.gain;
return 1;
}
if (this.weapon != dmnew.fistfoot) {
return 4;
}
this.weapon = new Item(261);
this.weapon.power[0] = var1.gain;
this.rosbowcount = var1.power;
this.repaint();
} else if (var1.number == 322) {
if (this.plevel < 15) {
dmnew.this.spellclass = "priest";
return 3;
}
dmnew.dispell += var1.power;
if (dmnew.dispell == var1.power) {
dmnew.needredraw = true;
}
} else if (var1.number == 666) {
var2 = dmnew.partyx;
int var3 = dmnew.partyy;
if (dmnew.facing == 0) {
--var3;
} else if (dmnew.facing == 1) {
--var2;
} else if (dmnew.facing == 2) {
++var3;
} else {
++var2;
}
dmnew.Monster var4 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + var2 + "," + var3 + "," + 5);
for(int var5 = 3; var4 == null && var5 >= 0; --var5) {
var4 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + var2 + "," + var3 + "," + (var5 - dmnew.facing + 4) % 4);
}
if (var4 == null) {
return 4;
}
int var6 = var4.damage(var1.power, 7);
if (var6 >= 0) {
this.heal(var6);
} else {
this.damage(var6, 1);
}
} else if (var1.number == 635) {
if (this.weapon.name.equals("Fist/Foot")) {
this.weapon = new Item(80);
this.repaint();
} else if (this.hand == null) {
this.hand = new Item(80);
this.repaint();
} else {
if (!dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].canHoldItems) {
return 4;
}
dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].addItem(new Item(80));
dmnew.needredraw = true;
}
}
}
return 1;
}
public boolean usePotion(Item var1) {
switch(var1.number) {
case 10:
this.heal(var1.potionpow);
int var2 = dmnew.randGen.nextInt(var1.potioncastpow) + var1.potioncastpow / 3;
if (var2 == 0 && var1.potioncastpow > 4) {
var2 += var1.potioncastpow - 4;
}
if (var2 > 0 && (this.hurthead || this.hurttorso || this.hurtlegs || this.hurtfeet || this.hurthand || this.hurtweapon)) {
ArrayList var3 = new ArrayList(6);
var3.add(new Integer(0));
var3.add(new Integer(1));
var3.add(new Integer(2));
var3.add(new Integer(3));
var3.add(new Integer(4));
var3.add(new Integer(5));
int var4 = 0;
int var5 = dmnew.randGen.nextInt(6);
while(var2 > 0 && var4 < 6) {
switch((Integer)var3.remove(var5)) {
case 0:
if (this.hurthead) {
this.hurthead = false;
--var2;
}
break;
case 1:
if (this.hurttorso) {
this.hurttorso = false;
--var2;
}
break;
case 2:
if (this.hurtlegs) {
this.hurtlegs = false;
--var2;
}
break;
case 3:
if (this.hurtfeet) {
this.hurtfeet = false;
--var2;
}
break;
case 4:
if (this.hurthand) {
this.hurthand = false;
--var2;
}
break;
case 5:
if (this.hurtweapon) {
this.hurtweapon = false;
--var2;
}
}
++var4;
if (var4 < 6) {
var5 = (var5 + 1) % (6 - var4);
}
}
}
break;
case 11:
this.vitalize(var1.potionpow);
break;
case 12:
this.mana += var1.potionpow;
break;
case 13:
if (this.strength > 150) {
return false;
}
this.strengthboost += var1.potionpow;
this.strength += var1.potionpow;
this.setMaxLoad();
break;
case 14:
if (this.dexterity > 150) {
return false;
}
this.dexterityboost += var1.potionpow;
this.dexterity += var1.potionpow;
break;
case 15:
if (this.vitality > 150) {
return false;
}
this.vitalityboost += var1.potionpow;
this.vitality += var1.potionpow;
break;
case 16:
if (this.intelligence > 150) {
return false;
}
this.intelligenceboost += var1.potionpow;
this.intelligence += var1.potionpow;
break;
case 17:
if (this.wisdom > 150) {
return false;
}
this.wisdomboost += var1.potionpow;
this.wisdom += var1.potionpow;
break;
case 18:
if (this.defenseboost < var1.potionpow) {
this.defense -= this.defenseboost;
this.defenseboost = var1.potionpow;
this.defense += var1.potionpow;
}
break;
case 19:
if (this.magicresistboost < var1.potionpow) {
this.magicresist -= this.magicresistboost;
this.magicresistboost += var1.potionpow;
this.magicresist += var1.potionpow;
}
break;
case 20:
this.poison -= var1.potionpow;
if (this.poison < 1) {
this.ispoisoned = false;
this.poison = 0;
}
break;
case 21:
case 22:
case 23:
default:
return false;
case 24:
this.silencecount -= var1.potionpow;
if (this.silencecount < 1) {
this.silenced = false;
this.silencecount = 0;
}
}
return true;
}
public int damage(int var1, int var2) {
if (!this.isdead) {
if (dmnew.this.sleeping && var2 != 2) {
dmnew.needredraw = true;
dmnew.this.sleeping = false;
dmnew.sleeper = 0;
dmnew.sheet = false;
dmnew.this.centerlay.show(dmnew.this.centerpanel, "dview");
dmnew.this.spellsheet.setVisible(true);
dmnew.this.weaponsheet.setVisible(true);
dmnew.this.weaponsheet.update();
}
boolean var3 = this.hurtweapon || this.hurthand || this.hurthead || this.hurttorso || this.hurtlegs || this.hurtfeet;
int var4;
if (var2 != 0 && var2 != 5) {
if (var2 != 1 && var2 != 7) {
if (var2 == 3 && this.head != null) {
var1 -= var1 * this.head.defense / 100;
}
} else {
var4 = this.magicresist;
if (var3) {
if (this.hurthand && this.hand != null && this.hand.type == 1 && this.hand.magicresist > 0) {
this.magicresist -= this.hand.magicresist;
}
if (this.hurtweapon && this.weapon != null && this.weapon.type == 1 && this.weapon.magicresist > 0) {
this.magicresist -= this.weapon.magicresist;
}
if (this.magicresist < 0) {
this.magicresist = 0;
} else {
this.magicresist = this.magicresist * 2 / 3;
}
}
var1 -= var1 * this.magicresist / 100;
this.magicresist = var4;
}
} else {
var4 = this.defense;
if (var3) {
if (this.hurthand && this.hand != null && this.hand.type == 1 && this.hand.defense > 0) {
this.defense -= this.hand.defense;
}
if (this.hurtweapon && this.weapon != null && this.weapon.type == 1 && this.weapon.defense > 0) {
this.defense -= this.weapon.defense;
}
if (this.defense < 0) {
this.defense = 0;
} else {
this.defense = this.defense * 2 / 3;
}
}
var1 -= var1 * this.defense / 100;
this.defense = var4;
}
if (var1 < 1) {
var1 = dmnew.randGen.nextInt(4) + 1;
}
this.health -= var1;
this.hit = var1;
int var5;
if (this.health < 1) {
this.isdead = true;
this.repaint();
this.removeMouseListener(dmnew.this.hclick);
this.health = 0;
this.currentspell = "";
this.ispoisoned = false;
this.poison = 0;
if (!dmnew.this.sleeping && dmnew.sheet && this.equals(dmnew.herosheet.hero)) {
dmnew.herosheet.skipchestscroll = false;
dmnew.this.viewing = false;
if (dmnew.inhand.number == 4) {
dmnew.inhand.pic = dmnew.inhand.temppic;
if (!this.isleader) {
dmnew.this.changeCursor();
}
}
dmnew.sheet = false;
dmnew.this.centerlay.show(dmnew.this.centerpanel, "dview");
}
if (this.weapon.number == 215) {
var2 = 4;
}
this.dropAllItems(var2);
this.load = 0.0F;
dmnew.updateDark();
dmnew.this.formation.mouseExited((MouseEvent)null);
dmnew.heroatsub[this.subsquare] = -1;
dmnew.this.formation.addNewHero();
boolean var8 = false;
if (this.isleader) {
this.isleader = false;
for(var5 = 0; var5 < dmnew.numheroes; ++var5) {
if (var5 != this.heronumber && !dmnew.hero[var5].isdead) {
dmnew.hero[var5].isleader = true;
dmnew.leader = var5;
if (dmnew.sheet && dmnew.herosheet.hero.heronumber == var5) {
dmnew.herosheet.repaint();
}
break;
}
}
}
if (dmnew.leader == this.heronumber) {
dmnew.playSound("scream.wav", -1, -1);
dmnew.iteminhand = false;
dmnew.this.changeCursor();
dmnew.alldead = true;
dmnew.gameover = true;
if (dmnew.this.sleeping) {
dmnew.this.sleeping = false;
dmnew.sleeper = 0;
dmnew.sheet = false;
dmnew.needredraw = true;
dmnew.this.centerlay.show(dmnew.this.centerpanel, "dview");
dmnew.this.spellsheet.setVisible(true);
dmnew.this.weaponsheet.setVisible(true);
dmnew.this.weaponsheet.update();
}
} else {
dmnew.this.spellsheet.casterButton[this.heronumber].setEnabled(false);
if (dmnew.this.spellready == this.heronumber) {
dmnew.this.spellsheet.casterButton[this.heronumber].setText("");
dmnew.this.spellsheet.casterButton[this.heronumber].setSelected(false);
dmnew.this.spellsheet.casterButton[this.heronumber].setPreferredSize(new Dimension(16, 20));
dmnew.this.spellsheet.casterButton[this.heronumber].setMaximumSize(new Dimension(16, 20));
dmnew.this.spellsheet.casterButton[dmnew.leader].setSelected(true);
dmnew.this.spellready = dmnew.leader;
dmnew.this.spellsheet.casterButton[dmnew.this.spellready].setPreferredSize(new Dimension(95, 20));
dmnew.this.spellsheet.casterButton[dmnew.this.spellready].setMaximumSize(new Dimension(95, 20));
dmnew.this.spellsheet.casterButton[dmnew.this.spellready].setText(dmnew.hero[dmnew.this.spellready].name);
}
dmnew.this.weaponsheet.weaponButton[this.heronumber].setDisabledIcon((Icon)null);
dmnew.this.weaponsheet.weaponButton[this.heronumber].setEnabled(false);
if (dmnew.this.weaponready == this.heronumber) {
dmnew.this.weaponsheet.weaponButton[this.heronumber].setSelected(false);
dmnew.this.weaponsheet.weaponButton[dmnew.leader].setSelected(true);
dmnew.this.weaponready = dmnew.leader;
}
dmnew.this.weaponsheet.update();
dmnew.this.spellsheet.update();
this.strength -= this.strengthboost;
this.strengthboost = 0;
this.vitality -= this.vitalityboost;
this.vitalityboost = 0;
this.dexterity -= this.dexterityboost;
this.dexterityboost = 0;
this.intelligence -= this.intelligenceboost;
this.intelligenceboost = 0;
this.wisdom -= this.wisdomboost;
this.wisdomboost = 0;
this.defense -= this.defenseboost;
this.defenseboost = 0;
this.magicresist -= this.magicresistboost;
this.magicresistboost = 0;
this.hurtweapon = false;
this.hurthand = false;
this.hurthead = false;
this.hurttorso = false;
this.hurtlegs = false;
this.hurtfeet = false;
}
} else {
this.hurtcounter = 3;
this.paint(this.getGraphics());
if (dmnew.sheet && !dmnew.this.viewing && !dmnew.this.sleeping) {
dmnew.herosheet.repaint();
}
if (var2 == 0) {
this.gainxp('f', 1);
}
if ((var2 == 0 || var2 == 1 || var2 == 5) && (var1 > 100 || var1 > this.maxhealth / 4 && var1 > 40) && (!this.hurtweapon || !this.hurthand || !this.hurthead || !this.hurttorso || !this.hurtlegs || !this.hurtfeet) && dmnew.randGen.nextInt(10) > 0) {
ArrayList var9 = new ArrayList(6);
var9.add(new Integer(0));
var9.add(new Integer(1));
var9.add(new Integer(2));
var9.add(new Integer(3));
var9.add(new Integer(4));
var9.add(new Integer(5));
var5 = 6;
for(boolean var7 = false; !var7 && var5 > 0; --var5) {
int var6 = dmnew.randGen.nextInt(var5);
switch((Integer)var9.remove(var6)) {
case 0:
if (!this.hurthead) {
this.hurthead = true;
var7 = true;
}
break;
case 1:
if (!this.hurttorso) {
this.hurttorso = true;
var7 = true;
}
break;
case 2:
if (!this.hurtlegs) {
this.hurtlegs = true;
var7 = true;
}
break;
case 3:
if (!this.hurtfeet) {
this.hurtfeet = true;
var7 = true;
}
break;
case 4:
if (!this.hurthand) {
this.hurthand = true;
var7 = true;
}
break;
case 5:
if (!this.hurtweapon) {
this.hurtweapon = true;
var7 = true;
}
}
}
}
}
return var1;
} else {
return 0;
}
}
private void dropAllItems(int var1) {
MapObject var2 = dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy];
var2.tryFloorSwitch(2);
for(int var3 = 0; var3 < 16; ++var3) {
if (this.pack[var3] != null) {
this.pack[var3].subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.pack[var3])) {
var2.addItem(this.pack[var3]);
}
this.pack[var3] = null;
}
}
if (this.pouch2 != null) {
this.pouch2.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.pouch2)) {
var2.addItem(this.pouch2);
}
this.pouch2 = null;
}
if (this.pouch1 != null) {
this.pouch1.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.pouch1)) {
var2.addItem(this.pouch1);
}
this.pouch1 = null;
}
for(int var4 = 0; var4 < 6; ++var4) {
if (this.quiver[var4] != null) {
this.quiver[var4].subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.quiver[var4])) {
var2.addItem(this.quiver[var4]);
}
this.quiver[var4] = null;
}
}
if (this.feet != null) {
this.feet.unEquipEffect(this);
this.feet.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.feet)) {
var2.addItem(this.feet);
}
this.feet = null;
}
if (this.legs != null) {
this.legs.unEquipEffect(this);
this.legs.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.legs)) {
var2.addItem(this.legs);
}
this.legs = null;
}
if (this.torso != null) {
this.torso.unEquipEffect(this);
this.torso.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.torso)) {
var2.addItem(this.torso);
}
this.torso = null;
}
if (this.neck != null) {
this.neck.unEquipEffect(this);
if (this.neck.number == 89) {
dmnew.leveldark -= 60;
}
this.neck.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.neck)) {
var2.addItem(this.neck);
}
this.neck = null;
}
if (this.head != null) {
this.head.unEquipEffect(this);
this.head.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.head)) {
var2.addItem(this.head);
}
this.head = null;
}
if (this.hand != null) {
if (this.hand.number == 9) {
((Torch)this.hand).putOut();
}
if (this.hand.type == 1) {
this.hand.unEquipEffect(this);
}
this.hand.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.hand)) {
var2.addItem(this.hand);
}
this.hand = null;
}
if (!this.weapon.name.equals("Fist/Foot")) {
if (this.weapon.number == 9) {
((Torch)this.weapon).putOut();
}
if (this.weapon.type == 0 || this.weapon.type == 1) {
this.weapon.unEquipEffect(this);
}
if (this.weapon.number != 219 && this.weapon.number != 261) {
this.weapon.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(this.weapon)) {
var2.addItem(this.weapon);
}
}
this.weapon = dmnew.fistfoot;
}
if (this.isleader && dmnew.iteminhand) {
dmnew.iteminhand = false;
dmnew.inhand.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(dmnew.inhand)) {
var2.addItem(dmnew.inhand);
}
dmnew.this.changeCursor();
}
Item var5;
if (var1 != 4) {
var5 = new Item(this.name, this.heronumber);
} else {
var5 = new Item(75);
var5.name = this.name + " Bones";
}
var5.subsquare = (this.subsquare - dmnew.facing + 4) % 4;
if (!var2.tryTeleport(var5)) {
var2.addItem(var5);
}
dmnew.needredraw = true;
}
public void heal(int var1) {
this.health += var1;
if (this.health > this.maxhealth) {
this.health = this.maxhealth;
}
}
public void vitalize(int var1) {
this.stamina += var1;
if (this.stamina > this.maxstamina) {
this.stamina = this.maxstamina;
} else if (this.stamina <= 0) {
this.stamina = 1;
}
this.setMaxLoad();
if (dmnew.sheet && dmnew.herosheet.hero.heronumber == this.heronumber) {
dmnew.herosheet.repaint();
}
}
public void energize(int var1) {
this.mana += var1;
if (this.mana > this.maxmana) {
this.mana = this.maxmana;
} else if (this.mana < 0) {
this.mana = 0;
}
}
public void paint(Graphics var1) {
if (!this.isdead) {
var1.setFont(new Font("TimesRoman", 1, 14));
var1.setColor(new Color(100, 100, 100));
var1.fillRect(0, 0, this.getSize().width, 84);
var1.setColor(new Color(150, 150, 150));
var1.fillRect(0, 0, this.getSize().width, 18);
if (this.hurtcounter > 0) {
var1.setColor(Color.red);
var1.fillRect(5, 20, 60, 60);
var1.setColor(new Color(30, 30, 30));
var1.drawString("< " + this.hit + " >", 17, 50);
var1.setColor(Color.yellow);
var1.drawString("< " + this.hit + " >", 14, 47);
} else {
var1.drawImage(this.pic, 5, 20, this);
}
int var2 = (int)((float)this.health / (float)this.maxhealth * 60.0F);
var1.setColor(new Color(20, 20, 20));
var1.fillRect(72, 82 - var2, 5, var2);
var1.setColor(new Color(0, 150, 0));
var1.fillRect(70, 80 - var2, 5, var2);
var2 = (int)((float)this.stamina / (float)this.maxstamina * 60.0F);
var1.setColor(new Color(20, 20, 20));
var1.fillRect(82, 82 - var2, 5, var2);
var1.setColor(new Color(250, 200, 0));
var1.fillRect(80, 80 - var2, 5, var2);
var2 = (int)((float)this.mana / (float)this.maxmana * 60.0F);
var1.setColor(new Color(20, 20, 20));
var1.fillRect(92, 82 - var2, 5, var2);
var1.setColor(new Color(100, 0, 240));
var1.fillRect(90, 80 - var2, 5, var2);
var1.setColor(new Color(30, 30, 30));
var1.drawString(this.name, 7, 14);
if (this.isleader) {
var1.setColor(new Color(240, 220, 0));
} else {
var1.setColor(Color.white);
}
var1.drawString(this.name, 5, 12);
if (this.heronumber == 0) {
var1.setColor(new Color(0, 216, 0));
} else if (this.heronumber == 1) {
var1.setColor(new Color(236, 217, 0));
} else if (this.heronumber == 2) {
var1.setColor(Color.red);
} else {
var1.setColor(Color.blue);
}
var1.fillRect(this.getSize().width - 10, 0, 10, 10);
var1.setColor(new Color(60, 60, 60));
var1.fillRect(12, 89, 32, 32);
var1.fillRect(56, 89, 32, 32);
var1.setColor(new Color(150, 150, 150));
var1.drawRect(10, 87, 35, 35);
var1.drawRect(11, 88, 33, 33);
var1.drawRect(54, 87, 35, 35);
var1.drawRect(55, 88, 33, 33);
if (this.hand != null) {
var1.drawImage(this.hand.pic, 12, 89, this);
} else {
var1.drawImage(dmnew.fistfoot.pic, 44, 89, 12, 121, 0, 0, 32, 32, this);
}
Graphics2D var3;
if (this.hurthand) {
if (this.hand == null) {
var1.drawImage(dmnew.hurthand, 12, 89, this);
}
var3 = (Graphics2D)var1;
var3.setColor(Color.red);
var3.setStroke(new BasicStroke(2.0F));
var3.drawRect(11, 88, 34, 34);
}
var1.drawImage(this.weapon.pic, 56, 89, this);
if (this.hurtweapon) {
if (this.weapon == dmnew.fistfoot) {
var1.drawImage(dmnew.hurtweapon, 56, 89, this);
}
var3 = (Graphics2D)var1;
var3.setColor(Color.red);
var3.setStroke(new BasicStroke(2.0F));
var3.drawRect(55, 88, 34, 34);
}
if (dmnew.sheet && dmnew.herosheet.hero.equals(this)) {
var1.setColor(Color.yellow);
var1.drawRect(0, 0, this.getSize().width - 1, this.getSize().height - 1);
} else if (this.ispoisoned) {
var1.setColor(new Color(0, 150, 0));
var1.drawRect(0, 0, this.getSize().width - 1, this.getSize().height - 1);
} else if (this.magicresistboost > 0 && this.defenseboost > 0) {
var1.setColor(new Color(150, 0, 150));
var1.drawRect(0, 0, this.getSize().width - 1, this.getSize().height - 1);
} else if (this.magicresistboost > 0) {
var1.setColor(Color.red);
var1.drawRect(0, 0, this.getSize().width - 1, this.getSize().height - 1);
} else if (this.defenseboost > 0) {
var1.setColor(Color.blue);
var1.drawRect(0, 0, this.getSize().width - 1, this.getSize().height - 1);
}
} else {
var1.setColor(Color.black);
var1.fillRect(0, 0, this.getSize().width, this.getSize().height);
var1.drawImage(dmnew.deadheropic, 15, 20, this);
}
}
}
class Monster {
int number;
String name;
int power;
int defense;
int magicresist;
int speed;
int manapower;
int movespeed;
int attackspeed;
int mana;
int maxmana = 0;
int health;
int maxhealth;
int fearresist = 5;
boolean wasfrightened = false;
int facing = 0;
int subsquare = 0;
int currentai = 0;
int defaultai = 1;
int newai;
int powerboost;
int defenseboost;
int magicresistboost;
int speedboost;
int manapowerboost;
int movespeedboost;
int attackspeedboost;
int parry = -1;
Image towardspic;
Image awaypic;
Image rightpic;
Image leftpic;
Image attackpic;
Image castpic;
boolean hasmagic = false;
boolean hasheal = false;
boolean hasdrain = false;
boolean silenced = false;
int silencecount = 0;
int castpower;
int minproj = 0;
boolean ignoremons = true;
int numspells;
String[] knownspells;
int poison = 0;
boolean isImmaterial = false;
boolean isflying = false;
boolean canusestairs = true;
int timecounter = 0;
int movecounter = 0;
int deathcounter = 0;
int randomcounter = 0;
int runcounter = 0;
int x;
int y;
int xdist = 0;
int ydist = 0;
int level;
boolean isattacking = false;
boolean iscasting = false;
boolean isdying = false;
boolean mirrored = false;
boolean hurt = false;
boolean wasstuck;
int moveattack = 0;
int hurttest = 0;
boolean waitattack = false;
boolean ispoisoned;
int poisonpow;
int poisoncounter = 0;
int olddir = -1;
int castsub = 0;
boolean breakdoor = false;
ArrayList carrying = new ArrayList();
int ammo = 0;
boolean useammo = false;
static final int RANDOM = 0;
static final int GOTOWARDS = 1;
static final int STAYBACK = 2;
static final int RUN = 3;
static final int GUARD = 4;
boolean HITANDRUN = false;
boolean gamewin = false;
String endanim;
String endsound;
String picstring;
String soundstring;
int hurtitem;
int needitem;
int needhandneck;
int pickup;
public Monster(int var2, int var3, int var4, int var5, String var6, String var7, String var8, boolean var9, boolean var10, boolean var11) {
this.number = var2;
this.x = var3;
this.y = var4;
this.level = var5;
this.name = var6;
this.picstring = var7;
this.soundstring = var8;
this.canusestairs = var9;
this.isflying = var10;
this.ignoremons = var11;
File var12 = new File("Monsters" + File.separator + var7 + "-toward.gif");
if (var12.exists()) {
this.towardspic = dmnew.tk.getImage(var12.getPath());
} else {
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "screamer-toward.gif");
}
var12 = new File("Monsters" + File.separator + var7 + "-away.gif");
if (var12.exists()) {
this.awaypic = dmnew.tk.getImage(var12.getPath());
} else {
this.awaypic = this.towardspic;
}
var12 = new File("Monsters" + File.separator + var7 + "-right.gif");
if (var12.exists()) {
this.rightpic = dmnew.tk.getImage(var12.getPath());
} else {
this.rightpic = this.towardspic;
}
var12 = new File("Monsters" + File.separator + var7 + "-left.gif");
if (var12.exists()) {
this.leftpic = dmnew.tk.getImage(var12.getPath());
} else {
this.leftpic = this.towardspic;
}
var12 = new File("Monsters" + File.separator + var7 + "-attack.gif");
if (var12.exists()) {
this.attackpic = dmnew.tk.getImage(var12.getPath());
} else {
this.attackpic = this.towardspic;
}
var12 = new File("Monsters" + File.separator + var7 + "-cast.gif");
if (var12.exists()) {
this.castpic = dmnew.tk.getImage(var12.getPath());
} else {
this.castpic = this.attackpic;
}
dmnew.ImageTracker.addImage(this.towardspic, 2);
dmnew.ImageTracker.addImage(this.awaypic, 2);
dmnew.ImageTracker.addImage(this.rightpic, 2);
dmnew.ImageTracker.addImage(this.leftpic, 2);
dmnew.ImageTracker.addImage(this.attackpic, 2);
dmnew.ImageTracker.addImage(this.castpic, 2);
try {
dmnew.ImageTracker.waitForID(2);
} catch (InterruptedException var14) {
}
dmnew.ImageTracker.removeImage(this.towardspic, 2);
dmnew.ImageTracker.removeImage(this.awaypic, 2);
dmnew.ImageTracker.removeImage(this.rightpic, 2);
dmnew.ImageTracker.removeImage(this.leftpic, 2);
dmnew.ImageTracker.removeImage(this.attackpic, 2);
dmnew.ImageTracker.removeImage(this.castpic, 2);
}
public Monster(int var2, int var3, int var4, int var5) {
this.number = var2;
this.x = var3;
this.y = var4;
this.level = var5;
switch(this.number) {
case 0:
this.name = "Mummy";
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "mummy-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "mummy-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "mummy-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "mummy-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "mummy-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "mummy.wav";
break;
case 1:
this.name = "Screamer";
this.canusestairs = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "screamer.gif");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "screamer-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "spider.wav";
break;
case 2:
this.name = "Giggler";
this.ignoremons = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "giggler-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "giggler-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "giggler-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "giggler-left.gif");
this.attackpic = this.towardspic;
this.castpic = this.attackpic;
this.soundstring = "giggler.wav";
break;
case 3:
this.name = "Rock Pile";
this.canusestairs = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "rockpile.gif");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "rockpile-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "rockmon.wav";
break;
case 4:
this.name = "Slime";
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "slime.gif");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "slime-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "slime.wav";
break;
case 5:
this.name = "Wing Eye";
this.isflying = true;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "wingeye.gif");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "wingeye-attack.gif");
this.castpic = this.attackpic;
break;
case 6:
this.name = "Ghost";
this.isflying = true;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "ghost.gif");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "ghost-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "mummy.wav";
break;
case 7:
this.name = "Muncher";
this.isflying = true;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "muncher-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "muncher-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "muncher-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "muncher-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "muncher-attack.gif");
this.castpic = this.attackpic;
break;
case 8:
this.name = "Skeleton";
this.ignoremons = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "skeleton-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "skeleton-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "skeleton-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "skeleton-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "skeleton-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "swing.wav";
break;
case 9:
this.name = "Worm";
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "worm-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "worm-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "worm-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "worm-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "worm-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "worm.wav";
break;
case 10:
this.name = "Fire Elemental";
this.canusestairs = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "fireel.gif");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "fireel-attack.gif");
this.castpic = this.attackpic;
break;
case 11:
this.name = "Water Elemental";
this.canusestairs = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "waterel.gif");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "waterel-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "waterel.wav";
break;
case 12:
this.name = "Goblin";
this.ignoremons = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "goblin-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "goblin-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "goblin-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "goblin-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "goblin-attack.gif");
this.castpic = this.attackpic;
break;
case 13:
this.name = "Giant Rat";
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "rat-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "rat-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "rat-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "rat-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "rat-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "roar.wav";
break;
case 14:
this.name = "Ant Man";
this.ignoremons = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "antman-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "antman-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "antman-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "antman-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "antman-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "swing.wav";
break;
case 15:
this.name = "Beholder";
this.isflying = true;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "beholder.gif");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "beholder-attack.gif");
this.castpic = this.attackpic;
break;
case 16:
this.name = "Couatyl";
this.isflying = true;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "couatyl-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "couatyl-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "couatyl-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "couatyl-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "couatyl-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "couatyl.wav";
break;
case 17:
this.name = "Fader";
this.isflying = true;
this.ignoremons = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "fader.gif");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = this.towardspic;
this.castpic = this.attackpic;
this.soundstring = "rockmon.wav";
break;
case 18:
this.name = "Tentacle Beast";
this.canusestairs = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "tentaclemon.gif");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "tentaclemon-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "slime.wav";
break;
case 19:
this.name = "Scorpion";
this.canusestairs = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "scorpion-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "scorpion-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "scorpion-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "scorpion-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "scorpion-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "scorpion.wav";
break;
case 20:
this.name = "Demon";
this.canusestairs = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "demon-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "demon-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "demon-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "demon-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "demon-attack.gif");
this.castpic = this.attackpic;
break;
case 21:
this.name = "Deth Knight";
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "dethknight-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "dethknight-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "dethknight-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "dethknight-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "dethknight-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "swing.wav";
break;
case 22:
this.name = "Spider";
this.canusestairs = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "spider-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "spider-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "spider-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "spider-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "spider-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "spider.wav";
break;
case 23:
this.name = "Stone Golem";
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "golem-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "golem-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "golem-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "golem-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "golem-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "swing.wav";
break;
case 24:
this.name = "Sorcerer";
this.ignoremons = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "sorcerer-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "sorcerer-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "sorcerer-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "sorcerer-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "sorcerer-attack.gif");
this.castpic = this.attackpic;
break;
case 25:
this.name = "Dragon";
this.canusestairs = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "dragon-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "dragon-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "dragon-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "dragon-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "dragon-attack.gif");
this.castpic = this.attackpic;
this.soundstring = "roar.wav";
break;
case 26:
this.name = "Lord Chaos";
this.isflying = true;
this.ignoremons = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "chaos-toward.gif");
this.awaypic = dmnew.tk.getImage("Monsters" + File.separator + "chaos-away.gif");
this.rightpic = dmnew.tk.getImage("Monsters" + File.separator + "chaos-right.gif");
this.leftpic = dmnew.tk.getImage("Monsters" + File.separator + "chaos-left.gif");
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "chaos-attack.gif");
this.castpic = this.attackpic;
break;
case 27:
this.name = "Demon Lord";
this.ignoremons = false;
this.towardspic = dmnew.tk.getImage("Monsters" + File.separator + "demonlord.png");
this.awaypic = this.towardspic;
this.rightpic = this.towardspic;
this.leftpic = this.towardspic;
this.attackpic = dmnew.tk.getImage("Monsters" + File.separator + "demonlord-attack.png");
this.castpic = this.attackpic;
this.soundstring = "demonlord.wav";
}
dmnew.ImageTracker.addImage(this.towardspic, 2);
dmnew.ImageTracker.addImage(this.awaypic, 2);
dmnew.ImageTracker.addImage(this.rightpic, 2);
dmnew.ImageTracker.addImage(this.leftpic, 2);
dmnew.ImageTracker.addImage(this.attackpic, 2);
dmnew.ImageTracker.addImage(this.castpic, 2);
try {
dmnew.ImageTracker.waitForID(2);
} catch (InterruptedException var7) {
}
dmnew.ImageTracker.removeImage(this.towardspic, 2);
dmnew.ImageTracker.removeImage(this.awaypic, 2);
dmnew.ImageTracker.removeImage(this.rightpic, 2);
dmnew.ImageTracker.removeImage(this.leftpic, 2);
dmnew.ImageTracker.removeImage(this.attackpic, 2);
dmnew.ImageTracker.removeImage(this.castpic, 2);
}
public void timePass() {
if (this.moveattack == dmnew.moncycle) {
this.moveattack = 0;
} else {
if (this.moveattack != 0) {
this.moveattack = 0;
}
if (this.movespeedboost > 0) {
--this.movespeedboost;
--this.movespeed;
}
if (this.isdying) {
++this.deathcounter;
if (this.deathcounter > 1) {
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
int var1 = 0;
boolean var2 = false;
while(var1 < 6 && !var2) {
if (dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + var1) != null) {
var2 = true;
}
if (var1 == 3) {
var1 = 5;
} else {
++var1;
}
}
dmnew.DungeonMap[this.level][this.x][this.y].hasMons = var2;
if (this.level == dmnew.level) {
dmnew.needredraw = true;
}
}
} else if (this.isattacking) {
if (!this.breakdoor) {
this.hitHero();
}
this.isattacking = false;
if (this.level == dmnew.level) {
dmnew.needredraw = true;
}
} else if (this.iscasting) {
this.iscasting = false;
if (this.level == dmnew.level) {
dmnew.needredraw = true;
}
} else {
this.breakdoor = false;
if (dmnew.freezelife <= 0 || this.number == 26 || this.number == 27) {
if (this.timecounter < 0) {
++this.timecounter;
this.timecounter += dmnew.sleeper;
} else {
++this.movecounter;
this.movecounter += dmnew.sleeper;
if (this.movecounter > this.movespeed) {
if (this.wasfrightened) {
this.wasfrightened = false;
this.currentai = 3;
}
if (this.number == 26 && dmnew.fluxchanging && dmnew.fluxcages.get(this.level + "," + this.x + "," + this.y) != null) {
this.runcounter = 1;
this.currentai = 3;
}
this.doAI();
if (this.defaultai == 2 && this.currentai == 1) {
if (!this.wasstuck && (this.ammo > 0 || this.hasmagic && !this.silenced && this.mana >= this.minproj)) {
this.currentai = 2;
}
this.wasstuck = false;
}
} else if (this.level == dmnew.level && this.xdist < 5 && this.ydist < 5 && dmnew.randGen.nextInt(5) == 0) {
this.mirrored = !this.mirrored;
dmnew.needredraw = true;
}
++this.timecounter;
this.timecounter += dmnew.sleeper;
if (this.timecounter > 210) {
this.timecounter = 0;
this.heal(this.maxhealth / 20 + 2);
this.energize(this.maxmana / 20 + 2);
if (this.ispoisoned) {
if (!this.isImmaterial && this.number != 8) {
if (this.poisonpow > 0) {
if (this.poisonpow > 15) {
this.poisonpow = 15;
} else if (dmnew.randGen.nextBoolean()) {
--this.poisonpow;
}
} else {
this.ispoisoned = false;
}
} else {
this.ispoisoned = false;
this.poisonpow = 0;
}
}
if (this.silencecount > 0) {
--this.silencecount;
if (this.silencecount == 0) {
this.silenced = false;
}
}
if (this.powerboost < 0) {
++this.powerboost;
++this.power;
}
if (this.defenseboost < 0) {
++this.defenseboost;
++this.defense;
}
if (this.magicresistboost < 0) {
++this.magicresistboost;
++this.magicresist;
}
if (this.speedboost < 0) {
++this.speedboost;
++this.speed;
}
if (this.manapowerboost < 0) {
++this.manapowerboost;
++this.manapower;
}
}
if (this.ispoisoned) {
++this.poisoncounter;
this.poisoncounter += dmnew.sleeper;
if (this.poisoncounter > 30) {
this.poisoncounter = 0;
this.damage(this.poisonpow, 2);
}
}
}
}
}
}
}
public void hitHero() {
byte var3;
byte var4;
byte var5;
byte var6;
if (this.facing == 0) {
var3 = 2;
var4 = 3;
var5 = 0;
var6 = 1;
} else if (this.facing == 2) {
var3 = 0;
var4 = 1;
var5 = 2;
var6 = 3;
} else if (this.facing == 3) {
var3 = 0;
var4 = 3;
var5 = 1;
var6 = 2;
} else {
var3 = 1;
var4 = 2;
var5 = 0;
var6 = 3;
}
int var1;
int var2;
if (dmnew.randGen.nextBoolean()) {
var1 = (var3 + dmnew.facing) % 4;
var2 = (var4 + dmnew.facing) % 4;
} else {
var1 = (var4 + dmnew.facing) % 4;
var2 = (var3 + dmnew.facing) % 4;
}
if (dmnew.heroatsub[var1] == -1) {
var1 = var2;
if (dmnew.heroatsub[var2] == -1) {
if (dmnew.randGen.nextBoolean()) {
var1 = (var5 + dmnew.facing) % 4;
var2 = (var6 + dmnew.facing) % 4;
} else {
var1 = (var6 + dmnew.facing) % 4;
var2 = (var5 + dmnew.facing) % 4;
}
if (dmnew.heroatsub[var1] == -1) {
var1 = var2;
}
}
}
var1 = dmnew.heroatsub[var1];
if (var1 != -1) {
int var9;
dmnew.Hero var10000;
if (this.name.equals("Giggler")) {
boolean var12 = false;
if (!dmnew.hero[var1].weapon.name.equals("Fist/Foot") && dmnew.hero[var1].weapon.number != 219 && dmnew.hero[var1].weapon.number != 261) {
this.carrying.add(dmnew.hero[var1].weapon);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].weapon.weight;
if (dmnew.hero[var1].weapon.type == 0 || dmnew.hero[var1].weapon.type == 1) {
dmnew.hero[var1].weapon.unEquipEffect(dmnew.hero[var1]);
}
if (dmnew.hero[var1].weapon.number == 9) {
((Torch)dmnew.hero[var1].weapon).putOut();
}
dmnew.hero[var1].weapon = dmnew.fistfoot;
var12 = true;
dmnew.hero[var1].repaint();
dmnew.this.weaponsheet.update();
dmnew.updateDark();
} else if (dmnew.hero[var1].hand != null) {
this.carrying.add(dmnew.hero[var1].hand);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].hand.weight;
if (dmnew.hero[var1].hand.type == 1) {
dmnew.hero[var1].hand.unEquipEffect(dmnew.hero[var1]);
} else if (dmnew.hero[var1].hand.number == 9) {
((Torch)dmnew.hero[var1].hand).putOut();
}
dmnew.hero[var1].hand = null;
var12 = true;
dmnew.hero[var1].repaint();
dmnew.updateDark();
} else if (!var12) {
ArrayList var13 = new ArrayList(5);
var13.add(new Integer(0));
var13.add(new Integer(1));
var13.add(new Integer(2));
var13.add(new Integer(3));
var13.add(new Integer(4));
var13.add(new Integer(5));
var13.add(new Integer(6));
var13.add(new Integer(7));
var13.add(new Integer(8));
label254:
while(true) {
label245:
while(true) {
if (var12 || var13.isEmpty()) {
break label254;
}
var9 = (Integer)var13.remove(0);
int var10;
int var11;
switch(var9) {
case 0:
if (dmnew.hero[var1].head != null) {
this.carrying.add(dmnew.hero[var1].head);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].head.weight;
dmnew.hero[var1].head.unEquipEffect(dmnew.hero[var1]);
dmnew.hero[var1].head = null;
var12 = true;
}
break;
case 1:
if (dmnew.hero[var1].neck != null) {
if (dmnew.hero[var1].neck.number == 89) {
dmnew.leveldark -= 60;
}
this.carrying.add(dmnew.hero[var1].neck);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].neck.weight;
dmnew.hero[var1].neck.unEquipEffect(dmnew.hero[var1]);
dmnew.hero[var1].neck = null;
var12 = true;
dmnew.updateDark();
}
break;
case 2:
if (dmnew.hero[var1].torso != null) {
this.carrying.add(dmnew.hero[var1].torso);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].torso.weight;
dmnew.hero[var1].torso.unEquipEffect(dmnew.hero[var1]);
dmnew.hero[var1].torso = null;
var12 = true;
}
break;
case 3:
if (dmnew.hero[var1].legs != null) {
this.carrying.add(dmnew.hero[var1].legs);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].legs.weight;
dmnew.hero[var1].legs.unEquipEffect(dmnew.hero[var1]);
dmnew.hero[var1].legs = null;
var12 = true;
}
break;
case 4:
if (dmnew.hero[var1].feet != null) {
this.carrying.add(dmnew.hero[var1].feet);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].feet.weight;
dmnew.hero[var1].feet.unEquipEffect(dmnew.hero[var1]);
dmnew.hero[var1].feet = null;
var12 = true;
}
break;
case 5:
if (dmnew.hero[var1].pouch1 != null) {
this.carrying.add(dmnew.hero[var1].pouch1);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].pouch1.weight;
dmnew.hero[var1].pouch1 = null;
var12 = true;
}
break;
case 6:
if (dmnew.hero[var1].pouch2 != null) {
this.carrying.add(dmnew.hero[var1].pouch2);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].pouch2.weight;
dmnew.hero[var1].pouch2 = null;
var12 = true;
}
break;
case 7:
var10 = dmnew.randGen.nextInt(6);
var11 = 0;
while(true) {
if (var12 || var11 >= 6) {
continue label245;
}
if (dmnew.hero[var1].quiver[var10] != null) {
this.carrying.add(dmnew.hero[var1].quiver[var10]);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].quiver[var10].weight;
dmnew.hero[var1].quiver[var10] = null;
var12 = true;
} else {
var10 = (var10 + 1) % 6;
++var11;
}
}
case 8:
var10 = dmnew.randGen.nextInt(16);
var11 = 0;
while(!var12 && var11 < 16) {
if (dmnew.hero[var1].pack[var10] != null) {
this.carrying.add(dmnew.hero[var1].pack[var10]);
var10000 = dmnew.hero[var1];
var10000.load -= dmnew.hero[var1].pack[var10].weight;
dmnew.hero[var1].pack[var10] = null;
var12 = true;
} else {
var10 = (var10 + 1) % 16;
++var11;
}
}
}
}
}
}
if (dmnew.sheet && var12 && dmnew.herosheet.hero.equals(dmnew.hero[var1])) {
dmnew.herosheet.repaint();
}
if (this.HITANDRUN && (!var12 || dmnew.randGen.nextInt(32) != 0)) {
this.runcounter = 40 + dmnew.randGen.nextInt(10);
this.currentai = 3;
}
} else if (!dmnew.this.sleeping && dmnew.randGen.nextInt(20) == 0) {
this.movecounter -= 4;
dmnew.message.setMessage(this.name + ": Critical Miss", 5);
} else {
int var7 = this.speed - dmnew.hero[var1].dexterity;
if (dmnew.hero[var1].stamina < dmnew.hero[var1].maxstamina / 4) {
var7 += 5;
}
if (dmnew.hero[var1].load > dmnew.hero[var1].maxload) {
var7 += 5;
}
if (dmnew.hero[var1].hurttorso || dmnew.hero[var1].hurtlegs || dmnew.hero[var1].hurtfeet) {
var7 += 10;
}
if (this.parry == var1) {
var7 -= 15;
}
this.parry = -1;
boolean var8;
if (dmnew.this.sleeping) {
var8 = true;
} else if (var7 > 40) {
var8 = dmnew.randGen.nextInt(8) != 0;
} else if (var7 > 30) {
var8 = dmnew.randGen.nextInt(7) != 0;
} else if (var7 > 20) {
var8 = dmnew.randGen.nextInt(6) != 0;
} else if (var7 > 10) {
var8 = dmnew.randGen.nextInt(5) != 0;
} else if (var7 > 0) {
var8 = dmnew.randGen.nextInt(4) != 0;
} else if (var7 > -10) {
var8 = dmnew.randGen.nextInt(3) != 0;
} else if (var7 > -20) {
var8 = dmnew.randGen.nextInt(2) != 0;
} else if (var7 > -30) {
var8 = dmnew.randGen.nextInt(3) == 0;
} else {
var8 = dmnew.randGen.nextInt(4) == 0;
}
if (var8) {
dmnew.playSound("oof.wav", -1, -1);
var9 = this.power + dmnew.randGen.nextInt(this.power / 4 + 10);
if (this.speed > 50 && (dmnew.randGen.nextInt(20) == 0 || dmnew.this.sleeping && dmnew.randGen.nextInt(5) == 0)) {
var9 = 3 * var9 / 2;
dmnew.message.setMessage(this.name + ": Critical Hit", 5);
}
if (this.poison > 0 && Math.abs(dmnew.randGen.nextInt()) % 10 > 4) {
var10000 = dmnew.hero[var1];
var10000.poison += this.poison;
dmnew.hero[var1].ispoisoned = true;
}
dmnew.hero[var1].damage(var9, 0);
dmnew.this.hupdate();
if (this.HITANDRUN) {
this.runcounter = 12 + Math.abs(dmnew.randGen.nextInt()) % 8;
this.currentai = 3;
}
}
}
}
}
public void doAI() {
this.xdist = this.x - dmnew.partyx;
if (this.xdist < 0) {
this.xdist *= -1;
}
this.ydist = this.y - dmnew.partyy;
if (this.ydist < 0) {
this.ydist *= -1;
}
if (this.level == dmnew.level && this.xdist < 5 && this.ydist < 5 && (this.number == 16 || this.number == 5)) {
dmnew.playSound("flap.wav", this.x, this.y);
}
boolean var1 = false;
if (this.level == dmnew.level && (this.xdist == 0 && this.ydist == 1 || this.ydist == 0 && this.xdist == 1)) {
if (this.subsquare != 5) {
if (this.x > dmnew.partyx) {
if (this.subsquare != 0 && this.subsquare != 3) {
if (this.currentai == 1) {
if (this.subsquare == 1 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs == 0 && dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 0) == null) {
var1 = true;
this.moveattack = dmnew.moncycle;
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
this.subsquare = 0;
dmnew.dmmons.put(this.level + "," + this.x + "," + this.y + "," + 0, this);
} else if (this.subsquare == 2 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs == 0 && dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 3) == null) {
var1 = true;
this.moveattack = dmnew.moncycle;
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
this.subsquare = 3;
dmnew.dmmons.put(this.level + "," + this.x + "," + this.y + "," + 3, this);
}
this.facing = 1;
}
} else {
var1 = true;
}
} else if (this.x < dmnew.partyx) {
if (this.subsquare != 1 && this.subsquare != 2) {
if (this.currentai == 1) {
if (this.subsquare == 0 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs == 0 && dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 1) == null) {
var1 = true;
this.moveattack = dmnew.moncycle;
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
this.subsquare = 1;
dmnew.dmmons.put(this.level + "," + this.x + "," + this.y + "," + 1, this);
} else if (this.subsquare == 3 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs == 0 && dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 2) == null) {
var1 = true;
this.moveattack = dmnew.moncycle;
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
this.subsquare = 2;
dmnew.dmmons.put(this.level + "," + this.x + "," + this.y + "," + 2, this);
}
this.facing = 3;
}
} else {
var1 = true;
}
} else if (this.y > dmnew.partyy) {
if (this.subsquare != 0 && this.subsquare != 1) {
if (this.currentai == 1) {
if (this.subsquare == 2 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs == 0 && dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 1) == null) {
var1 = true;
this.moveattack = dmnew.moncycle;
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
this.subsquare = 1;
dmnew.dmmons.put(this.level + "," + this.x + "," + this.y + "," + 1, this);
} else if (this.subsquare == 3 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs == 0 && dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 0) == null) {
var1 = true;
this.moveattack = dmnew.moncycle;
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
this.subsquare = 0;
dmnew.dmmons.put(this.level + "," + this.x + "," + this.y + "," + 0, this);
}
this.facing = 0;
}
} else {
var1 = true;
}
} else if (this.y < dmnew.partyy) {
if (this.subsquare != 2 && this.subsquare != 3) {
if (this.currentai == 1) {
if (this.subsquare == 0 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs == 0 && dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 3) == null) {
var1 = true;
this.moveattack = dmnew.moncycle;
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
this.subsquare = 3;
dmnew.dmmons.put(this.level + "," + this.x + "," + this.y + "," + 3, this);
} else if (this.subsquare == 1 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs == 0 && dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 2) == null) {
var1 = true;
this.moveattack = dmnew.moncycle;
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
this.subsquare = 2;
dmnew.dmmons.put(this.level + "," + this.x + "," + this.y + "," + 2, this);
}
this.facing = 2;
}
} else {
var1 = true;
}
}
} else {
var1 = true;
}
}
this.newai = this.currentai;
if (this.level != dmnew.level && this.currentai != 4 && this.currentai != 0) {
this.currentai = 0;
}
while(true) {
do {
do {
do {
do {
label1564: {
if (this.movecounter <= this.movespeed) {
return;
}
int var2;
int var3;
switch(this.currentai) {
case 0:
if (var1) {
this.randomcounter = 0;
this.newai = this.defaultai;
this.doAttack();
break label1564;
}
if (this.randomcounter > 0) {
--this.randomcounter;
if (this.randomcounter == 0) {
this.newai = this.defaultai;
}
} else if (this.level == dmnew.level && this.xdist < 5 && this.ydist < 5) {
this.newai = this.defaultai;
}
if ((this.number == 26 || this.number == 24 && (!this.silenced || dmnew.randGen.nextBoolean())) && dmnew.randGen.nextInt(20) == 0 && this.teleport()) {
break label1564;
}
var2 = 0;
for(var3 = dmnew.randGen.nextInt(4); !this.canMove(var3) && var2 < 4; var3 = (var3 + 1) % 4) {
++var2;
}
if (var2 < 4) {
this.monMove(var3);
} else {
this.movecounter = 0;
}
break label1564;
case 1:
if (this.health < this.maxhealth / 5 && this.hasheal && !this.silenced && this.mana > 59) {
this.useHealMagic();
} else if (this.fearresist > 0 && this.hurttest == 0 && this.health < this.maxhealth / 5) {
if (dmnew.randGen.nextInt(10) < this.fearresist || this.health < 40 && this.maxhealth < 400 && dmnew.randGen.nextBoolean()) {
this.hurt = true;
this.newai = 3;
break label1564;
}
this.hurttest = 12 - this.fearresist;
} else if (this.hurttest > 0) {
--this.hurttest;
}
if (var1) {
this.doAttack();
break label1564;
}
if ((this.ammo > 0 || this.hasmagic && !this.silenced && this.mana >= this.minproj) && dmnew.randGen.nextBoolean() && (this.x == dmnew.partyx && this.ydist > 1 || this.y == dmnew.partyy && this.xdist > 1)) {
if (this.x < dmnew.partyx && this.canDoProj(3)) {
this.doProjAttack(3);
} else if (this.x > dmnew.partyx && this.canDoProj(1)) {
this.doProjAttack(1);
} else if (this.y > dmnew.partyy && this.canDoProj(0)) {
this.doProjAttack(0);
} else if (this.y < dmnew.partyy && this.canDoProj(2)) {
this.doProjAttack(2);
}
if (this.movecounter < this.movespeed) {
break label1564;
}
}
if (dmnew.randGen.nextInt() % 10 > 5) {
if (this.attackspeed > 0) {
this.movecounter = this.attackspeed;
} else {
this.movecounter = 0;
}
break label1564;
}
if (this.xdist == 1 && this.ydist == 1 && !this.HITANDRUN && dmnew.randGen.nextBoolean()) {
this.movecounter = this.movespeed;
this.waitattack = true;
break label1564;
}
if (dmnew.randGen.nextBoolean()) {
if (this.x < dmnew.partyx && this.canMove(3)) {
this.monMove(3);
break label1564;
}
if (this.x > dmnew.partyx && this.canMove(1)) {
this.monMove(1);
break label1564;
}
if (this.y < dmnew.partyy && this.canMove(2)) {
this.monMove(2);
break label1564;
}
if (this.y > dmnew.partyy && this.canMove(0)) {
this.monMove(0);
break label1564;
}
this.randomcounter = 3;
this.newai = 0;
break label1564;
}
if (this.y < dmnew.partyy && this.canMove(2)) {
this.monMove(2);
break label1564;
}
if (this.y > dmnew.partyy && this.canMove(0)) {
this.monMove(0);
break label1564;
}
if (this.x < dmnew.partyx && this.canMove(3)) {
this.monMove(3);
break label1564;
}
if (this.x > dmnew.partyx && this.canMove(1)) {
this.monMove(1);
break label1564;
}
this.randomcounter = 3;
this.newai = 0;
break label1564;
case 2:
if (this.health < this.maxhealth / 5 && this.hasheal && !this.silenced && this.mana > 59) {
this.useHealMagic();
} else if (this.fearresist > 0 && this.hurttest == 0 && this.health < this.maxhealth / 5) {
if (dmnew.randGen.nextInt(10) < this.fearresist || this.health < 40 && this.maxhealth < 400 && dmnew.randGen.nextBoolean()) {
this.hurt = true;
this.newai = 3;
break label1564;
}
this.hurttest = 12 - this.fearresist;
} else if (this.hurttest > 0) {
--this.hurttest;
}
if (this.ammo == 0 && (!this.hasmagic || this.mana < this.minproj || this.silenced)) {
if (dmnew.randGen.nextBoolean()) {
this.newai = 1;
} else {
this.runcounter = 5;
this.newai = 3;
}
break label1564;
}
if (this.x == dmnew.partyx) {
if ((this.ydist > 1 || !var1 && dmnew.randGen.nextInt(3) != 0) && dmnew.randGen.nextInt() % 10 < 6) {
if (this.y > dmnew.partyy && this.canDoProj(0)) {
this.doProjAttack(0);
break label1564;
}
if (this.y < dmnew.partyy && this.canDoProj(2)) {
this.doProjAttack(2);
break label1564;
}
if ((this.subsquare == 0 || this.subsquare == 3) && this.canMove(3)) {
this.monMove(3);
this.movecounter = this.attackspeed;
break label1564;
}
if ((this.subsquare == 1 || this.subsquare == 2) && this.canMove(1)) {
this.monMove(1);
this.movecounter = this.attackspeed;
break label1564;
}
this.randomcounter = 3;
this.newai = 0;
break label1564;
}
if (this.y > dmnew.partyy && this.canMove(2)) {
this.monMove(2);
break label1564;
}
if (this.y < dmnew.partyy && this.canMove(0)) {
this.monMove(0);
break label1564;
}
if (dmnew.randGen.nextInt() % 10 > 2) {
if (dmnew.randGen.nextBoolean() && this.canMove(3)) {
this.monMove(3);
break label1564;
}
if (this.canMove(1)) {
this.monMove(1);
} else if (this.canMove(3)) {
this.monMove(3);
} else {
this.newai = 1;
this.wasstuck = true;
}
break label1564;
}
this.newai = 1;
this.wasstuck = true;
break label1564;
}
if (this.y == dmnew.partyy) {
if ((this.xdist > 1 || !var1 && dmnew.randGen.nextInt(3) != 0) && dmnew.randGen.nextInt() % 10 < 6) {
if (this.x > dmnew.partyx && this.canDoProj(1)) {
this.doProjAttack(1);
break label1564;
}
if (this.x < dmnew.partyx && this.canDoProj(3)) {
this.doProjAttack(3);
break label1564;
}
if ((this.subsquare == 0 || this.subsquare == 1) && this.canMove(2)) {
this.monMove(2);
this.movecounter = this.attackspeed;
break label1564;
}
if ((this.subsquare == 2 || this.subsquare == 3) && this.canMove(0)) {
this.monMove(0);
this.movecounter = this.attackspeed;
break label1564;
}
this.randomcounter = 3;
this.newai = 0;
break label1564;
}
if (this.x > dmnew.partyx && this.canMove(3)) {
this.monMove(3);
break label1564;
}
if (this.x < dmnew.partyx && this.canMove(1)) {
this.monMove(1);
break label1564;
}
if (dmnew.randGen.nextInt() % 10 > 2) {
if (dmnew.randGen.nextBoolean() && this.canMove(0)) {
this.monMove(0);
break label1564;
}
if (this.canMove(2)) {
this.monMove(2);
} else if (this.canMove(0)) {
this.monMove(0);
} else {
this.newai = 1;
this.wasstuck = true;
}
break label1564;
}
this.newai = 1;
this.wasstuck = true;
break label1564;
}
if (this.xdist != this.ydist) {
if (this.xdist < this.ydist) {
if (this.x < dmnew.partyx && this.canMove(3)) {
this.monMove(3);
break label1564;
}
if (this.x > dmnew.partyx && this.canMove(1)) {
this.monMove(1);
break label1564;
}
if (this.y < dmnew.partyy && this.canMove(2)) {
this.monMove(2);
break label1564;
}
if (this.y > dmnew.partyy && this.canMove(0)) {
this.monMove(0);
break label1564;
}
this.randomcounter = 3;
this.newai = 0;
break label1564;
}
if (this.y < dmnew.partyy && this.canMove(2)) {
this.monMove(2);
break label1564;
}
if (this.y > dmnew.partyy && this.canMove(0)) {
this.monMove(0);
break label1564;
}
if (this.x < dmnew.partyx && this.canMove(3)) {
this.monMove(3);
break label1564;
}
if (this.x > dmnew.partyx && this.canMove(1)) {
this.monMove(1);
break label1564;
}
this.randomcounter = 3;
this.newai = 0;
break label1564;
}
var2 = 0;
for(var3 = dmnew.randGen.nextInt(4); !this.canMove(var3) && var2 < 4; var3 = (var3 + 1) % 4) {
++var2;
}
if (var2 < 4) {
this.monMove(var3);
} else {
this.movecounter = 0;
}
break label1564;
case 3:
if ((this.number == 24 && (!this.silenced || dmnew.randGen.nextBoolean()) || this.number == 26 && this.wasstuck) && this.teleport()) {
this.wasstuck = false;
this.movecounter = 0;
} else if (this.wasstuck && var1) {
this.wasstuck = false;
this.doAttack();
} else if (var1 && dmnew.randGen.nextBoolean()) {
this.waitattack = true;
this.doAttack();
} else if (dmnew.randGen.nextBoolean()) {
if (this.x == dmnew.partyx && dmnew.randGen.nextBoolean()) {
if (dmnew.randGen.nextBoolean() && this.canMove(3)) {
this.monMove(3);
} else if (this.canMove(1)) {
this.monMove(1);
} else if (this.canMove(3)) {
this.monMove(3);
} else if (this.y > dmnew.partyy) {
if ((!this.wasstuck || this.olddir == -1 || this.olddir != 0) && this.canMove(2)) {
this.monMove(2);
}
} else if (this.y < dmnew.partyy) {
if ((!this.wasstuck || this.olddir == -1 || this.olddir != 2) && this.canMove(0)) {
this.monMove(0);
}
} else {
this.wasstuck = true;
this.randomcounter = 3;
this.newai = 0;
}
} else if (this.x > dmnew.partyx) {
if ((!this.wasstuck || this.olddir == -1 || this.olddir != 1) && this.canMove(3)) {
this.monMove(3);
}
} else if (this.x < dmnew.partyx) {
if ((!this.wasstuck || this.olddir == -1 || this.olddir != 3) && this.canMove(1)) {
this.monMove(1);
}
} else if (this.y > dmnew.partyy) {
if ((!this.wasstuck || this.olddir == -1 || this.olddir != 0) && this.canMove(2)) {
this.monMove(2);
}
} else if (this.y < dmnew.partyy && (!this.wasstuck || this.olddir == -1 || this.olddir != 2) && this.canMove(0)) {
this.monMove(0);
}
if (this.movecounter > this.movespeed) {
this.wasstuck = true;
var2 = 0;
for(var3 = dmnew.randGen.nextInt(4); var2 < 4 && (this.olddir != -1 && var3 == (this.olddir + 2) % 4 || var3 == 0 && this.y > dmnew.partyy || var3 == 2 && this.y < dmnew.partyy || var3 == 3 && this.x < dmnew.partyx || var3 == 1 && this.x > dmnew.partyx || !this.canMove(var3)); var3 = (var3 + 1) % 4) {
++var2;
}
if (var2 < 4 && dmnew.randGen.nextInt(15) > 0) {
this.olddir = var3;
this.monMove(var3);
} else if (var1) {
this.doAttack();
} else if ((this.ammo > 0 || this.hasmagic && !this.silenced && this.mana >= this.minproj) && (this.x == dmnew.partyx && this.ydist > 1 || this.y == dmnew.partyy && this.xdist > 1)) {
if (this.x < dmnew.partyx && this.canDoProj(3)) {
this.doProjAttack(3);
} else if (this.x > dmnew.partyx && this.canDoProj(1)) {
this.doProjAttack(1);
} else if (this.y > dmnew.partyy && this.canDoProj(0)) {
this.doProjAttack(0);
} else if (this.y < dmnew.partyy && this.canDoProj(2)) {
this.doProjAttack(2);
} else {
this.movecounter = 0;
}
} else if (dmnew.randGen.nextBoolean()) {
this.olddir = -1;
this.newai = 1;
} else if (this.x > dmnew.partyx && this.canMove(1)) {
this.wasstuck = true;
this.olddir = 1;
this.monMove(1);
} else if (this.x < dmnew.partyx && this.canMove(3)) {
this.wasstuck = true;
this.olddir = 3;
this.monMove(3);
} else if (this.y > dmnew.partyy && this.canMove(0)) {
this.wasstuck = true;
this.olddir = 0;
this.monMove(0);
} else if (this.y < dmnew.partyy && this.canMove(2)) {
this.wasstuck = true;
this.olddir = 2;
this.monMove(2);
} else {
this.movecounter = 0;
}
}
} else {
if (this.y == dmnew.partyy && dmnew.randGen.nextBoolean()) {
if (dmnew.randGen.nextBoolean() && this.canMove(0)) {
this.monMove(0);
} else if (this.canMove(2)) {
this.monMove(2);
} else if (this.canMove(0)) {
this.monMove(0);
} else if (this.x > dmnew.partyx) {
if ((!this.wasstuck || this.olddir == -1 || this.olddir != 1) && this.canMove(3)) {
this.monMove(3);
}
} else if (this.x < dmnew.partyx) {
if ((!this.wasstuck || this.olddir == -1 || this.olddir != 3) && this.canMove(1)) {
this.monMove(1);
}
} else {
this.wasstuck = true;
this.randomcounter = 3;
this.newai = 0;
}
} else if (this.y > dmnew.partyy) {
if ((!this.wasstuck || this.olddir != -1 || this.olddir != 0) && this.canMove(2)) {
this.monMove(2);
}
} else if (this.y < dmnew.partyy) {
if ((!this.wasstuck || this.olddir != -1 || this.olddir != 2) && this.canMove(0)) {
this.monMove(0);
}
} else if (this.x > dmnew.partyx) {
if ((!this.wasstuck || this.olddir != -1 || this.olddir != 1) && this.canMove(3)) {
this.monMove(3);
}
} else if (this.x < dmnew.partyx && (!this.wasstuck || this.olddir != -1 || this.olddir != 3) && this.canMove(1)) {
this.monMove(1);
}
if (this.movecounter > this.movespeed) {
this.wasstuck = true;
var2 = 0;
for(var3 = dmnew.randGen.nextInt(4); var2 < 4 && (this.olddir != -1 && var3 == (this.olddir + 2) % 4 || var3 == 0 && this.y > dmnew.partyy || var3 == 2 && this.y < dmnew.partyy || var3 == 3 && this.x < dmnew.partyx || var3 == 1 && this.x > dmnew.partyx || !this.canMove(var3)); var3 = (var3 + 1) % 4) {
++var2;
}
if (var2 < 4 && dmnew.randGen.nextInt(15) > 0) {
this.olddir = var3;
this.monMove(var3);
} else if (var1) {
this.doAttack();
} else if ((this.ammo > 0 || this.hasmagic && !this.silenced && this.mana >= this.minproj) && (this.x == dmnew.partyx && this.ydist > 1 || this.y == dmnew.partyy && this.xdist > 1)) {
if (this.x < dmnew.partyx && this.canDoProj(3)) {
this.doProjAttack(3);
} else if (this.x > dmnew.partyx && this.canDoProj(1)) {
this.doProjAttack(1);
} else if (this.y > dmnew.partyy && this.canDoProj(0)) {
this.doProjAttack(0);
} else if (this.y < dmnew.partyy && this.canDoProj(2)) {
this.doProjAttack(2);
} else {
this.movecounter = 0;
}
} else if (dmnew.randGen.nextBoolean()) {
this.olddir = -1;
this.newai = 1;
} else if (this.x > dmnew.partyx && this.canMove(1)) {
this.wasstuck = true;
this.olddir = 1;
this.monMove(1);
} else if (this.x < dmnew.partyx && this.canMove(3)) {
this.wasstuck = true;
this.olddir = 3;
this.monMove(3);
} else if (this.y > dmnew.partyy && this.canMove(0)) {
this.wasstuck = true;
this.olddir = 0;
this.monMove(0);
} else if (this.y < dmnew.partyy && this.canMove(2)) {
this.wasstuck = true;
this.olddir = 2;
this.monMove(2);
} else {
this.movecounter = 0;
}
}
}
if (this.hurt && this.hasheal && !this.silenced && this.mana > 59 && dmnew.randGen.nextBoolean()) {
this.useHealMagic();
} else if (this.hurt && (double)this.health > 0.2D * (double)this.maxhealth) {
this.hurt = false;
if (this.runcounter == 0) {
this.olddir = -1;
this.newai = this.defaultai;
}
}
if (!this.hurt && this.runcounter > 0) {
--this.runcounter;
if (this.runcounter == 0) {
this.olddir = -1;
this.newai = this.defaultai;
if (this.newai == 4) {
this.newai = 1;
this.defaultai = 1;
}
}
}
break label1564;
case 4:
}
if (this.hasheal && !this.silenced && (double)this.health < 0.2D * (double)this.maxhealth && this.mana > 59) {
this.useHealMagic();
} else if (this.level != dmnew.level) {
this.movecounter = 0;
} else if (var1) {
this.doAttack();
} else if (this.x != dmnew.partyx || this.ydist <= 1 || this.ammo <= 0 && (!this.hasmagic || this.silenced || this.mana < this.minproj)) {
if (this.y != dmnew.partyy || this.xdist <= 1 || this.ammo <= 0 && (!this.hasmagic || this.silenced || this.mana < this.minproj)) {
if (this.xdist == 0 && this.ydist == 1) {
if (this.y > dmnew.partyy && this.canMove(0)) {
this.monMove(0);
} else if (this.y < dmnew.partyy && this.canMove(2)) {
this.monMove(2);
} else {
this.movecounter = 0;
}
} else if (this.ydist == 0 && this.xdist == 1) {
if (this.x > dmnew.partyx && this.canMove(1)) {
this.monMove(1);
} else if (this.x < dmnew.partyx && this.canMove(3)) {
this.monMove(3);
} else {
this.movecounter = 0;
}
} else {
this.movecounter = 0;
}
} else if (this.x < dmnew.partyx && this.canDoProj(3)) {
this.doProjAttack(3);
} else if (this.x > dmnew.partyx && this.canDoProj(1)) {
this.doProjAttack(1);
} else if ((this.subsquare == 0 || this.subsquare == 1) && this.canMove(2)) {
this.monMove(2);
} else if ((this.subsquare == 2 || this.subsquare == 3) && this.canMove(0)) {
this.monMove(0);
} else {
this.movecounter = 0;
}
} else if (this.y > dmnew.partyy && this.canDoProj(0)) {
this.doProjAttack(0);
} else if (this.y < dmnew.partyy && this.canDoProj(2)) {
this.doProjAttack(2);
} else if ((this.subsquare == 0 || this.subsquare == 3) && this.canMove(3)) {
this.monMove(3);
} else if ((this.subsquare == 1 || this.subsquare == 2) && this.canMove(1)) {
this.monMove(1);
} else {
this.movecounter = 0;
}
if (this.level == dmnew.level && this.xdist < 5 && this.ydist < 5) {
if (this.xdist != 0 && this.xdist > this.ydist) {
if (dmnew.partyx > this.x) {
this.facing = 3;
} else {
this.facing = 1;
}
} else if (dmnew.partyy > this.y) {
this.facing = 2;
} else {
this.facing = 0;
}
if (this.useammo && this.ammo == 0) {
this.defaultai = 1;
this.newai = 1;
}
}
}
this.currentai = this.newai;
} while(this.currentai == 4);
} while(this.xdist <= 4);
} while(this.ydist <= 4);
} while(this.currentai == 0 && this.randomcounter <= 0);
this.randomcounter = 0;
this.currentai = 0;
}
}
public boolean canMove(int var1) {
int var2 = this.x;
int var3 = this.y;
byte var4 = 5;
if (var1 != 0 && var1 != 2) {
if (this.subsquare == 0) {
var4 = 1;
} else if (this.subsquare == 1) {
var4 = 0;
} else if (this.subsquare == 2) {
var4 = 3;
} else if (this.subsquare == 3) {
var4 = 2;
}
if (var1 != 3 || var4 != 0 && var4 != 3 && var4 != 5) {
if (var1 == 1 && (var4 == 1 || var4 == 2 || var4 == 5)) {
--var2;
}
} else {
++var2;
}
} else {
if (this.subsquare == 0) {
var4 = 3;
} else if (this.subsquare == 3) {
var4 = 0;
} else if (this.subsquare == 1) {
var4 = 2;
} else if (this.subsquare == 2) {
var4 = 1;
}
if (var1 == 0 && (var4 == 3 || var4 == 2 || var4 == 5)) {
--var3;
} else if (var1 == 2 && (var4 == 0 || var4 == 1 || var4 == 5)) {
++var3;
}
}
if (var2 >= 0 && var3 >= 0 && var2 < dmnew.mapwidth && var3 < dmnew.mapheight) {
boolean var5 = true;
if ((dmnew.DungeonMap[this.level][var2][var3].isPassable || this.isImmaterial) && !dmnew.DungeonMap[this.level][var2][var3].hasParty && dmnew.DungeonMap[this.level][var2][var3].numProjs <= 0 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs <= 0) {
if (!dmnew.DungeonMap[this.level][var2][var3].hasMons || var4 != 5 && dmnew.dmmons.get(this.level + "," + var2 + "," + var3 + "," + var4) == null && dmnew.dmmons.get(this.level + "," + var2 + "," + var3 + "," + 5) == null) {
if (var2 >= 0 && var3 >= 0 && var2 != dmnew.mapwidth && var3 != dmnew.mapheight) {
if (!dmnew.DungeonMap[this.level][var2][var3].canPassMons) {
var5 = false;
} else if (this.isImmaterial && !dmnew.DungeonMap[this.level][var2][var3].canPassImmaterial) {
var5 = false;
} else if (!this.isImmaterial && !this.ignoremons && dmnew.DungeonMap[this.level][var2][var3].hasCloud && dmnew.randGen.nextBoolean()) {
var5 = false;
} else if (this.isflying || !(dmnew.DungeonMap[this.level][var2][var3] instanceof FulYaPit) && (!(dmnew.DungeonMap[this.level][var2][var3] instanceof Pit) || !((Pit)dmnew.DungeonMap[this.level][var2][var3]).isOpen && (this.ignoremons || !((Pit)dmnew.DungeonMap[this.level][var2][var3]).isActive))) {
if (!this.canusestairs && dmnew.DungeonMap[this.level][var2][var3] instanceof Stairs) {
var5 = false;
} else if (this.number == 26 && dmnew.fluxchanging && dmnew.fluxcages.get(this.level + "," + var2 + "," + var3) != null) {
var5 = false;
}
} else {
var5 = false;
}
} else {
var5 = false;
}
} else {
var5 = false;
}
} else {
var5 = false;
}
if (!var5 && dmnew.DungeonMap[this.level][var2][var3] instanceof Door && !((Door)dmnew.DungeonMap[this.level][var2][var3]).isOpen) {
if (!this.ignoremons && ((Door)dmnew.DungeonMap[this.level][var2][var3]).opentype == 1) {
((Door)dmnew.DungeonMap[this.level][var2][var3]).activate();
if (!dmnew.DungeonMap[this.level][var2][var3].hasMons && !dmnew.DungeonMap[this.level][var2][var3].hasParty && dmnew.DungeonMap[this.level][var2][var3].numProjs == 0 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs == 0) {
var5 = true;
}
} else if (!this.breakdoor && (this.number == 8 || this.number == 13 || this.number == 20 || this.number == 21 || this.number == 23 || this.number == 25) && ((Door)dmnew.DungeonMap[this.level][var2][var3]).isBreakable && ((Door)dmnew.DungeonMap[this.level][var2][var3]).pictype == 0) {
this.breakdoor = true;
if (this.level == dmnew.level) {
this.facing = var1;
this.isattacking = true;
dmnew.needredraw = true;
}
((Door)dmnew.DungeonMap[this.level][var2][var3]).breakDoor(this.power + dmnew.randGen.nextInt(this.power / 4 + 10), true, false);
if (((Door)dmnew.DungeonMap[this.level][var2][var3]).isBroken && !dmnew.DungeonMap[this.level][var2][var3].hasMons && !dmnew.DungeonMap[this.level][var2][var3].hasParty && dmnew.DungeonMap[this.level][var2][var3].numProjs == 0 && dmnew.DungeonMap[this.level][this.x][this.y].numProjs == 0) {
var5 = true;
}
}
}
return var5;
} else {
return false;
}
}
public void monMove(int var1) {
this.parry = -1;
int var2 = this.x;
int var3 = this.y;
byte var4 = 5;
if (var1 != 0 && var1 != 2) {
if (this.subsquare == 0) {
var4 = 1;
} else if (this.subsquare == 1) {
var4 = 0;
} else if (this.subsquare == 2) {
var4 = 3;
} else if (this.subsquare == 3) {
var4 = 2;
}
if (var1 != 3 || var4 != 0 && var4 != 3 && var4 != 5) {
if (var1 == 1 && (var4 == 1 || var4 == 2 || var4 == 5)) {
--var2;
}
} else {
++var2;
}
} else {
if (this.subsquare == 0) {
var4 = 3;
} else if (this.subsquare == 3) {
var4 = 0;
} else if (this.subsquare == 1) {
var4 = 2;
} else if (this.subsquare == 2) {
var4 = 1;
}
if (var1 == 0 && (var4 == 3 || var4 == 2 || var4 == 5)) {
--var3;
} else if (var1 == 2 && (var4 == 0 || var4 == 1 || var4 == 5)) {
++var3;
}
}
this.facing = var1;
this.movecounter = 0;
if (!this.breakdoor) {
if (this.isImmaterial || dmnew.DungeonMap[this.level][var2][var3].mapchar != 'd' || dmnew.DungeonMap[this.level][var2][var3].isPassable) {
boolean var5 = false;
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
if (this.x == var2 && this.y == var3) {
if (dmnew.DungeonMap[this.level][this.x][this.y].mapchar == '>') {
var5 = true;
}
} else {
var5 = true;
boolean var7 = false;
boolean var8 = false;
int var9 = 0;
while(var9 < 6) {
dmnew.Monster var6 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + var9);
if (var6 != null) {
var7 = true;
if (!var6.isImmaterial && !var6.isflying) {
var8 = true;
}
}
if (var9 == 3) {
var9 = 5;
} else {
++var9;
}
}
dmnew.DungeonMap[this.level][this.x][this.y].hasMons = var7;
if (!this.isflying && !this.isImmaterial && !var8) {
dmnew.dmmons.put(this.level + "," + var2 + "," + var3 + "," + var4, this);
boolean var10 = dmnew.DungeonMap[this.level][var2][var3].hasMons;
dmnew.DungeonMap[this.level][var2][var3].hasMons = true;
dmnew.DungeonMap[this.level][this.x][this.y].tryFloorSwitch(5);
dmnew.dmmons.remove(this.level + "," + var2 + "," + var3 + "," + var4);
dmnew.DungeonMap[this.level][var2][var3].hasMons = var10;
}
}
this.subsquare = var4;
if ((this.x != var2 || this.y != var3) && !this.isflying && !this.isImmaterial) {
dmnew.DungeonMap[this.level][var2][var3].tryFloorSwitch(4);
}
this.x = var2;
this.y = var3;
dmnew.dmmons.put(this.level + "," + this.x + "," + this.y + "," + this.subsquare, this);
dmnew.DungeonMap[this.level][this.x][this.y].hasMons = true;
this.xdist = this.x - dmnew.partyx;
if (this.xdist < 0) {
this.xdist *= -1;
}
this.ydist = this.y - dmnew.partyy;
if (this.ydist < 0) {
this.ydist *= -1;
}
if (this.level == dmnew.level && this.xdist < 5 && this.ydist < 5) {
dmnew.needredraw = true;
}
if (var5) {
dmnew.DungeonMap[this.level][this.x][this.y].tryTeleport(this);
this.xdist = this.x - dmnew.partyx;
if (this.xdist < 0) {
this.xdist *= -1;
}
this.ydist = this.y - dmnew.partyy;
if (this.ydist < 0) {
this.ydist *= -1;
}
}
if (this.pickup != 0 && dmnew.DungeonMap[this.level][this.x][this.y].hasItems && (this.pickup == 4 || this.pickup == 2 && dmnew.randGen.nextBoolean() || this.pickup == 1 && dmnew.randGen.nextInt(4) == 0 || this.pickup == 3 && dmnew.randGen.nextInt(4) != 0)) {
Item var11;
if (this.subsquare < 4) {
var11 = dmnew.DungeonMap[this.level][this.x][this.y].pickUpItem(this.subsquare);
} else {
var11 = (Item)dmnew.DungeonMap[this.level][this.x][this.y].mapItems.remove(dmnew.DungeonMap[this.level][this.x][this.y].mapItems.size() - 1);
if (dmnew.DungeonMap[this.level][this.x][this.y].mapItems.isEmpty()) {
dmnew.DungeonMap[this.level][this.x][this.y].hasItems = false;
}
}
if (var11 != null) {
this.carrying.add(var11);
if (this.useammo && (var11.number > 220 && (var11.hasthrowpic || var11.number == 266) || var11.projtype > 0 && (double)var11.weight <= 1.0D)) {
++this.ammo;
}
dmnew.DungeonMap[this.level][this.x][this.y].tryFloorSwitch(3);
}
}
if (this.level == dmnew.level && this.xdist < 5 && this.ydist < 5) {
dmnew.needredraw = true;
if (this.attackspeed > 0 && (this.xdist == 0 && this.ydist == 1 || this.ydist == 0 && this.xdist == 1)) {
this.movecounter = this.attackspeed;
}
}
if (this.movespeed - this.movecounter < 2) {
this.moveattack = dmnew.moncycle;
}
}
}
}
public void doAttack() {
boolean var1 = false;
if (dmnew.partyx > this.x && this.facing != 3) {
this.facing = 3;
var1 = true;
} else if (dmnew.partyx < this.x && this.facing != 1) {
this.facing = 1;
var1 = true;
} else if (dmnew.partyy > this.y && this.facing != 2) {
this.facing = 2;
var1 = true;
} else if (dmnew.partyy < this.y && this.facing != 0) {
this.facing = 0;
var1 = true;
} else if (dmnew.alldead) {
var1 = true;
}
if (this.waitattack && var1 && !dmnew.alldead) {
var1 = false;
this.waitattack = false;
}
if (!var1) {
if (this.hasmagic && !this.silenced && this.mana >= this.minproj && dmnew.randGen.nextInt() % 10 > 0) {
if (this.x < dmnew.partyx && this.canDoProj(3)) {
this.doProjAttack(3);
return;
}
if (this.x > dmnew.partyx && this.canDoProj(1)) {
this.doProjAttack(1);
return;
}
if (this.y > dmnew.partyy && this.canDoProj(0)) {
this.doProjAttack(0);
return;
}
if (this.y < dmnew.partyy && this.canDoProj(2)) {
this.doProjAttack(2);
return;
}
} else if (this.hasdrain && !this.silenced && this.mana >= this.minproj && this.health < this.maxhealth) {
byte var4;
byte var5;
byte var6;
byte var7;
if (this.facing == 0) {
var4 = 2;
var5 = 3;
var6 = 0;
var7 = 1;
} else if (this.facing == 2) {
var4 = 0;
var5 = 1;
var6 = 2;
var7 = 3;
} else if (this.facing == 3) {
var4 = 0;
var5 = 3;
var6 = 1;
var7 = 2;
} else {
var4 = 1;
var5 = 2;
var6 = 0;
var7 = 3;
}
int var2;
int var3;
if (dmnew.randGen.nextBoolean()) {
var2 = (var4 + dmnew.facing) % 4;
var3 = (var5 + dmnew.facing) % 4;
} else {
var2 = (var5 + dmnew.facing) % 4;
var3 = (var4 + dmnew.facing) % 4;
}
if (dmnew.heroatsub[var2] == -1) {
var2 = var3;
if (dmnew.heroatsub[var3] == -1) {
if (dmnew.randGen.nextBoolean()) {
var2 = (var6 + dmnew.facing) % 4;
var3 = (var7 + dmnew.facing) % 4;
} else {
var2 = (var7 + dmnew.facing) % 4;
var3 = (var6 + dmnew.facing) % 4;
}
if (dmnew.heroatsub[var2] == -1) {
var2 = var3;
}
}
}
var2 = dmnew.heroatsub[var2];
int var9 = this.castpower + 1;
int var8;
do {
--var9;
var8 = var9;
for(int var10 = 0; var10 < 3; ++var10) {
var8 += var9 * 6 * var10;
}
} while(var8 > this.mana && var9 >= 0);
try {
Spell var13 = new Spell(var9 + "666");
int[] var10000 = var13.powers;
int var10001 = var13.gain - 1;
var10000[var10001] += dmnew.randGen.nextInt() % 10 + (var13.gain - 1) * this.manapower / 8;
var13.power = var13.powers[var13.gain - 1];
if (var13.power < 1) {
var13.power = dmnew.randGen.nextInt(4) + 1;
}
int var11 = dmnew.hero[var2].damage(var13.power, 7);
if (var11 > 0) {
this.heal(var11);
dmnew.message.setMessage(this.name + " drains " + var11 + " life from " + dmnew.hero[var2].name, 5);
} else if (var11 != 0) {
this.damage(var11, 1);
}
if (this.soundstring != null) {
dmnew.playSound(this.soundstring, this.x, this.y);
}
this.iscasting = true;
this.movecounter = this.attackspeed;
dmnew.needredraw = true;
dmnew.playSound("oof.wav", -1, -1);
return;
} catch (Exception var12) {
}
}
if (this.soundstring != null) {
dmnew.playSound(this.soundstring, this.x, this.y);
}
this.isattacking = true;
this.movecounter = this.attackspeed;
} else {
this.movecounter = this.movespeed - 2;
if (this.movecounter < 0) {
this.movecounter = 0;
}
}
dmnew.needredraw = true;
}
public boolean canDoProj(int var1) {
boolean var3 = false;
boolean var4 = true;
boolean var5 = true;
boolean var6 = false;
boolean var7 = true;
boolean var8 = true;
int var2;
dmnew.Monster var9;
byte var10;
byte var11;
switch(var1) {
case 0:
if (this.hasmagic && this.mana >= this.minproj) {
if (this.ydist > 4 && this.ydist * 2 > this.castpower * 5 + 3) {
return false;
}
} else if (this.ydist > 4 && this.ydist * 2 > (this.power + 5) / 8 + 1) {
return false;
}
var2 = this.y;
this.castsub = 0;
var10 = 0;
var11 = 3;
if (this.subsquare > 0 && this.subsquare < 3) {
var10 = 1;
var11 = 2;
}
if (dmnew.heroatsub[(var10 + dmnew.facing) % 4] == -1 && dmnew.heroatsub[(var11 + dmnew.facing) % 4] == -1) {
var5 = false;
var7 = false;
}
if (this.subsquare == 5) {
var8 = dmnew.heroatsub[(1 + dmnew.facing) % 4] != -1 || dmnew.heroatsub[(2 + dmnew.facing) % 4] != -1;
if (var8 && (!var5 || dmnew.randGen.nextBoolean())) {
var10 = 1;
var11 = 2;
var5 = true;
this.castsub = 1;
}
}
if (!var5) {
return false;
}
if (this.subsquare == 0 || this.subsquare == 1 || this.subsquare == 5 || this.ignoremons) {
--var2;
}
for(; var5 && var2 > dmnew.partyy; --var2) {
if (!dmnew.DungeonMap[this.level][this.x][var2].canPassProjs) {
var5 = false;
} else if (!this.ignoremons) {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + var2 + "," + 5);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.y || 5 != this.subsquare)) {
var5 = false;
} else {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + var2 + "," + var10);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.y || var10 != this.subsquare)) {
var5 = false;
} else {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + var2 + "," + var11);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.y || var11 != this.subsquare)) {
var5 = false;
}
}
}
if (!var5 && this.subsquare == 5 && !var6) {
if (this.castsub == 0 && var8) {
var5 = true;
this.castsub = 1;
var10 = 1;
var11 = 2;
} else if (var7) {
var5 = true;
this.castsub = 0;
var10 = 0;
var11 = 3;
}
var6 = true;
var2 = this.y;
}
}
}
return var5;
case 1:
if (this.hasmagic && this.mana >= this.minproj) {
if (this.xdist > 4 && this.xdist * 2 > this.castpower * 5 + 3) {
return false;
}
} else if (this.xdist > 4 && this.xdist * 2 > (this.power + 5) / 8 + 1) {
return false;
}
var2 = this.x;
this.castsub = 0;
var10 = 0;
var11 = 1;
if (this.subsquare > 1 && this.subsquare != 5) {
var10 = 2;
var11 = 3;
}
if (dmnew.heroatsub[(var10 + dmnew.facing) % 4] == -1 && dmnew.heroatsub[(var11 + dmnew.facing) % 4] == -1) {
var5 = false;
var7 = false;
}
if (this.subsquare == 5) {
var8 = dmnew.heroatsub[(2 + dmnew.facing) % 4] != -1 || dmnew.heroatsub[(3 + dmnew.facing) % 4] != -1;
if (var8 && (!var5 || dmnew.randGen.nextBoolean())) {
var5 = true;
this.castsub = 3;
var10 = 2;
var11 = 3;
}
}
if (!var5) {
return false;
}
if (this.subsquare == 0 || this.subsquare == 3 || this.subsquare == 5 || this.ignoremons) {
--var2;
}
for(; var5 && var2 > dmnew.partyx; --var2) {
if (!dmnew.DungeonMap[this.level][var2][this.y].canPassProjs) {
var5 = false;
} else if (!this.ignoremons) {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + var2 + "," + this.y + "," + 5);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.x || 5 != this.subsquare)) {
var5 = false;
} else {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + var2 + "," + this.y + "," + var10);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.x || var10 != this.subsquare)) {
var5 = false;
} else {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + var2 + "," + this.y + "," + var11);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.x || var11 != this.subsquare)) {
var5 = false;
}
}
}
if (!var5 && this.subsquare == 5 && !var6) {
if (this.castsub == 0 && var8) {
var5 = true;
this.castsub = 3;
var10 = 2;
var11 = 3;
} else if (var7) {
var5 = true;
this.castsub = 0;
var10 = 0;
var11 = 1;
}
var6 = true;
var2 = this.x;
}
}
}
return var5;
case 2:
if (this.hasmagic && this.mana >= this.minproj) {
if (this.ydist > 4 && this.ydist * 2 > this.castpower * 5 + 3) {
return false;
}
} else if (this.ydist > 4 && this.ydist * 2 > (this.power + 5) / 8 + 1) {
return false;
}
var2 = this.y;
this.castsub = 3;
var10 = 0;
var11 = 3;
if (this.subsquare > 0 && this.subsquare < 3) {
var10 = 1;
var11 = 2;
}
if (dmnew.heroatsub[(var10 + dmnew.facing) % 4] == -1 && dmnew.heroatsub[(var11 + dmnew.facing) % 4] == -1) {
var5 = false;
var7 = false;
}
if (this.subsquare == 5) {
var8 = dmnew.heroatsub[(1 + dmnew.facing) % 4] != -1 || dmnew.heroatsub[(2 + dmnew.facing) % 4] != -1;
if (var8 && (!var5 || dmnew.randGen.nextBoolean())) {
var10 = 1;
var11 = 2;
var5 = true;
this.castsub = 2;
}
}
if (!var5) {
return false;
}
if (this.subsquare == 2 || this.subsquare == 3 || this.subsquare == 5 || this.ignoremons) {
++var2;
}
for(; var5 && var2 < dmnew.partyy; ++var2) {
if (!dmnew.DungeonMap[this.level][this.x][var2].canPassProjs) {
var5 = false;
} else if (!this.ignoremons) {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + var2 + "," + 5);
if (var9 == null || var9.isdying || var9.isImmaterial || var2 == this.y && 5 == this.subsquare) {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + var2 + "," + var10);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.y || var10 != this.subsquare)) {
var5 = false;
} else {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + var2 + "," + var11);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.y || var11 != this.subsquare)) {
var5 = false;
}
}
} else {
var5 = false;
}
if (!var5 && this.subsquare == 5 && !var6) {
if (this.castsub == 3 && var8) {
var5 = true;
this.castsub = 2;
var10 = 1;
var11 = 2;
} else if (var7) {
var5 = true;
this.castsub = 3;
var10 = 0;
var11 = 3;
}
var6 = true;
var2 = this.y;
}
}
}
return var5;
case 3:
if (this.hasmagic && this.mana >= this.minproj) {
if (this.xdist > 4 && this.xdist * 2 > this.castpower * 5 + 3) {
return false;
}
} else if (this.xdist > 4 && this.xdist * 2 > (this.power + 5) / 8 + 1) {
return false;
}
var2 = this.x;
this.castsub = 1;
var10 = 0;
var11 = 1;
if (this.subsquare > 1 && this.subsquare != 5) {
var10 = 2;
var11 = 3;
}
if (dmnew.heroatsub[(var10 + dmnew.facing) % 4] == -1 && dmnew.heroatsub[(var11 + dmnew.facing) % 4] == -1) {
var5 = false;
var7 = false;
}
if (this.subsquare == 5) {
var8 = dmnew.heroatsub[(2 + dmnew.facing) % 4] != -1 || dmnew.heroatsub[(3 + dmnew.facing) % 4] != -1;
if (var8 && (!var5 || dmnew.randGen.nextBoolean())) {
var5 = true;
this.castsub = 2;
var10 = 2;
var11 = 3;
}
}
if (!var5) {
return false;
}
if (this.subsquare == 1 || this.subsquare == 2 || this.subsquare == 5 || this.ignoremons) {
++var2;
}
for(; var5 && var2 < dmnew.partyx; ++var2) {
if (!dmnew.DungeonMap[this.level][var2][this.y].canPassProjs) {
var5 = false;
} else if (!this.ignoremons) {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + var2 + "," + this.y + "," + 5);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.x || 5 != this.subsquare)) {
var5 = false;
} else {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + var2 + "," + this.y + "," + var10);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.x || var10 != this.subsquare)) {
var5 = false;
} else {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + var2 + "," + this.y + "," + var11);
if (var9 != null && !var9.isdying && !var9.isImmaterial && (var2 != this.x || var11 != this.subsquare)) {
var5 = false;
}
}
}
if (!var5 && this.subsquare == 5 && !var6) {
if (this.castsub == 1 && var8) {
var5 = true;
this.castsub = 2;
var10 = 2;
var11 = 3;
} else if (var7) {
var5 = true;
this.castsub = 1;
var10 = 0;
var11 = 1;
}
var6 = true;
var2 = this.x;
}
}
}
}
return var5;
}
public void doProjAttack(int var1) {
int var3 = (this.subsquare + dmnew.facing) % 4;
if (this.subsquare == 5) {
var3 = (this.castsub + dmnew.facing) % 4;
}
int var5;
int var7;
Spell var8;
if (this.hasmagic && !this.silenced && this.mana >= this.minproj && (this.ammo == 0 || dmnew.randGen.nextBoolean())) {
boolean var12 = false;
var5 = 0;
int var13 = 0;
var7 = dmnew.randGen.nextInt(this.numspells);
while(!var12) {
var13 = this.castpower;
do {
var5 = var13;
for(int var14 = 0; var14 < this.knownspells[var7].length(); ++var14) {
var5 += dmnew.SYMBOLCOST[Integer.parseInt(this.knownspells[var7].substring(var14, var14 + 1)) - 1 + var14 * 6][var13 - 1];
}
--var13;
if (this.number == 25) {
var5 = 0;
}
} while(var5 > this.mana && var13 > 0);
if (var5 <= this.mana) {
var12 = true;
} else {
var7 = (var7 + 1) % this.numspells;
}
}
if (this.soundstring != null) {
dmnew.playSound(this.soundstring, this.x, this.y);
}
try {
var8 = new Spell(var13 + 1 + this.knownspells[var7]);
if (var8.number != 461 && var8.number != 363 && var8.number != 362 && var8.number != 664 && var8.number != 523) {
for(int var9 = var8.gain - 1; var9 >= 0; --var9) {
int[] var10000 = var8.powers;
var10000[var9] += dmnew.randGen.nextInt() % 10 + var9 * this.manapower / 8;
if (var8.powers[var9] < 1) {
var8.powers[var9] = dmnew.randGen.nextInt(4) + 1;
}
}
var8.power = var8.powers[var8.gain - 1];
}
dmnew.this.new Projectile(var8, this.x, this.y, var8.dist, var1, var3);
this.mana -= var5;
} catch (Exception var11) {
var11.printStackTrace();
this.movecounter = this.attackspeed;
}
} else {
if (this.soundstring != null) {
dmnew.playSound(this.soundstring, this.x, this.y);
}
Item var4 = null;
var5 = 0;
boolean var6 = false;
while(true) {
while(!var6) {
var4 = (Item)this.carrying.get(var5);
if (var4.type == 0 && (var4.number > 220 && (var4.hasthrowpic || var4.number == 266) || var4.projtype > 0 && (double)var4.weight <= 1.0D)) {
this.carrying.remove(var5);
var6 = true;
} else {
++var5;
}
}
--this.ammo;
var4.shotpow = this.castpower;
var7 = (this.power + 5) / 5 - (int)(var4.weight / 2.0F) + dmnew.randGen.nextInt() % 2;
if (var7 < 8) {
var7 = 8;
}
if (var4.isbomb) {
try {
var8 = new Spell(var4.bombnum);
var8.power = var4.potionpow + dmnew.randGen.nextInt() % 10;
dmnew.this.new Projectile(var8, this.x, this.y, var7, var1, var3);
} catch (Exception var10) {
dmnew.this.new Projectile(var4, this.x, this.y, var7, var1, var3);
}
} else {
dmnew.this.new Projectile(var4, this.x, this.y, var7, var1, var3);
}
break;
}
}
if (dmnew.partyx > this.x && this.facing != 3) {
this.facing = 3;
} else if (dmnew.partyx < this.x && this.facing != 1) {
this.facing = 1;
} else if (dmnew.partyy > this.y && this.facing != 2) {
this.facing = 2;
} else if (dmnew.partyy < this.y && this.facing != 0) {
this.facing = 0;
}
this.iscasting = true;
dmnew.needredraw = true;
this.movecounter = this.attackspeed;
}
public void useHealMagic() {
int var1 = this.mana / 60;
if (var1 > this.castpower) {
var1 = this.castpower;
}
this.heal(var1 * (dmnew.randGen.nextInt(this.manapower / 2) + this.manapower / 2));
this.energize(var1 * -60);
this.iscasting = true;
if (this.level == dmnew.level) {
dmnew.needredraw = true;
}
this.movecounter = this.attackspeed;
}
public boolean teleport() {
int var5 = 121;
int var6 = dmnew.randGen.nextInt(4);
int var1;
int var2;
byte var3;
byte var4;
if (var6 == 0) {
var1 = this.x - 5;
var2 = this.y - 5;
var3 = 1;
var4 = 1;
} else if (var6 == 2) {
var1 = this.x + 5;
var2 = this.y + 5;
var3 = -1;
var4 = -1;
} else if (var6 == 1) {
var1 = this.x - 5;
var2 = this.y + 5;
var3 = 1;
var4 = -1;
} else {
var1 = this.x + 5;
var2 = this.y - 5;
var3 = -1;
var4 = 1;
}
do {
var1 += var3;
if (var1 > this.x + 5) {
var1 = this.x - 5;
var2 += var4;
} else if (var1 < this.x - 5) {
var1 = this.x + 5;
var2 += var4;
}
--var5;
} while(var5 > 0 && (var1 < 0 || var2 < 0 || var1 >= dmnew.mapwidth || var2 >= dmnew.mapheight || !dmnew.DungeonMap[this.level][var1][var2].isPassable || dmnew.DungeonMap[this.level][var1][var2].hasMons || dmnew.DungeonMap[this.level][var1][var2].hasParty || !dmnew.DungeonMap[this.level][var1][var2].canPassMons || dmnew.DungeonMap[this.level][var1][var2].mapchar == '>' || var1 == this.x && var2 == this.y || this.number == 26 && dmnew.fluxcages.get(this.level + "," + var1 + "," + var2) != null));
if (var5 != 0) {
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
boolean var8 = false;
boolean var9 = false;
int var10 = 0;
while(var10 < 6) {
dmnew.Monster var7 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + var10);
if (var7 != null) {
var8 = true;
if (!var7.isImmaterial && !var7.isflying) {
var9 = true;
}
}
if (var10 == 3) {
var10 = 5;
} else {
++var10;
}
}
dmnew.DungeonMap[this.level][this.x][this.y].hasMons = var8;
if (!this.isflying && !this.isImmaterial && !var9) {
dmnew.DungeonMap[this.level][this.x][this.y].tryFloorSwitch(5);
}
if (!this.isflying && !this.isImmaterial) {
dmnew.DungeonMap[this.level][var1][var2].tryFloorSwitch(4);
}
this.x = var1;
this.y = var2;
dmnew.dmmons.put(this.level + "," + this.x + "," + this.y + "," + this.subsquare, this);
dmnew.DungeonMap[this.level][this.x][this.y].hasMons = true;
this.xdist = this.x - dmnew.partyx;
if (this.xdist < 0) {
this.xdist *= -1;
}
this.ydist = this.y - dmnew.partyy;
if (this.ydist < 0) {
this.ydist *= -1;
}
if (this.level == dmnew.level && this.xdist < 5 && this.ydist < 5) {
dmnew.needredraw = true;
}
dmnew.DungeonMap[this.level][this.x][this.y].tryTeleport(this);
this.xdist = this.x - dmnew.partyx;
if (this.xdist < 0) {
this.xdist *= -1;
}
this.ydist = this.y - dmnew.partyy;
if (this.ydist < 0) {
this.ydist *= -1;
}
if (this.level == dmnew.level && this.xdist < 5 && this.ydist < 5) {
dmnew.needredraw = true;
}
return true;
} else {
return false;
}
}
public void heal(int var1) {
this.health += var1;
if (this.health > this.maxhealth) {
this.health = this.maxhealth;
}
}
public void energize(int var1) {
this.mana += var1;
if (this.mana > this.maxmana) {
this.mana = this.maxmana;
} else if (this.mana < 0) {
this.mana = 0;
}
}
public int damage(int var1, int var2) {
if (this.isdying) {
return 0;
} else {
boolean var3;
if (this.needitem != 0 && var2 != 4 && var2 != 6) {
var3 = false;
int var4;
if (this.needhandneck == 0) {
for(var4 = 0; var4 < dmnew.numheroes; ++var4) {
if (dmnew.hero[var4].weapon.number != this.needitem && (dmnew.hero[var4].hand == null || dmnew.hero[var4].hand.number != this.needitem)) {
if ((this.needitem != 248 || dmnew.hero[var4].weapon.number != 249) && (dmnew.hero[var4].hand == null || dmnew.hero[var4].hand.number != 249)) {
if (dmnew.hero[var4].weapon.number == 215) {
var3 = true;
}
} else {
var3 = true;
}
} else {
var3 = true;
}
}
} else {
for(var4 = 0; var4 < dmnew.numheroes; ++var4) {
if (dmnew.hero[var4].neck != null && dmnew.hero[var4].neck.number == this.needitem) {
var3 = true;
}
}
if (!var3) {
for(int var5 = 0; var5 < dmnew.numheroes; ++var5) {
if (dmnew.hero[var5].weapon.number == 215) {
var3 = true;
}
}
}
}
if (!var3) {
if (var2 != 2 && var2 != 3) {
dmnew.message.setMessage(this.name + " is unaffected.", 4);
}
return 0;
}
}
if (this.hurtitem != 0 && var2 != 0 && var2 != 4 && var2 != 6 && var2 != 5) {
if (var2 != 2 && var2 != 3) {
dmnew.message.setMessage(this.name + " is unaffected.", 4);
}
return 0;
} else {
if (var2 != 0 && var2 != 5 && var2 != 4) {
if (var2 == 1 || var2 == 7) {
var1 -= var1 * this.magicresist / 100;
}
} else {
var1 -= var1 * this.defense / 100;
}
if (var1 < 1) {
var1 = dmnew.randGen.nextInt(4) + 1;
}
if (var2 == 7 && (this.isImmaterial || this.number == 8 || this.number == 21)) {
this.health += var1;
dmnew.message.setMessage(this.name + " gains some life.", 5);
return 0 - var1;
} else {
this.health -= var1;
this.xdist = this.x - dmnew.partyx;
if (this.xdist < 0) {
this.xdist *= -1;
}
this.ydist = this.y - dmnew.partyy;
if (this.ydist < 0) {
this.ydist *= -1;
}
if (this.xdist < 5 && this.ydist < 5 && var2 != 2 && var2 != 3 && var2 != 6) {
dmnew.message.setMessage(this.name + " takes " + var1 + " damage.", 5);
}
Iterator var9;
if (this.health < 1) {
this.isdying = true;
if (this.gamewin) {
dmnew.nomovement = true;
this.isdying = false;
if (var2 == 6) {
dmnew.endanim = "fuseend.gif";
dmnew.endsound = "fuseend.wav";
} else {
dmnew.endanim = this.endanim;
dmnew.endsound = this.endsound;
}
dmnew.gameover = true;
return var1;
}
if (!this.carrying.isEmpty()) {
dmnew.DungeonMap[this.level][this.x][this.y].tryFloorSwitch(2);
}
var3 = false;
var9 = this.carrying.iterator();
while(var9.hasNext()) {
Item var8 = (Item)var9.next();
if (var8.type != 0 || var8.weight > 4.0F) {
var3 = true;
}
if (this.subsquare != 5) {
var8.subsquare = this.subsquare;
} else {
var8.subsquare = dmnew.randGen.nextInt(4);
}
if (!dmnew.DungeonMap[this.level][this.x][this.y].tryTeleport(var8)) {
dmnew.DungeonMap[this.level][this.x][this.y].addItem(var8);
}
}
if (!this.carrying.isEmpty() && this.level == dmnew.level) {
if (var3) {
dmnew.playSound("thunk.wav", this.x, this.y);
} else {
dmnew.playSound("dink.wav", this.x, this.y);
}
}
if (this.level == dmnew.level && this.xdist < 5 && this.ydist < 5) {
dmnew.needredraw = true;
} else {
dmnew.dmmons.remove(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
boolean var6 = false;
if (this.subsquare != 5) {
for(int var7 = 0; var7 < 3; ++var7) {
if (dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + var7) != null) {
var6 = true;
}
}
}
dmnew.DungeonMap[this.level][this.x][this.y].hasMons = var6;
}
if (!this.isflying && !this.isImmaterial) {
dmnew.DungeonMap[this.level][this.x][this.y].tryFloorSwitch(5);
}
} else if (var2 != 3 || this.currentai == 3 || this.isImmaterial || !dmnew.randGen.nextBoolean() || this.health >= 80 && dmnew.randGen.nextInt(20) != 0) {
if (this.fearresist > 0 && this.currentai != 3 && !this.isImmaterial && this.health < 600 && dmnew.DungeonMap[this.level][this.x][this.y].hasCloud && dmnew.randGen.nextBoolean()) {
var3 = false;
if (dmnew.randGen.nextInt(10) < this.fearresist || this.fearresist > 0 && this.health < 40 && this.maxhealth < 400 && dmnew.randGen.nextBoolean()) {
var9 = dmnew.cloudstochange.iterator();
while(var9.hasNext()) {
dmnew.PoisonCloud var10 = (dmnew.PoisonCloud)var9.next();
if (var10.x == this.x && var10.y == this.y) {
if (this.health < var10.stage * 100) {
var3 = true;
}
break;
}
}
}
if (var3) {
this.runcounter = 2;
this.currentai = 3;
}
}
} else {
this.runcounter = 2;
this.currentai = 3;
}
return var1;
}
}
}
}
public void pitDeath() {
if (!this.carrying.isEmpty()) {
dmnew.DungeonMap[this.level][this.x][this.y].tryFloorSwitch(2);
}
boolean var1 = false;
Iterator var3 = this.carrying.iterator();
while(var3.hasNext()) {
Item var2 = (Item)var3.next();
if (var2.type != 0 || var2.weight > 4.0F) {
var1 = true;
}
var2.subsquare = this.subsquare;
if (!dmnew.DungeonMap[this.level][this.x][this.y].tryTeleport(var2)) {
dmnew.DungeonMap[this.level][this.x][this.y].addItem(var2);
}
}
if (!this.carrying.isEmpty() && this.level == dmnew.level) {
if (var1) {
dmnew.playSound("thunk.wav", this.x, this.y);
} else {
dmnew.playSound("dink.wav", this.x, this.y);
}
}
if (this.level == dmnew.level && this.xdist < 5 && this.ydist < 5) {
dmnew.needredraw = true;
}
if (this.gamewin) {
dmnew.nomovement = true;
dmnew.endanim = this.endanim;
dmnew.endsound = this.endsound;
dmnew.gameover = true;
}
}
}
class Projectile {
Item it;
Spell sp;
Image pic;
int pow;
int dist;
int direction;
int level;
int x;
int y;
int subsquare;
int powcount;
int powdrain;
boolean justthrown;
boolean needsfirstdraw;
boolean isending;
boolean notelnext;
boolean hitsImmaterial;
boolean passgrate;
public Projectile(Item var2, int var3, int var4, int var5, int var6, int var7, int var8, boolean var9, boolean var10) {
this.it = null;
this.sp = null;
this.justthrown = true;
this.needsfirstdraw = true;
this.isending = false;
this.notelnext = false;
this.hitsImmaterial = false;
this.passgrate = false;
this.it = var2;
this.level = var3;
this.x = var4;
this.y = var5;
this.dist = var6;
this.direction = var7;
this.subsquare = var8;
this.justthrown = var9;
this.notelnext = var10;
this.pow = this.it.throwpow + this.it.shotpow;
if (this.it.hasthrowpic) {
byte var11 = 2;
if (dmnew.facing == this.direction) {
var11 = 0;
} else if ((dmnew.facing - this.direction) % 2 == 0) {
var11 = 1;
} else if (dmnew.facing == (this.direction + 1) % 4) {
var11 = 3;
}
this.pic = this.it.throwpic[var11];
} else {
this.pic = this.it.dpic;
}
if (this.it.hitsImmaterial) {
this.hitsImmaterial = true;
}
if (this.it.size == 0 || this.it.size == 2) {
this.passgrate = true;
}
}
public Projectile(Spell var2, int var3, int var4, int var5, int var6, int var7, int var8, int var9, int var10, boolean var11, boolean var12) {
this.it = null;
this.sp = null;
this.justthrown = true;
this.needsfirstdraw = true;
this.isending = false;
this.notelnext = false;
this.hitsImmaterial = false;
this.passgrate = false;
this.sp = var2;
this.level = var3;
this.x = var4;
this.y = var5;
this.dist = var6;
this.direction = var7;
this.subsquare = var8;
this.powdrain = var9;
this.powcount = var10;
this.justthrown = var11;
this.notelnext = var12;
this.pow = this.sp.power;
this.pic = this.sp.pic;
if (this.sp.hitsImmaterial) {
this.hitsImmaterial = true;
}
if (this.sp.number == 51 || this.sp.number == 52 || this.sp.number == 335 || this.sp.number == 31) {
this.passgrate = true;
}
}
public Projectile(Item var2, int var3, int var4, int var5) {
this((Item)var2, dmnew.level, dmnew.partyx, dmnew.partyy, var3, var4, var5);
}
public Projectile(Item var2, int var3, int var4, int var5, int var6, int var7) {
this((Item)var2, dmnew.level, var3, var4, var5, var6, var7);
}
public Projectile(Item var2, int var3, int var4, int var5, int var6, int var7, int var8) {
this.it = null;
this.sp = null;
this.justthrown = true;
this.needsfirstdraw = true;
this.isending = false;
this.notelnext = false;
this.hitsImmaterial = false;
this.passgrate = false;
this.it = var2;
this.pow = this.it.throwpow + this.it.shotpow;
this.dist = var6;
this.direction = var7;
this.subsquare = (var8 - dmnew.facing + 4) % 4;
if (this.it.hasthrowpic) {
byte var9 = 2;
if (dmnew.facing == this.direction) {
var9 = 0;
} else if ((dmnew.facing - this.direction) % 2 == 0) {
var9 = 1;
} else if (dmnew.facing == (this.direction + 1) % 4) {
var9 = 3;
}
this.pic = this.it.throwpic[var9];
} else {
this.pic = this.it.dpic;
}
this.level = var3;
this.x = var4;
this.y = var5;
dmnew.dmprojs.add(this);
++dmnew.DungeonMap[this.level][var4][var5].numProjs;
if (this.it.hitsImmaterial) {
this.hitsImmaterial = true;
}
if (this.it.size == 0 || this.it.size == 2) {
this.passgrate = true;
}
}
public Projectile(Spell var2, int var3, int var4, int var5) {
this((Spell)var2, dmnew.level, dmnew.partyx, dmnew.partyy, var3, var4, var5);
}
public Projectile(Spell var2, int var3, int var4, int var5, int var6, int var7) {
this((Spell)var2, dmnew.level, var3, var4, var5, var6, var7);
}
public Projectile(Spell var2, int var3, int var4, int var5, int var6, int var7, int var8) {
this.it = null;
this.sp = null;
this.justthrown = true;
this.needsfirstdraw = true;
this.isending = false;
this.notelnext = false;
this.hitsImmaterial = false;
this.passgrate = false;
this.sp = var2;
this.pic = this.sp.pic;
this.pow = this.sp.power;
this.dist = var6;
this.direction = var7;
this.level = var3;
this.x = var4;
this.y = var5;
this.powcount = 0;
this.powdrain = this.dist / this.sp.gain + 1;
this.subsquare = (var8 - dmnew.facing + 4) % 4;
dmnew.dmprojs.add(this);
++dmnew.DungeonMap[this.level][var4][var5].numProjs;
if (this.sp.hitsImmaterial) {
this.hitsImmaterial = true;
}
if (this.sp.number == 51 || this.sp.number == 52 || this.sp.number == 335 || this.sp.number == 31) {
this.passgrate = true;
}
}
public void update() {
if (this.dist == 99) {
this.dist = 100;
} else if (this.sp != null && this.sp.type != 0) {
++this.powcount;
}
boolean var1 = true;
byte var2;
int var3;
int var4;
int var5;
if (this.sp != null && this.sp.number == 642) {
var5 = this.direction;
ArrayList var6 = new ArrayList(4);
for(int var7 = 0; var7 < 4; ++var7) {
if (var7 != this.direction) {
var6.add("" + var7);
}
}
do {
do {
do {
do {
do {
var3 = this.x;
var4 = this.y;
this.direction = var5;
if (this.direction != 0 && this.direction != 2) {
if (this.subsquare == 0) {
var2 = 1;
} else if (this.subsquare == 1) {
var2 = 0;
} else if (this.subsquare == 2) {
var2 = 3;
} else {
var2 = 2;
}
if (this.direction == 3 && (var2 == 0 || var2 == 3)) {
++var3;
} else if (this.direction == 1 && (var2 == 1 || var2 == 2)) {
--var3;
}
if (dmnew.randGen.nextBoolean()) {
if (var6.contains("0") && this.y > 0 && !(dmnew.DungeonMap[this.level][this.x][this.y - 1] instanceof Wall) && dmnew.DungeonMap[this.level][this.x][this.y - 1].mapchar != '2') {
var5 = 0;
var6.remove("0");
} else if (var6.contains("2")) {
var5 = 2;
var6.remove("2");
} else {
var5 = (this.direction + 2) % 4;
var6.remove(0);
}
} else if (var6.contains("2") && this.y < dmnew.mapheight - 1 && !(dmnew.DungeonMap[this.level][this.x][this.y + 1] instanceof Wall) && dmnew.DungeonMap[this.level][this.x][this.y + 1].mapchar != '2') {
var5 = 2;
var6.remove("2");
} else if (var6.contains("0")) {
var5 = 0;
var6.remove("0");
} else {
var5 = (this.direction + 2) % 4;
var6.remove(0);
}
} else {
if (this.subsquare == 0) {
var2 = 3;
} else if (this.subsquare == 3) {
var2 = 0;
} else if (this.subsquare == 1) {
var2 = 2;
} else {
var2 = 1;
}
if (this.direction == 0 && (var2 == 3 || var2 == 2)) {
--var4;
} else if (this.direction == 2 && (var2 == 0 || var2 == 1)) {
++var4;
}
if (dmnew.randGen.nextBoolean()) {
if (var6.contains("1") && this.x > 0 && !(dmnew.DungeonMap[this.level][this.x - 1][this.y] instanceof Wall) && dmnew.DungeonMap[this.level][this.x - 1][this.y].mapchar != '2') {
var5 = 1;
var6.remove("1");
} else if (var6.contains("3")) {
var5 = 3;
var6.remove("3");
} else {
var5 = 2 - this.direction;
var6.remove(0);
}
} else if (var6.contains("3") && this.x < dmnew.mapwidth - 1 && !(dmnew.DungeonMap[this.level][this.x + 1][this.y] instanceof Wall) && dmnew.DungeonMap[this.level][this.x + 1][this.y].mapchar != '2') {
var5 = 3;
var6.remove("3");
} else if (var6.contains("1")) {
var5 = 1;
var6.remove("1");
} else {
var5 = 2 - this.direction;
var6.remove(0);
}
}
} while(var3 < 0 && this.direction == 1);
} while(var4 < 0 && this.direction == 0);
} while(var3 == dmnew.mapwidth && this.direction == 3);
} while(var4 == dmnew.mapheight && this.direction == 2);
} while(dmnew.DungeonMap[this.level][var3][var4] instanceof Wall && dmnew.DungeonMap[this.level][var3][var4].mapchar != '2' && !var6.isEmpty());
} else {
var3 = this.x;
var4 = this.y;
if (this.direction != 0 && this.direction != 2) {
if (this.subsquare == 0) {
var2 = 1;
} else if (this.subsquare == 1) {
var2 = 0;
} else if (this.subsquare == 2) {
var2 = 3;
} else {
var2 = 2;
}
if (this.direction == 3 && (var2 == 0 || var2 == 3)) {
++var3;
} else if (this.direction == 1 && (var2 == 1 || var2 == 2)) {
--var3;
}
} else {
if (this.subsquare == 0) {
var2 = 3;
} else if (this.subsquare == 3) {
var2 = 0;
} else if (this.subsquare == 1) {
var2 = 2;
} else {
var2 = 1;
}
if (this.direction == 0 && (var2 == 3 || var2 == 2)) {
--var4;
} else if (this.direction == 2 && (var2 == 0 || var2 == 1)) {
++var4;
}
}
}
if (this.dist != 0 && var3 >= 0 && var4 >= 0 && var3 != dmnew.mapwidth && var4 != dmnew.mapheight) {
if (dmnew.DungeonMap[this.level][var3][var4].canPassProjs || dmnew.DungeonMap[this.level][var3][var4].mapchar == 'd' || dmnew.DungeonMap[this.level][var3][var4].mapchar == '>' && ((Stairs)dmnew.DungeonMap[this.level][var3][var4]).side == this.direction) {
if (!this.justthrown && dmnew.DungeonMap[this.level][this.x][this.y].mapchar == '>') {
var1 = false;
} else if (!this.justthrown && this.level == dmnew.level && this.x == dmnew.partyx && this.y == dmnew.partyy && !dmnew.alldead && dmnew.heroatsub[(this.subsquare + dmnew.facing) % 4] != -1) {
var1 = false;
} else if (dmnew.DungeonMap[this.level][this.x][this.y].mapchar != 'd' || ((Door)dmnew.DungeonMap[this.level][this.x][this.y]).changecount <= 1 || this.passgrate && ((Door)dmnew.DungeonMap[this.level][this.x][this.y]).pictype == 1) {
if (!this.justthrown && dmnew.DungeonMap[this.level][this.x][this.y].hasMons) {
dmnew.Monster var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
if (var9 == null) {
var9 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 5);
}
if (var9 != null && !var9.isdying && (this.hitsImmaterial || !var9.isImmaterial)) {
var1 = false;
}
}
} else {
var1 = false;
}
} else {
var1 = false;
}
} else {
var1 = false;
}
if (var1) {
--dmnew.DungeonMap[this.level][this.x][this.y].numProjs;
--this.dist;
if (this.powcount > this.powdrain) {
this.powcount = 0;
--this.sp.gain;
this.sp.power = this.sp.powers[this.sp.gain - 1];
}
this.x = var3;
this.y = var4;
this.subsquare = var2;
++dmnew.DungeonMap[this.level][this.x][this.y].numProjs;
int var8;
if (this.level == dmnew.level) {
var5 = dmnew.partyx - this.x;
if (var5 < 0) {
var5 *= -1;
}
var8 = dmnew.partyy - this.y;
if (var8 < 0) {
var8 *= -1;
}
if (var5 < 5 && var8 < 5) {
dmnew.needredraw = true;
}
}
if (!this.notelnext) {
dmnew.DungeonMap[this.level][this.x][this.y].tryTeleport(this);
if (this.level == dmnew.level) {
var5 = dmnew.partyx - this.x;
if (var5 < 0) {
var5 *= -1;
}
var8 = dmnew.partyy - this.y;
if (var8 < 0) {
var8 *= -1;
}
if (var5 < 5 && var8 < 5) {
dmnew.needredraw = true;
}
}
} else {
this.notelnext = false;
}
} else {
this.projend();
}
this.justthrown = false;
}
public void projend() {
dmnew.Hero var10000;
int var5;
if (this.it != null) {
this.isending = true;
boolean var1 = true;
if (!this.justthrown && dmnew.DungeonMap[this.level][this.x][this.y].hasParty) {
var5 = dmnew.heroatsub[(this.subsquare + dmnew.facing) % 4];
if (var5 != -1) {
dmnew.playSound("oof.wav", -1, -1);
dmnew.hero[var5].damage(this.pow, 5);
if (this.it.poisonous > 0 && dmnew.randGen.nextBoolean()) {
var10000 = dmnew.hero[var5];
var10000.poison += this.it.poisonous;
dmnew.hero[var5].ispoisoned = true;
}
}
} else if (!this.justthrown && dmnew.DungeonMap[this.level][this.x][this.y].hasMons) {
dmnew.Monster var2 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
if (var2 == null) {
var2 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 5);
}
if (var2 != null && (this.hitsImmaterial || !var2.isImmaterial) && (var2.hurtitem == 0 || this.it.number == 215 || this.it.number == var2.hurtitem)) {
var2.damage(this.pow, 5);
if (!var2.isImmaterial && this.it.poisonous > 0 && dmnew.randGen.nextBoolean()) {
var2.poisonpow += this.it.poisonous;
var2.ispoisoned = true;
}
if (!var2.isImmaterial && !var2.isdying && var2.defense < 80 && this.it.projtype > 0 && this.it.number != 266 && dmnew.randGen.nextInt(10) == 0) {
this.it.shotpow = 0;
var2.carrying.add(this.it);
var1 = false;
}
}
}
if (var1) {
if ((double)this.it.weight > 4.0D) {
dmnew.playSound("thunk.wav", this.x, this.y);
} else if (this.it.type == 0) {
dmnew.playSound("dink.wav", this.x, this.y);
}
this.it.shotpow = 0;
this.it.subsquare = this.subsquare;
dmnew.DungeonMap[this.level][this.x][this.y].tryFloorSwitch(2);
if (!dmnew.DungeonMap[this.level][this.x][this.y].tryTeleport(this.it)) {
dmnew.DungeonMap[this.level][this.x][this.y].addItem(this.it);
}
}
--dmnew.DungeonMap[this.level][this.x][this.y].numProjs;
if (this.level == dmnew.level) {
var5 = dmnew.partyx - this.x;
if (var5 < 0) {
var5 *= -1;
}
int var3 = dmnew.partyy - this.y;
if (var3 < 0) {
var3 *= -1;
}
if (var5 < 5 && var3 < 5) {
dmnew.needredraw = true;
}
}
} else {
this.isending = true;
if (this.level == dmnew.level) {
if (this.sp.number != 44 && this.sp.number != 46 && this.sp.number != 335 && this.sp.number != 642 && this.sp.number != 365) {
dmnew.playSound("zap.wav", this.x, this.y);
} else {
dmnew.playSound("fball.wav", this.x, this.y);
}
}
int var7;
if (!this.hitsImmaterial && dmnew.DungeonMap[this.level][this.x][this.y].hasParty) {
if (!this.sp.ismultiple) {
if (!this.justthrown && this.sp.number != 6) {
var7 = dmnew.heroatsub[(this.subsquare + dmnew.facing) % 4];
if (var7 != -1) {
if (this.sp.number == 51) {
var10000 = dmnew.hero[var7];
var10000.poison += this.sp.gain * 2 + 1;
dmnew.hero[var7].ispoisoned = true;
dmnew.hero[var7].damage(this.pow, 1);
} else if (this.sp.number == 461) {
if (dmnew.hero[var7].strengthboost > -this.sp.power) {
var10000 = dmnew.hero[var7];
var10000.strength -= dmnew.hero[var7].strengthboost;
var10000 = dmnew.hero[var7];
var10000.strengthboost -= this.sp.power;
if (dmnew.hero[var7].strengthboost < -this.sp.power) {
dmnew.hero[var7].strengthboost = -this.sp.power;
}
if (dmnew.hero[var7].strength + dmnew.hero[var7].strengthboost <= 0) {
dmnew.hero[var7].strengthboost = 1 - dmnew.hero[var7].strength;
}
var10000 = dmnew.hero[var7];
var10000.strength += dmnew.hero[var7].strengthboost;
dmnew.hero[var7].setMaxLoad();
}
if (dmnew.hero[var7].vitalityboost > -this.sp.power) {
var10000 = dmnew.hero[var7];
var10000.vitality -= dmnew.hero[var7].vitalityboost;
var10000 = dmnew.hero[var7];
var10000.vitalityboost -= this.sp.power;
if (dmnew.hero[var7].vitalityboost < -this.sp.power) {
dmnew.hero[var7].vitalityboost = -this.sp.power;
}
if (dmnew.hero[var7].vitality + dmnew.hero[var7].vitalityboost <= 0) {
dmnew.hero[var7].vitalityboost = 1 - dmnew.hero[var7].vitality;
}
var10000 = dmnew.hero[var7];
var10000.vitality += dmnew.hero[var7].vitalityboost;
}
dmnew.hero[var7].damage(1, 1);
} else if (this.sp.number == 363) {
if (dmnew.hero[var7].intelligenceboost > -this.sp.power) {
var10000 = dmnew.hero[var7];
var10000.intelligence -= dmnew.hero[var7].intelligenceboost;
var10000 = dmnew.hero[var7];
var10000.intelligenceboost -= this.sp.power;
if (dmnew.hero[var7].intelligenceboost < -this.sp.power) {
dmnew.hero[var7].intelligenceboost = -this.sp.power;
}
if (dmnew.hero[var7].intelligence + dmnew.hero[var7].intelligenceboost <= 0) {
dmnew.hero[var7].intelligenceboost = 1 - dmnew.hero[var7].intelligence;
}
var10000 = dmnew.hero[var7];
var10000.intelligence += dmnew.hero[var7].intelligenceboost;
}
if (dmnew.hero[var7].wisdomboost > -this.sp.power) {
var10000 = dmnew.hero[var7];
var10000.wisdom -= dmnew.hero[var7].wisdomboost;
var10000 = dmnew.hero[var7];
var10000.wisdomboost -= this.sp.power;
if (dmnew.hero[var7].wisdomboost < -this.sp.power) {
dmnew.hero[var7].wisdomboost = -this.sp.power;
}
if (dmnew.hero[var7].wisdom + dmnew.hero[var7].wisdomboost <= 0) {
dmnew.hero[var7].wisdomboost = 1 - dmnew.hero[var7].wisdom;
}
var10000 = dmnew.hero[var7];
var10000.wisdom += dmnew.hero[var7].wisdomboost;
}
dmnew.hero[var7].damage(1, 1);
} else if (this.sp.number == 664) {
if (dmnew.hero[var7].defenseboost > -this.sp.power) {
var10000 = dmnew.hero[var7];
var10000.defense -= dmnew.hero[var7].defenseboost;
var10000 = dmnew.hero[var7];
var10000.defenseboost -= this.sp.power;
if (dmnew.hero[var7].defenseboost < -this.sp.power) {
dmnew.hero[var7].defenseboost = -this.sp.power;
}
var10000 = dmnew.hero[var7];
var10000.defense += dmnew.hero[var7].defenseboost;
}
if (dmnew.hero[var7].magicresistboost > -this.sp.power) {
var10000 = dmnew.hero[var7];
var10000.magicresist -= dmnew.hero[var7].magicresistboost;
var10000 = dmnew.hero[var7];
var10000.magicresistboost -= this.sp.power;
if (dmnew.hero[var7].magicresistboost < -this.sp.power) {
dmnew.hero[var7].magicresistboost = -this.sp.power;
}
var10000 = dmnew.hero[var7];
var10000.magicresist += dmnew.hero[var7].magicresistboost;
}
dmnew.hero[var7].damage(1, 1);
} else {
dmnew.hero[var7].damage(this.pow, 1);
}
}
}
} else {
if (this.sp.number == 362) {
dmnew.slowcount += this.sp.power * 3;
dmnew.message.setMessage("Party Slowed.", 4);
}
for(var7 = 0; var7 < dmnew.numheroes; ++var7) {
if (this.sp.number == 362) {
if (dmnew.hero[var7].dexterityboost > -this.sp.power) {
var10000 = dmnew.hero[var7];
var10000.dexterity -= dmnew.hero[var7].dexterityboost;
var10000 = dmnew.hero[var7];
var10000.dexterityboost -= this.sp.power;
if (dmnew.hero[var7].dexterityboost < -this.sp.power) {
dmnew.hero[var7].dexterityboost = -this.sp.power;
}
if (dmnew.hero[var7].dexterity + dmnew.hero[var7].dexterityboost <= 0) {
dmnew.hero[var7].dexterityboost = 1 - dmnew.hero[var7].dexterity;
}
var10000 = dmnew.hero[var7];
var10000.dexterity += dmnew.hero[var7].dexterityboost;
}
dmnew.hero[var7].damage(1, 1);
} else if (this.sp.number != 523) {
if (this.sp.number == 44 && dmnew.hero[var7].weapon.number == 244 && dmnew.hero[var7].weapon.functions == 1) {
dmnew.hero[var7].weapon.charges[1] = 1;
dmnew.hero[var7].weapon.power[1] = this.sp.gain;
dmnew.hero[var7].weapon.functions = 2;
dmnew.this.weaponsheet.update();
dmnew.hero[var7].repaint();
} else if (var7 == dmnew.heroatsub[(this.subsquare + dmnew.facing) % 4]) {
dmnew.hero[var7].damage(this.pow, 1);
} else {
dmnew.hero[var7].damage(this.pow * 2 / 3, 1);
}
} else {
if (dmnew.hero[var7].silencecount < this.sp.power) {
var5 = (dmnew.hero[var7].intelligence + dmnew.hero[var7].wisdom) / 2;
if (dmnew.randGen.nextInt(this.sp.gain * 20) + 30 > var5 || var5 >= 100 && dmnew.randGen.nextInt(5) == 0) {
if (!dmnew.hero[var7].silenced) {
dmnew.message.setMessage(dmnew.hero[var7].name + " is silenced!", var7);
}
dmnew.hero[var7].silenced = true;
var10000 = dmnew.hero[var7];
var10000.silencecount += this.sp.power;
if (dmnew.hero[var7].silencecount > this.sp.power) {
dmnew.hero[var7].silencecount = this.sp.power;
}
}
}
dmnew.hero[var7].damage(1, 1);
}
}
}
} else if (!dmnew.DungeonMap[this.level][this.x][this.y].hasMons) {
if (this.sp.number == 6 && dmnew.DungeonMap[this.level][this.x][this.y] instanceof Door) {
Door var6 = (Door)dmnew.DungeonMap[this.level][this.x][this.y];
if (var6.opentype == 1) {
var6.activate();
}
} else if ((this.sp.number == 44 || this.sp.number == 46) && dmnew.DungeonMap[this.level][this.x][this.y] instanceof Door) {
((Door)dmnew.DungeonMap[this.level][this.x][this.y]).breakDoor(this.pow, false, false);
}
} else {
dmnew.Monster var4;
if (this.sp.ismultiple) {
var5 = 0;
while(var5 < 6) {
var4 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + var5);
if (var4 != null && this.hitsImmaterial == var4.isImmaterial) {
if (this.sp.number == 362) {
if (var4.speedboost > -this.sp.power) {
var4.speed -= var4.speedboost;
var4.speedboost -= this.sp.power;
if (var4.speedboost < -this.sp.power) {
var4.speedboost = -this.sp.power;
}
if (var4.speed + var4.speedboost <= 0) {
var4.speedboost = 1 - var4.speed;
}
var4.speed += var4.speedboost;
}
var4.movespeed -= var4.movespeedboost;
var4.movespeedboost += this.sp.gain * 3;
if (var4.movespeedboost > this.sp.gain * 3) {
var4.movespeedboost = this.sp.gain * 3;
}
var4.movespeed += var4.movespeedboost;
} else if (this.sp.number == 523) {
if (var4.number != 26 && var4.hasmagic && var4.silencecount < this.sp.power && (dmnew.randGen.nextInt(this.sp.gain * 20) + 30 > var4.manapower || var4.manapower >= 100 && dmnew.randGen.nextInt(5) == 0)) {
var4.silenced = true;
var4.silencecount += this.sp.power;
if (var4.silencecount > this.sp.power) {
var4.silencecount = this.sp.power;
}
}
} else if (var5 != this.subsquare && var5 != 5) {
var4.damage(this.pow * 2 / 3, 1);
} else {
var4.damage(this.pow, 1);
}
}
if (var5 == 3) {
var5 = 5;
} else {
++var5;
}
}
} else if (!this.justthrown && this.sp.number != 6) {
var4 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + this.subsquare);
if (var4 == null) {
var4 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 5);
}
if (var4 != null && (this.hitsImmaterial == var4.isImmaterial || this.sp.number == 0 && var4.number == 26)) {
if (this.sp.number == 51 && !var4.isImmaterial && var4.number != 26) {
var4.damage(this.pow, 1);
var4.poisonpow += this.sp.gain * 2 + 1;
var4.ispoisoned = true;
} else if (this.sp.number == 0 && var4.number == 26) {
boolean var8 = true;
if (dmnew.DungeonMap[this.level][var4.x][var4.y].mapchar == 'F' && ((FDecoration)dmnew.DungeonMap[this.level][var4.x][var4.y]).number == 2) {
if (dmnew.fluxcages.get(this.level + "," + var4.x + "," + var4.y) == null) {
var8 = false;
} else if ((!(dmnew.DungeonMap[this.level][var4.x][var4.y - 1] instanceof Wall) || dmnew.DungeonMap[this.level][var4.x][var4.y - 1].mapchar == '2') && (dmnew.partyx != var4.x || dmnew.partyy != var4.y - 1) && dmnew.fluxcages.get(this.level + "," + var4.x + "," + (var4.y - 1)) == null) {
var8 = false;
} else if ((!(dmnew.DungeonMap[this.level][var4.x][var4.y + 1] instanceof Wall) || dmnew.DungeonMap[this.level][var4.x][var4.y + 1].mapchar == '2') && (dmnew.partyx != var4.x || dmnew.partyy != var4.y + 1) && dmnew.fluxcages.get(this.level + "," + var4.x + "," + (var4.y + 1)) == null) {
var8 = false;
} else if ((!(dmnew.DungeonMap[this.level][var4.x - 1][var4.y] instanceof Wall) || dmnew.DungeonMap[this.level][var4.x - 1][var4.y].mapchar == '2') && (dmnew.partyx != var4.x - 1 || dmnew.partyy != var4.y) && dmnew.fluxcages.get(this.level + "," + (var4.x - 1) + "," + var4.y) == null) {
var8 = false;
} else if ((!(dmnew.DungeonMap[this.level][var4.x + 1][var4.y] instanceof Wall) || dmnew.DungeonMap[this.level][var4.x + 1][var4.y].mapchar == '2') && (dmnew.partyx != var4.x + 1 || dmnew.partyy != var4.y) && dmnew.fluxcages.get(this.level + "," + (var4.x + 1) + "," + var4.y) == null) {
var8 = false;
}
} else {
var8 = false;
}
if (var8) {
var4.damage(var4.maxhealth, 6);
} else {
var4.teleport();
}
} else if (this.sp.number == 461) {
if (var4.powerboost > -this.sp.power) {
var4.power -= var4.powerboost;
var4.powerboost -= this.sp.power;
if (var4.powerboost < -this.sp.power) {
var4.powerboost = -this.sp.power;
}
if (var4.power + var4.powerboost <= 0) {
var4.powerboost = 1 - var4.power;
}
var4.power += var4.powerboost;
}
} else if (this.sp.number == 363) {
if (var4.manapowerboost > -this.sp.power) {
var4.manapower -= var4.manapowerboost;
var4.manapowerboost -= this.sp.power;
if (var4.manapowerboost < -this.sp.power) {
var4.manapowerboost = -this.sp.power;
}
if (var4.manapower + var4.manapowerboost <= 0) {
var4.manapowerboost = 1 - var4.manapower;
}
var4.manapower += var4.manapowerboost;
}
} else if (this.sp.number == 664) {
if (var4.defenseboost > -this.sp.power) {
var4.defense -= var4.defenseboost;
var4.defenseboost -= this.sp.power;
if (var4.defenseboost < -this.sp.power) {
var4.defenseboost = -this.sp.power;
}
var4.defense += var4.defenseboost;
}
if (var4.magicresistboost > -this.sp.power) {
var4.magicresist -= var4.magicresistboost;
var4.magicresistboost -= this.sp.power;
if (var4.magicresistboost < -this.sp.power) {
var4.magicresistboost = -this.sp.power;
}
var4.magicresist += var4.magicresistboost;
}
} else {
var4.damage(this.pow, 1);
}
}
}
}
if (this.sp.number == 31 || this.sp.number == 61) {
dmnew.this.new PoisonCloud(this.level, this.x, this.y, this.sp.gain);
}
if (this.level == dmnew.level) {
var7 = dmnew.partyx - this.x;
if (var7 < 0) {
var7 *= -1;
}
var5 = dmnew.partyy - this.y;
if (var5 < 0) {
var5 *= -1;
}
if (var7 < 5 && var5 < 5) {
dmnew.needredraw = true;
}
}
}
}
}
class Holding extends JComponent {
public Holding() {
this.setPreferredSize(new Dimension(160, 36));
this.setOpaque(false);
}
public void paint(Graphics var1) {
if (dmnew.iteminhand) {
var1.drawImage(dmnew.inhand.pic, 0, 0, (ImageObserver)null);
var1.setFont(new Font("TimesRoman", 1, 14));
var1.setColor(Color.black);
var1.drawString(dmnew.inhand.name, 39, 28);
var1.setColor(Color.yellow);
var1.drawString(dmnew.inhand.name, 37, 25);
}
}
}
class Message extends JComponent {
Color[] messagecolor = new Color[4];
String[] currentmessage = new String[]{" ", " ", " ", "Welcome"};
int index = 0;
int timecounter = 0;
Color[] colors = new Color[6];
public Message() {
this.setPreferredSize(new Dimension(662, 70));
this.setOpaque(false);
this.colors[0] = Color.green;
this.colors[1] = Color.yellow;
this.colors[2] = Color.red;
this.colors[3] = Color.blue;
this.colors[4] = Color.white;
this.colors[5] = Color.red;
this.messagecolor[3] = Color.white;
}
public void setMessage(String var1, int var2) {
this.currentmessage[0] = this.currentmessage[1];
this.currentmessage[1] = this.currentmessage[2];
this.currentmessage[2] = this.currentmessage[3];
this.currentmessage[3] = var1;
this.messagecolor[0] = this.messagecolor[1];
this.messagecolor[1] = this.messagecolor[2];
this.messagecolor[2] = this.messagecolor[3];
this.messagecolor[3] = this.colors[var2];
this.repaint();
}
public void clear() {
this.currentmessage[0] = " ";
this.currentmessage[1] = " ";
this.currentmessage[2] = " ";
this.currentmessage[3] = " ";
this.repaint();
}
public void timePass() {
if (!this.currentmessage[3].equals(" ")) {
++this.timecounter;
if (this.timecounter > 150) {
int var1;
for(var1 = 0; this.currentmessage[var1].equals(" "); ++var1) {
}
this.currentmessage[var1] = " ";
this.timecounter = 0;
}
this.repaint();
}
}
public void paint(Graphics var1) {
var1.setFont(new Font("TimesRoman", 1, 12));
var1.setColor(Color.black);
var1.drawString(this.currentmessage[0], 2, 18);
var1.drawString(this.currentmessage[1], 2, 34);
var1.drawString(this.currentmessage[2], 2, 50);
var1.drawString(this.currentmessage[3], 2, 66);
var1.setColor(this.messagecolor[0]);
var1.drawString(this.currentmessage[0], 0, 16);
var1.setColor(this.messagecolor[1]);
var1.drawString(this.currentmessage[1], 0, 32);
var1.setColor(this.messagecolor[2]);
var1.drawString(this.currentmessage[2], 0, 48);
var1.setColor(this.messagecolor[3]);
var1.drawString(this.currentmessage[3], 0, 64);
}
}
class Formation extends JPanel implements MouseListener {
Cursor cursor;
ImageIcon[] heroicons = new ImageIcon[4];
JLabel[] herolabels = new JLabel[4];
boolean ischanging = false;
int oldindex;
public Formation() {
this.setLayout(new GridLayout(2, 2));
for(int var2 = 0; var2 < 4; ++var2) {
this.heroicons[var2] = new ImageIcon("heroicon" + var2 + ".gif");
this.herolabels[var2] = new JLabel();
if (var2 < dmnew.numheroes) {
this.herolabels[var2].setIcon(this.heroicons[var2]);
}
this.herolabels[var2].setPreferredSize(new Dimension(32, 24));
this.herolabels[var2].setMinimumSize(new Dimension(32, 24));
this.herolabels[var2].setMaximumSize(new Dimension(32, 24));
this.add(this.herolabels[var2]);
}
this.setBackground(Color.black);
this.setBorder(BorderFactory.createBevelBorder(1, new Color(60, 60, 80), new Color(20, 20, 40)));
this.cursor = new Cursor(12);
this.setCursor(this.cursor);
this.addMouseListener(this);
}
public void addNewHero() {
for(int var1 = 0; var1 < 2; ++var1) {
if (dmnew.heroatsub[var1] != -1) {
this.herolabels[var1].setIcon(this.heroicons[dmnew.heroatsub[var1]]);
} else {
this.herolabels[var1].setIcon((Icon)null);
}
}
if (dmnew.heroatsub[2] != -1) {
this.herolabels[3].setIcon(this.heroicons[dmnew.heroatsub[2]]);
} else {
this.herolabels[3].setIcon((Icon)null);
}
if (dmnew.heroatsub[3] != -1) {
this.herolabels[2].setIcon(this.heroicons[dmnew.heroatsub[3]]);
} else {
this.herolabels[2].setIcon((Icon)null);
}
this.repaint();
}
public void mousePressed(MouseEvent var1) {
int var3 = var1.getX();
int var4 = var1.getY();
byte var2;
if (var4 < this.getSize().height / 2) {
if (var3 < this.getSize().width / 2) {
var2 = 0;
} else {
var2 = 1;
}
} else if (var3 < this.getSize().width / 2) {
var2 = 3;
} else {
var2 = 2;
}
if (this.ischanging) {
if (var2 == this.oldindex) {
if (var2 < 2) {
this.herolabels[var2].setIcon(this.heroicons[dmnew.heroatsub[var2]]);
} else if (var2 == 2) {
this.herolabels[3].setIcon(this.heroicons[dmnew.heroatsub[var2]]);
} else {
this.herolabels[2].setIcon(this.heroicons[dmnew.heroatsub[var2]]);
}
} else if (dmnew.heroatsub[var2] != -1) {
if (var2 < 2) {
this.herolabels[var2].setIcon(this.heroicons[dmnew.heroatsub[this.oldindex]]);
} else if (var2 == 2) {
this.herolabels[3].setIcon(this.heroicons[dmnew.heroatsub[this.oldindex]]);
} else {
this.herolabels[2].setIcon(this.heroicons[dmnew.heroatsub[this.oldindex]]);
}
if (this.oldindex < 2) {
this.herolabels[this.oldindex].setIcon(this.heroicons[dmnew.heroatsub[var2]]);
} else if (this.oldindex == 2) {
this.herolabels[3].setIcon(this.heroicons[dmnew.heroatsub[var2]]);
} else {
this.herolabels[2].setIcon(this.heroicons[dmnew.heroatsub[var2]]);
}
int var5 = dmnew.heroatsub[var2];
dmnew.heroatsub[var2] = dmnew.heroatsub[this.oldindex];
dmnew.heroatsub[this.oldindex] = var5;
dmnew.hero[dmnew.heroatsub[var2]].subsquare = var2;
dmnew.hero[dmnew.heroatsub[this.oldindex]].subsquare = this.oldindex;
} else {
if (var2 < 2) {
this.herolabels[var2].setIcon(this.heroicons[dmnew.heroatsub[this.oldindex]]);
} else if (var2 == 2) {
this.herolabels[3].setIcon(this.heroicons[dmnew.heroatsub[this.oldindex]]);
} else {
this.herolabels[2].setIcon(this.heroicons[dmnew.heroatsub[this.oldindex]]);
}
dmnew.heroatsub[var2] = dmnew.heroatsub[this.oldindex];
dmnew.heroatsub[this.oldindex] = -1;
dmnew.hero[dmnew.heroatsub[var2]].subsquare = var2;
}
this.ischanging = false;
this.cursor = new Cursor(12);
this.setCursor(this.cursor);
this.repaint();
} else if (dmnew.heroatsub[var2] != -1) {
this.oldindex = var2;
if (var2 < 2) {
this.herolabels[var2].setIcon((Icon)null);
} else if (var2 == 2) {
this.herolabels[3].setIcon((Icon)null);
} else {
this.herolabels[2].setIcon((Icon)null);
}
this.cursor = dmnew.tk.createCustomCursor(this.heroicons[dmnew.heroatsub[var2]].getImage(), new Point(14, 14), "formc");
this.setCursor(this.cursor);
this.ischanging = true;
this.repaint();
}
}
public void mouseExited(MouseEvent var1) {
if (this.ischanging) {
this.ischanging = false;
if (this.oldindex < 2) {
this.herolabels[this.oldindex].setIcon(this.heroicons[dmnew.heroatsub[this.oldindex]]);
} else if (this.oldindex == 2) {
this.herolabels[3].setIcon(this.heroicons[dmnew.heroatsub[2]]);
} else {
this.herolabels[2].setIcon(this.heroicons[dmnew.heroatsub[3]]);
}
this.cursor = new Cursor(12);
this.setCursor(this.cursor);
this.repaint();
}
}
public void mouseEntered(MouseEvent var1) {
}
public void mouseClicked(MouseEvent var1) {
}
public void mouseReleased(MouseEvent var1) {
}
}
class SpellSheet extends JPanel {
ImageIcon[] spellsymbol = new ImageIcon[24];
ImageIcon casticon;
JButton[] spellButton = new JButton[6];
JButton backButton = new JButton();
JButton toCastButton = new JButton();
JToggleButton[] casterButton = new JToggleButton[4];
dmnew.SpellCasterClick spcastclick;
ButtonGroup casterGroup = new ButtonGroup();
Box uppan;
Box midpan;
Box dwnpan;
BufferedImage castsymbs;
BufferedImage bufsrc;
Graphics2D castg;
public SpellSheet() {
Image var2 = dmnew.tk.createImage("spell.gif");
dmnew.ImageTracker.addImage(var2, 5);
try {
dmnew.ImageTracker.waitForID(5);
} catch (InterruptedException var10) {
}
this.bufsrc = new BufferedImage(var2.getWidth((ImageObserver)null), var2.getHeight((ImageObserver)null), 2);
this.bufsrc.createGraphics().drawImage(var2, 0, 0, (ImageObserver)null);
int var3 = 0;
for(int var4 = 0; var4 < 4; ++var4) {
for(int var5 = 0; var5 < 6; ++var5) {
this.spellsymbol[var3] = new ImageIcon(this.bufsrc.getSubimage(var5 * 12, var4 * 12, 12, 12));
++var3;
}
}
dmnew.SpellClick var11 = dmnew.this.new SpellClick();
dmnew.SpellSymbolClick var6 = dmnew.this.new SpellSymbolClick();
this.spcastclick = dmnew.this.new SpellCasterClick();
CompoundBorder var7 = BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
this.setBorder(var7);
this.setLayout(new GridLayout(3, 1, 0, 0));
this.setPreferredSize(new Dimension(160, 80));
this.setMaximumSize(new Dimension(160, 80));
this.uppan = new Box(0);
this.midpan = new Box(0);
this.dwnpan = new Box(0);
this.uppan.add(Box.createHorizontalGlue());
this.midpan.add(Box.createHorizontalGlue());
this.dwnpan.add(Box.createHorizontalGlue());
for(int var8 = 0; var8 < 4; ++var8) {
this.casterButton[var8] = new JToggleButton();
this.casterButton[var8].setPreferredSize(new Dimension(16, 20));
this.casterButton[var8].setMaximumSize(new Dimension(16, 20));
this.casterButton[var8].setActionCommand("" + var8);
this.casterButton[var8].addActionListener(this.spcastclick);
this.casterGroup.add(this.casterButton[var8]);
this.uppan.add(this.casterButton[var8]);
}
this.casterButton[dmnew.this.spellready].setSelected(true);
this.casterButton[dmnew.this.spellready].setPreferredSize(new Dimension(95, 20));
this.casterButton[dmnew.this.spellready].setMaximumSize(new Dimension(95, 20));
this.casterButton[dmnew.this.spellready].setText(dmnew.hero[dmnew.this.spellready].name);
this.backButton.setIcon(new ImageIcon(this.createImage(new FilteredImageSource(var2.getSource(), new CropImageFilter(0, 48, 17, 14)))));
this.backButton.setPreferredSize(new Dimension(20, 20));
this.backButton.setMaximumSize(new Dimension(20, 20));
this.backButton.setActionCommand("undo");
this.backButton.addActionListener(var11);
this.toCastButton.setPreferredSize(new Dimension(100, 20));
this.toCastButton.setMaximumSize(new Dimension(100, 20));
this.toCastButton.addActionListener(var11);
for(int var9 = 0; var9 < 6; ++var9) {
this.spellButton[var9] = new JButton();
this.spellButton[var9].setPreferredSize(new Dimension(20, 20));
this.spellButton[var9].setMaximumSize(new Dimension(20, 20));
this.spellButton[var9].setActionCommand("" + var9);
this.spellButton[var9].addActionListener(var6);
this.midpan.add(this.spellButton[var9]);
}
this.castsymbs = new BufferedImage(70, 12, 2);
this.castg = this.castsymbs.createGraphics();
this.casticon = new ImageIcon(this.castsymbs);
this.toCastButton.setIcon(this.casticon);
this.dwnpan.add(this.toCastButton);
this.dwnpan.add(this.backButton);
this.uppan.add(Box.createHorizontalGlue());
this.midpan.add(Box.createHorizontalGlue());
this.dwnpan.add(Box.createHorizontalGlue());
this.add(this.uppan);
this.add(this.midpan);
this.add(this.dwnpan);
this.setCursor(new Cursor(12));
}
public void update() {
for(int var1 = 1; var1 < 4; ++var1) {
if (dmnew.numheroes <= var1) {
this.casterButton[var1].setEnabled(false);
}
}
int var2 = dmnew.hero[dmnew.this.spellready].currentspell.length();
for(int var3 = 0; var3 < 6; ++var3) {
if (var2 < 4) {
this.spellButton[var3].setIcon(this.spellsymbol[var3 + 6 * var2]);
} else {
this.spellButton[var3].setIcon(this.spellsymbol[var3]);
}
}
if (var2 > 0) {
this.castg.setColor(new Color(80, 80, 140));
this.castg.fillRect(0, 0, 70, 12);
for(int var4 = 0; var4 < var2; ++var4) {
this.castg.drawImage(this.spellsymbol[Integer.parseInt(dmnew.hero[dmnew.this.spellready].currentspell.substring(var4, var4 + 1)) + var4 * 6 - 1].getImage(), var4 * 15 + 6, 0, (ImageObserver)null);
}
this.casticon.setImage(this.castsymbs);
} else {
this.castsymbs.flush();
this.castsymbs = new BufferedImage(70, 12, 2);
this.castg = this.castsymbs.createGraphics();
this.casticon.setImage(this.castsymbs);
}
((BoxLayout)this.uppan.getLayout()).invalidateLayout(this.uppan);
this.uppan.validate();
this.repaint();
}
}
class WeaponSheet extends JPanel {
JButton[] weaponFunction = new JButton[3];
JToggleButton[] weaponButton = new JToggleButton[4];
ButtonGroup userGroup = new ButtonGroup();
Box uppan;
JPanel dwnpan;
JPanel hitpan;
JLabel hitlabel;
ImageIcon hiticon;
ImageIcon hiticon2;
ImageIcon hiticon3;
ImageIcon missicon;
dmnew.WeaponClick weaponclick = dmnew.this.new WeaponClick();
dmnew.WeaponFunctClick weaponfunctclick = dmnew.this.new WeaponFunctClick();
public WeaponSheet() {
super(true);
CompoundBorder var2 = BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
this.setBorder(var2);
this.setPreferredSize(new Dimension(155, 140));
this.setMaximumSize(new Dimension(155, 140));
this.setMinimumSize(new Dimension(155, 140));
this.setLayout(new BoxLayout(this, 1));
this.uppan = new Box(0);
this.dwnpan = new JPanel();
this.dwnpan.setPreferredSize(new Dimension(120, 62));
this.dwnpan.setMaximumSize(new Dimension(120, 62));
this.dwnpan.setMinimumSize(new Dimension(120, 62));
this.dwnpan.setLayout(new GridLayout(3, 1));
for(int var3 = 0; var3 < 4; ++var3) {
this.weaponButton[var3] = new JToggleButton();
this.weaponButton[var3].setPreferredSize(new Dimension(36, 36));
this.weaponButton[var3].setMaximumSize(new Dimension(36, 36));
this.weaponButton[var3].setMinimumSize(new Dimension(36, 36));
this.weaponButton[var3].setActionCommand("" + var3);
this.weaponButton[var3].addActionListener(this.weaponclick);
this.userGroup.add(this.weaponButton[var3]);
this.uppan.add(this.weaponButton[var3]);
}
this.weaponButton[dmnew.this.weaponready].setSelected(true);
for(int var4 = 0; var4 < 3; ++var4) {
this.weaponFunction[var4] = new JButton();
this.weaponFunction[var4].setPreferredSize(new Dimension(120, 22));
this.weaponFunction[var4].setMaximumSize(new Dimension(120, 22));
this.weaponFunction[var4].setMinimumSize(new Dimension(120, 22));
this.weaponFunction[var4].setActionCommand("" + var4);
this.weaponFunction[var4].addActionListener(this.weaponfunctclick);
this.dwnpan.add(this.weaponFunction[var4]);
}
this.hiticon = new ImageIcon("wephit.gif");
this.hiticon2 = new ImageIcon("wephit2.gif");
this.hiticon3 = new ImageIcon("wephit3.gif");
this.missicon = new ImageIcon("wepmiss.gif");
this.hitlabel = new JLabel(this.hiticon3);
this.hitlabel.setHorizontalTextPosition(0);
this.hitpan = new JPanel();
this.hitpan.add(this.hitlabel);
this.hitpan.setVisible(false);
this.add(this.uppan);
this.add(Box.createVerticalStrut(5));
this.add(this.dwnpan);
this.add(this.hitpan);
this.setCursor(new Cursor(12));
}
public void update() {
for(int var1 = 1; var1 < 4; ++var1) {
if (dmnew.numheroes <= var1) {
this.weaponButton[var1].setIcon((Icon)null);
this.weaponButton[var1].setDisabledIcon((Icon)null);
this.weaponButton[var1].setEnabled(false);
}
}
for(int var2 = 0; var2 < dmnew.numheroes; ++var2) {
ImageIcon var3 = (ImageIcon)this.weaponButton[var2].getIcon();
if (var3 != null) {
var3.setImageObserver((ImageObserver)null);
}
this.weaponButton[var2].setIcon(new ImageIcon(dmnew.hero[var2].weapon.pic));
if (dmnew.hero[var2].weapon.type == 0 && !dmnew.hero[var2].isdead) {
this.weaponButton[var2].setEnabled(true);
if (dmnew.this.weaponready == var2) {
int var4;
for(var4 = 0; var4 < dmnew.hero[var2].weapon.functions; ++var4) {
boolean var5 = true;
switch(dmnew.hero[var2].weapon.function[var4][1].charAt(0)) {
case 'f':
if (dmnew.hero[var2].flevel < dmnew.hero[var2].weapon.level[var4]) {
var5 = false;
}
break;
case 'n':
if (dmnew.hero[var2].nlevel < dmnew.hero[var2].weapon.level[var4]) {
var5 = false;
}
break;
case 'p':
if (dmnew.hero[var2].plevel < dmnew.hero[var2].weapon.level[var4]) {
var5 = false;
}
break;
case 'w':
if (dmnew.hero[var2].wlevel < dmnew.hero[var2].weapon.level[var4]) {
var5 = false;
}
}
if (var5) {
this.weaponFunction[var4].setText(dmnew.hero[var2].weapon.function[var4][0]);
this.weaponFunction[var4].setVisible(true);
} else {
this.weaponFunction[var4].setText("");
this.weaponFunction[var4].setVisible(false);
}
}
for(int var6 = var4; var6 < 3; ++var6) {
this.weaponFunction[var6].setText("");
this.weaponFunction[var6].setVisible(false);
}
if (dmnew.hero[dmnew.this.weaponready].wepready) {
this.functionsEnable(true);
} else {
this.functionsEnable(false);
}
}
} else {
this.weaponButton[var2].setDisabledIcon((Icon)null);
this.weaponButton[var2].setEnabled(false);
if (dmnew.this.weaponready == var2) {
this.weaponFunction[0].setVisible(false);
this.weaponFunction[1].setVisible(false);
this.weaponFunction[2].setVisible(false);
}
}
}
}
public void functionsEnable(boolean var1) {
for(int var2 = 0; var2 < dmnew.hero[dmnew.this.weaponready].weapon.functions; ++var2) {
this.weaponFunction[var2].setEnabled(var1);
}
if (this.hitpan.isVisible() && dmnew.hero[dmnew.this.weaponready].hitcounter <= 0) {
this.hitpan.setVisible(false);
this.dwnpan.setVisible(true);
} else if (!this.hitpan.isVisible() && dmnew.hero[dmnew.this.weaponready].hitcounter > 0) {
this.dwnpan.setVisible(false);
this.hitpan.setVisible(true);
}
((BoxLayout)this.uppan.getLayout()).invalidateLayout(this.uppan);
this.uppan.validate();
this.repaint();
}
}
class DungMove extends KeyAdapter {
DungMove() {
}
public void keyPressed(KeyEvent var1) {
if (!dmnew.this.viewing && var1.getKeyCode() == 27) {
dmnew.this.gamefrozen = !dmnew.this.gamefrozen;
int var3;
if (dmnew.this.gamefrozen) {
dmnew.nomovement = true;
dmnew.this.centerlay.show(dmnew.this.centerpanel, "freeze");
if (dmnew.numheroes > 0) {
for(var3 = 0; var3 < dmnew.numheroes; ++var3) {
dmnew.hero[var3].removeMouseListener(dmnew.this.hclick);
}
dmnew.this.spellsheet.setVisible(false);
dmnew.this.weaponsheet.setVisible(false);
}
} else {
dmnew.nomovement = false;
if (dmnew.sheet) {
dmnew.this.centerlay.show(dmnew.this.centerpanel, "herosheet");
} else {
dmnew.this.centerlay.show(dmnew.this.centerpanel, "dview");
}
if (dmnew.numheroes > 0) {
if (!dmnew.this.sleeping) {
dmnew.this.spellsheet.setVisible(true);
dmnew.this.weaponsheet.setVisible(true);
}
for(var3 = 0; var3 < dmnew.numheroes; ++var3) {
if (!dmnew.hero[var3].isdead) {
dmnew.hero[var3].addMouseListener(dmnew.this.hclick);
}
}
}
}
} else if (!dmnew.nomovement) {
if (!dmnew.this.viewing) {
MouseEvent var2;
if (dmnew.numheroes > 0 && var1.getKeyCode() == 112) {
var2 = new MouseEvent(dmnew.hero[0], 501, 0L, 0, 20, 20, 1, false);
dmnew.hero[0].dispatchEvent(var2);
} else if (dmnew.numheroes > 1 && var1.getKeyCode() == 113) {
var2 = new MouseEvent(dmnew.hero[1], 501, 0L, 0, 20, 20, 1, false);
dmnew.hero[1].dispatchEvent(var2);
} else if (dmnew.numheroes > 2 && var1.getKeyCode() == 114) {
var2 = new MouseEvent(dmnew.hero[2], 501, 0L, 0, 20, 20, 1, false);
dmnew.hero[2].dispatchEvent(var2);
} else if (dmnew.numheroes > 3 && var1.getKeyCode() == 115) {
var2 = new MouseEvent(dmnew.hero[3], 501, 0L, 0, 20, 20, 1, false);
dmnew.hero[3].dispatchEvent(var2);
} else if (dmnew.numheroes > 0 && var1.getKeyCode() == 116) {
if (dmnew.actionqueue.isEmpty()) {
dmnew.actionqueue.add("s");
}
} else if (var1.getKeyCode() == 117) {
if (dmnew.actionqueue.isEmpty()) {
dmnew.actionqueue.add("l");
}
} else if (var1.getKeyCode() == 120 && dmnew.actionqueue.isEmpty()) {
dmnew.actionqueue.add("o");
}
}
if (!dmnew.sheet) {
if (var1.getKeyChar() != '7' && Character.toLowerCase(var1.getKeyChar()) != 'u') {
if (var1.getKeyChar() != '9' && Character.toLowerCase(var1.getKeyChar()) != 'o') {
if (var1.getKeyChar() != '8' && Character.toLowerCase(var1.getKeyChar()) != 'i') {
if (var1.getKeyChar() != '5' && var1.getKeyChar() != '2' && Character.toLowerCase(var1.getKeyChar()) != 'k') {
if (var1.getKeyChar() != '4' && Character.toLowerCase(var1.getKeyChar()) != 'j') {
if ((var1.getKeyChar() == '6' || Character.toLowerCase(var1.getKeyChar()) == 'l') && dmnew.walkqueue.size() < 4) {
dmnew.walkqueue.add(new Integer(0));
}
} else if (dmnew.walkqueue.size() < 4) {
dmnew.walkqueue.add(new Integer(2));
}
} else if (dmnew.walkqueue.size() < 4) {
dmnew.walkqueue.add(new Integer(1));
}
} else if (dmnew.walkqueue.size() < 4) {
dmnew.walkqueue.add(new Integer(3));
}
} else if (dmnew.walkqueue.size() < 4) {
dmnew.walkqueue.add(new Integer(-2));
}
} else if (dmnew.walkqueue.size() < 4) {
dmnew.walkqueue.add(new Integer(-1));
}
}
}
}
public void turnLeft() {
if (dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy] instanceof Stairs) {
dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].tryTeleport();
dmnew.mirrorback = !dmnew.mirrorback;
dmnew.walkqueue.clear();
} else {
dmnew.mirrorback = !dmnew.mirrorback;
++dmnew.facing;
if (dmnew.facing > 3) {
dmnew.facing = 0;
}
Iterator var2 = dmnew.dmprojs.iterator();
while(var2.hasNext()) {
dmnew.Projectile var1 = (dmnew.Projectile)var2.next();
if (var1.it != null && var1.it.hasthrowpic) {
byte var3 = 2;
if (dmnew.facing == var1.direction) {
var3 = 0;
} else if ((dmnew.facing - var1.direction) % 2 == 0) {
var3 = 1;
} else if (dmnew.facing == (var1.direction + 1) % 4) {
var3 = 3;
}
var1.pic = var1.it.throwpic[var3];
}
}
Pillar.swapmirror = !Pillar.swapmirror;
dmnew.needredraw = true;
}
}
public void turnRight() {
if (dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy] instanceof Stairs) {
dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].tryTeleport();
dmnew.mirrorback = !dmnew.mirrorback;
dmnew.walkqueue.clear();
} else {
dmnew.mirrorback = !dmnew.mirrorback;
--dmnew.facing;
if (dmnew.facing < 0) {
dmnew.facing = 3;
}
Iterator var2 = dmnew.dmprojs.iterator();
while(var2.hasNext()) {
dmnew.Projectile var1 = (dmnew.Projectile)var2.next();
if (var1.it != null && var1.it.hasthrowpic) {
byte var3 = 2;
if (dmnew.facing == var1.direction) {
var3 = 0;
} else if ((dmnew.facing - var1.direction) % 2 == 0) {
var3 = 1;
} else if (dmnew.facing == (var1.direction + 1) % 4) {
var3 = 3;
}
var1.pic = var1.it.throwpic[var3];
}
}
Pillar.swapmirror = !Pillar.swapmirror;
dmnew.needredraw = true;
}
}
public void partyMove(int var1) {
byte var2 = 0;
byte var3 = 0;
if (dmnew.facing == 0) {
var3 = 1;
} else if (dmnew.facing == 1) {
var2 = 1;
} else if (dmnew.facing == 2) {
var3 = -1;
} else {
var2 = -1;
}
int var4;
int var5;
switch(var1) {
case 1:
var4 = dmnew.partyx + var2;
var5 = dmnew.partyy + var3;
break;
case 2:
var4 = dmnew.partyx - var3;
var5 = dmnew.partyy + var2;
break;
case 3:
var4 = dmnew.partyx - var2;
var5 = dmnew.partyy - var3;
break;
default:
var4 = dmnew.partyx + var3;
var5 = dmnew.partyy - var2;
}
if (var4 >= 0 && var5 >= 0 && var4 < dmnew.mapwidth && var5 < dmnew.mapheight) {
if (dmnew.DungeonMap[dmnew.level][var4][var5].isPassable && !dmnew.DungeonMap[dmnew.level][var4][var5].hasMons) {
int var6;
int var8;
int var10;
int var12;
if (dmnew.numheroes > 0 && dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].numProjs > 0) {
var6 = dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].numProjs;
var8 = 0;
int var9 = 0;
for(var10 = -1; var8 < var6; ++var8) {
dmnew.Projectile var7;
do {
do {
var7 = (dmnew.Projectile)dmnew.dmprojs.get(var9);
++var9;
} while(var7.level != dmnew.level);
} while(var7.x != dmnew.partyx || var7.y != dmnew.partyy);
if (!var7.justthrown && !var7.isending) {
int var11 = (var7.subsquare + dmnew.facing) % 4;
if (dmnew.heroatsub[var11] != -1) {
var10 = dmnew.heroatsub[var11];
} else {
switch(var1) {
case 1:
if (var11 == 2) {
var10 = dmnew.heroatsub[1];
} else if (var11 == 3) {
var10 = dmnew.heroatsub[0];
}
break;
case 2:
if (var11 == 0) {
var10 = dmnew.heroatsub[1];
} else if (var11 == 3) {
var10 = dmnew.heroatsub[2];
}
break;
case 3:
if (var11 == 0) {
var10 = dmnew.heroatsub[3];
} else if (var11 == 1) {
var10 = dmnew.heroatsub[2];
}
break;
default:
if (var11 == 1) {
var10 = dmnew.heroatsub[0];
} else if (var11 == 2) {
var10 = dmnew.heroatsub[3];
}
}
}
if (var10 != -1) {
var12 = dmnew.heroatsub[var11];
dmnew.heroatsub[var11] = var10;
var7.projend();
if (var12 == -1 || !dmnew.hero[var12].isdead) {
dmnew.heroatsub[var11] = var12;
}
if (dmnew.hero[var10].isdead) {
dmnew.heroatsub[dmnew.hero[var10].subsquare] = -1;
}
dmnew.this.formation.addNewHero();
if (var7.it != null) {
--var9;
dmnew.dmprojs.remove(var9);
} else {
var7.x = var4;
var7.y = var5;
--dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].numProjs;
++dmnew.DungeonMap[dmnew.level][var4][var5].numProjs;
}
}
}
}
}
dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].hasParty = false;
if (dmnew.numheroes != 0) {
dmnew.DungeonMap[dmnew.level][var4][var5].hasParty = true;
dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].tryFloorSwitch(1);
dmnew.DungeonMap[dmnew.level][var4][var5].hasParty = false;
}
var6 = dmnew.level;
int var17 = dmnew.partyy;
var8 = dmnew.partyx;
dmnew.partyy = var5;
dmnew.partyx = var4;
if (dmnew.numheroes != 0) {
dmnew.DungeonMap[dmnew.level][var4][var5].tryFloorSwitch(0);
}
dmnew.DungeonMap[dmnew.level][var4][var5].hasParty = true;
boolean var18 = dmnew.mirrorback;
dmnew.DungeonMap[dmnew.level][var4][var5].tryTeleport();
if (dmnew.partyx == var8 && dmnew.partyy == var17 && dmnew.level == var6) {
if (dmnew.mirrorback != var18) {
dmnew.mirrorback = !dmnew.mirrorback;
}
} else {
if (dmnew.mirrorback == var18) {
dmnew.mirrorback = !dmnew.mirrorback;
}
if (dmnew.numheroes > 0 && dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].numProjs > 0) {
var10 = dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].numProjs;
var12 = 0;
int var13 = 0;
for(int var14 = -1; var12 < var10; ++var12) {
dmnew.Projectile var19;
do {
do {
var19 = (dmnew.Projectile)dmnew.dmprojs.get(var13);
++var13;
} while(var19.level != dmnew.level);
} while(var19.x != dmnew.partyx || var19.y != dmnew.partyy);
if (!var19.isending) {
int var15 = (var19.subsquare + dmnew.facing) % 4;
switch(var1) {
case 1:
if (var15 == 0) {
var14 = dmnew.heroatsub[3];
} else if (var15 == 1) {
var14 = dmnew.heroatsub[2];
}
break;
case 2:
if (var15 == 1) {
var14 = dmnew.heroatsub[0];
} else if (var15 == 2) {
var14 = dmnew.heroatsub[3];
}
break;
case 3:
if (var15 == 2) {
var14 = dmnew.heroatsub[1];
} else if (var15 == 3) {
var14 = dmnew.heroatsub[0];
}
break;
default:
if (var15 == 0) {
var14 = dmnew.heroatsub[1];
} else if (var15 == 3) {
var14 = dmnew.heroatsub[2];
}
}
if (var14 != -1) {
int var16 = dmnew.heroatsub[var15];
dmnew.heroatsub[var15] = var14;
var19.projend();
if (var16 == -1 || !dmnew.hero[var16].isdead) {
dmnew.heroatsub[var15] = var16;
}
if (dmnew.hero[var14].isdead) {
dmnew.heroatsub[dmnew.hero[var14].subsquare] = -1;
}
dmnew.this.formation.addNewHero();
if (var19.it != null) {
--var13;
dmnew.dmprojs.remove(var13);
}
}
}
}
}
}
dmnew.needredraw = true;
for(var10 = 0; var10 < dmnew.numheroes; ++var10) {
++dmnew.hero[var10].walkcounter;
if (dmnew.hero[var10].load > dmnew.hero[var10].maxload * 3.0F / 4.0F) {
++dmnew.hero[var10].walkcounter;
}
if (dmnew.hero[var10].load > dmnew.hero[var10].maxload) {
++dmnew.hero[var10].walkcounter;
}
if (dmnew.hero[var10].walkcounter > dmnew.hero[var10].vitality / 4) {
dmnew.hero[var10].vitalize(-((int)dmnew.hero[var10].load) / 10 - 1);
dmnew.hero[var10].repaint();
dmnew.hero[var10].walkcounter = 0;
}
}
} else if (dmnew.numheroes != 0 && !dmnew.DungeonMap[dmnew.level][var4][var5].isPassable) {
dmnew.playSound("bump.wav", var4, var5);
}
} else {
if (dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy] instanceof Stairs) {
dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy].tryTeleport();
} else if (dmnew.numheroes != 0) {
dmnew.playSound("bump.wav", var4, var5);
}
}
}
}
class WeaponFunctClick implements ActionListener {
WeaponFunctClick() {
}
public void actionPerformed(ActionEvent var1) {
dmnew.weaponqueue.add(dmnew.this.weaponready + var1.getActionCommand() + dmnew.hero[dmnew.this.weaponready].weapon.number);
dmnew.hero[dmnew.this.weaponready].wepready = false;
dmnew.hero[dmnew.this.weaponready].weaponcount = 5;
dmnew.this.weaponsheet.update();
}
}
class WeaponClick implements ActionListener {
WeaponClick() {
}
public void actionPerformed(ActionEvent var1) {
dmnew.this.weaponready = Integer.parseInt(var1.getActionCommand());
dmnew.this.weaponsheet.update();
}
}
class SpellClick implements ActionListener {
SpellClick() {
}
public void actionPerformed(ActionEvent var1) {
if (var1.getActionCommand().equals("undo")) {
if (dmnew.hero[dmnew.this.spellready].currentspell.length() > 0) {
dmnew.hero[dmnew.this.spellready].currentspell = dmnew.hero[dmnew.this.spellready].currentspell.substring(0, dmnew.hero[dmnew.this.spellready].currentspell.length() - 1);
if (dmnew.hero[dmnew.this.spellready].currentspell.length() > 0) {
dmnew.this.spellsheet.castsymbs.flush();
dmnew.this.spellsheet.castsymbs = new BufferedImage(70, 12, 2);
dmnew.this.spellsheet.castg = dmnew.this.spellsheet.castsymbs.createGraphics();
}
dmnew.this.spellsheet.update();
}
} else {
boolean var2 = false;
if (dmnew.hero[dmnew.this.spellready].currentspell.length() <= 1) {
return;
}
int var3 = dmnew.hero[dmnew.this.spellready].castSpell();
if (var3 == 0) {
dmnew.message.setMessage(dmnew.hero[dmnew.this.spellready].name + " mumbles nonsense.", 4);
dmnew.hero[dmnew.this.spellready].currentspell = "";
} else if (var3 == 1) {
dmnew.message.setMessage(dmnew.hero[dmnew.this.spellready].name + " casts a spell.", dmnew.this.spellready);
dmnew.hero[dmnew.this.spellready].currentspell = "";
if (dmnew.sheet && dmnew.herosheet.hero.equals(dmnew.hero[dmnew.this.spellready])) {
dmnew.herosheet.repaint();
}
} else if (var3 == 2) {
dmnew.message.setMessage(dmnew.hero[dmnew.this.spellready].name + " needs an empty flask in hand.", 4);
} else if (var3 == 3) {
dmnew.message.setMessage(dmnew.hero[dmnew.this.spellready].name + " needs more practice to cast that " + dmnew.this.spellclass + " spell.", 4);
dmnew.hero[dmnew.this.spellready].currentspell = "";
} else if (var3 == 4) {
dmnew.message.setMessage(dmnew.hero[dmnew.this.spellready].name + " can't cast that now.", 4);
} else {
dmnew.message.setMessage(dmnew.hero[dmnew.this.spellready].name + "'s spell fizzles.", 4);
dmnew.hero[dmnew.this.spellready].currentspell = "";
}
dmnew.this.spellsheet.update();
dmnew.this.weaponsheet.update();
}
}
}
class SpellCasterClick implements ActionListener {
SpellCasterClick() {
}
public void actionPerformed(ActionEvent var1) {
dmnew.this.spellsheet.casterButton[dmnew.this.spellready].setText("");
dmnew.this.spellsheet.casterButton[dmnew.this.spellready].setPreferredSize(new Dimension(16, 20));
dmnew.this.spellsheet.casterButton[dmnew.this.spellready].setMaximumSize(new Dimension(16, 20));
dmnew.this.spellready = Integer.parseInt(var1.getActionCommand());
dmnew.this.spellsheet.casterButton[dmnew.this.spellready].setPreferredSize(new Dimension(95, 20));
dmnew.this.spellsheet.casterButton[dmnew.this.spellready].setMaximumSize(new Dimension(95, 20));
dmnew.this.spellsheet.casterButton[dmnew.this.spellready].setText(dmnew.hero[dmnew.this.spellready].name);
dmnew.this.spellsheet.update();
}
}
class SpellSymbolClick implements ActionListener {
SpellSymbolClick() {
}
public void actionPerformed(ActionEvent var1) {
if (dmnew.hero[dmnew.this.spellready].currentspell.length() != 4) {
int var2 = Integer.parseInt(var1.getActionCommand());
int var3 = var2 + 1;
if (dmnew.hero[dmnew.this.spellready].currentspell.length() > 0) {
var3 = dmnew.SYMBOLCOST[var2 + 6 * (dmnew.hero[dmnew.this.spellready].currentspell.length() - 1)][Integer.parseInt(dmnew.hero[dmnew.this.spellready].currentspell.substring(0, 1)) - 1];
}
if (dmnew.hero[dmnew.this.spellready].mana >= var3) {
dmnew.Hero var10000 = dmnew.hero[dmnew.this.spellready];
var10000.mana -= var3;
StringBuffer var4 = new StringBuffer();
dmnew.Hero var10002 = dmnew.hero[dmnew.this.spellready];
var10002.currentspell = var4.append(var10002.currentspell).append("").append(var2 + 1).toString();
dmnew.this.spellsheet.update();
dmnew.hero[dmnew.this.spellready].repaint();
if (dmnew.sheet && dmnew.herosheet.hero.equals(dmnew.hero[dmnew.this.spellready])) {
dmnew.herosheet.repaint();
}
}
}
}
}
class MirrorClick extends MouseAdapter {
int x;
int y;
MirrorClick() {
}
public void mousePressed(MouseEvent var1) {
this.x = var1.getX();
this.y = var1.getY();
if ((this.x <= 420 || this.x >= 440 || this.y >= 25 || this.y <= 5) && (this.x <= 205 || this.x >= 439 || this.y <= 223 || this.y >= 250) && !SwingUtilities.isRightMouseButton(var1)) {
if (this.x > 22 && this.x < 57 && this.y < 58 && this.y > 24) {
dmnew.herosheet.skipchestscroll = true;
dmnew.herosheet.paint(dmnew.herosheet.offg);
dmnew.herosheet.stats = true;
dmnew.this.viewing = true;
dmnew.herosheet.repaint();
} else if (this.x > 205 && this.x < 320 && this.y > 103 && this.y < 220) {
dmnew.hero[dmnew.numheroes] = dmnew.mirrorhero;
dmnew.heroatsub[dmnew.mirrorhero.subsquare] = dmnew.numheroes;
dmnew.this.formation.addNewHero();
dmnew.message.setMessage(dmnew.hero[dmnew.numheroes].name + " ressurrected.", dmnew.numheroes);
this.resetStuff();
} else if (this.x > 323 && this.x < 439 && this.y > 103 && this.y < 220) {
dmnew.hero[dmnew.numheroes] = dmnew.mirrorhero;
dmnew.heroatsub[dmnew.mirrorhero.subsquare] = dmnew.numheroes;
dmnew.this.formation.addNewHero();
dmnew.hero[dmnew.numheroes].flevel = 0;
dmnew.hero[dmnew.numheroes].nlevel = 0;
dmnew.hero[dmnew.numheroes].plevel = 0;
dmnew.hero[dmnew.numheroes].wlevel = 0;
dmnew.herosheet.setVisible(false);
new EnterName(dmnew.frame, dmnew.hero[dmnew.numheroes]);
dmnew.herosheet.setVisible(true);
dmnew.message.setMessage(dmnew.hero[dmnew.numheroes].name + " reincarnated.", dmnew.numheroes);
this.resetStuff();
}
} else {
dmnew.sheet = false;
dmnew.herosheet.mirror = false;
dmnew.this.centerlay.show(dmnew.this.centerpanel, "dview");
dmnew.dview.addMouseListener(dmnew.this.dclick);
dmnew.herosheet.removeMouseListener(this);
dmnew.herosheet.addMouseListener(dmnew.this.sheetclick);
dmnew.this.hpanel.remove(dmnew.mirrorhero);
dmnew.this.hpanel.repaint();
dmnew.herosheet.offscreen.flush();
dmnew.mirrorhero = null;
if (dmnew.numheroes > 0) {
for(int var2 = 0; var2 < dmnew.numheroes; ++var2) {
dmnew.hero[var2].addMouseListener(dmnew.this.hclick);
}
}
dmnew.nomovement = false;
}
}
private void resetStuff() {
((Mirror)dmnew.DungeonMap[dmnew.level][dmnew.herolookx][dmnew.herolooky]).wasUsed = true;
if (dmnew.hero[dmnew.numheroes].neck != null && dmnew.hero[dmnew.numheroes].neck.number == 89) {
dmnew.leveldark += 60;
}
dmnew.needredraw = true;
dmnew.sheet = false;
dmnew.this.centerlay.show(dmnew.this.centerpanel, "dview");
if (dmnew.numheroes == 0) {
dmnew.this.spellsheet = dmnew.this.new SpellSheet();
dmnew.this.weaponsheet = dmnew.this.new WeaponSheet();
dmnew.this.eastpanel.add(dmnew.this.spellsheet);
dmnew.this.eastpanel.add(Box.createVerticalStrut(20));
dmnew.this.eastpanel.add(dmnew.this.weaponsheet);
dmnew.this.eastpanel.add(Box.createVerticalStrut(10));
dmnew.hero[dmnew.numheroes].isleader = true;
}
++dmnew.numheroes;
dmnew.this.spellsheet.casterButton[dmnew.numheroes - 1].setEnabled(true);
dmnew.this.spellsheet.setVisible(true);
dmnew.this.weaponsheet.setVisible(true);
dmnew.this.spellsheet.update();
dmnew.this.weaponsheet.update();
for(int var1 = 0; var1 < dmnew.numheroes; ++var1) {
dmnew.hero[var1].addMouseListener(dmnew.this.hclick);
}
dmnew.dview.addMouseListener(dmnew.this.dclick);
dmnew.herosheet.removeMouseListener(this);
dmnew.herosheet.addMouseListener(dmnew.this.sheetclick);
dmnew.herosheet.mirror = false;
dmnew.this.spellsheet.repaint();
dmnew.this.weaponsheet.repaint();
dmnew.nomovement = false;
dmnew.this.hupdate();
dmnew.updateDark();
}
public void mouseReleased(MouseEvent var1) {
if (dmnew.herosheet.stats) {
dmnew.herosheet.skipchestscroll = false;
dmnew.herosheet.stats = false;
dmnew.this.viewing = false;
dmnew.herosheet.paint(dmnew.herosheet.getGraphics());
}
}
}
class SheetClick extends MouseAdapter {
int x;
int y;
SheetClick() {
}
public void mousePressed(MouseEvent var1) {
this.x = var1.getX();
this.y = var1.getY();
if (dmnew.this.sleeping) {
dmnew.needredraw = true;
dmnew.this.sleeping = false;
dmnew.sleeper = 0;
dmnew.this.spellsheet.setVisible(true);
dmnew.this.weaponsheet.setVisible(true);
if (dmnew.herosheet.hero.isdead) {
dmnew.herosheet.setHero(dmnew.hero[dmnew.leader]);
} else {
dmnew.herosheet.repaint();
}
} else if ((this.x <= 420 || this.x >= 440 || this.y >= 25 || this.y <= 5) && !SwingUtilities.isRightMouseButton(var1)) {
dmnew.Hero var10000;
Item var4;
if (this.x > 124 && this.x < 156 && this.y < 136 && this.y > 104) {
if (dmnew.herosheet.hero.weapon.number == 215) {
dmnew.message.setMessage("Stormbringer resists...", 4);
return;
}
if (dmnew.herosheet.hero.weapon.number == 219 || dmnew.herosheet.hero.weapon.number == 261) {
return;
}
if (dmnew.iteminhand) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
}
if (dmnew.herosheet.hero.weapon != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.weapon.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.weapon.weight;
}
if (!dmnew.iteminhand && !dmnew.herosheet.hero.weapon.name.equals("Fist/Foot")) {
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.weapon;
dmnew.herosheet.hero.weapon = dmnew.fistfoot;
if (dmnew.inhand.number == 9) {
((Torch)dmnew.inhand).putOut();
dmnew.updateDark();
}
if (dmnew.inhand.type == 0 || dmnew.inhand.type == 1 || dmnew.inhand.number == 4) {
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
}
dmnew.herosheet.repaint();
dmnew.herosheet.hero.repaint();
dmnew.this.weaponsheet.update();
} else if (dmnew.iteminhand) {
if (dmnew.herosheet.hero.weapon.name.equals("Fist/Foot")) {
dmnew.herosheet.hero.weapon = dmnew.inhand;
dmnew.iteminhand = false;
if (dmnew.herosheet.hero.weapon.number == 9) {
((Torch)dmnew.herosheet.hero.weapon).setPic();
dmnew.updateDark();
}
if (dmnew.inhand.type == 0 || dmnew.inhand.type == 1 || dmnew.inhand.number == 4) {
dmnew.herosheet.hero.weapon.equipEffect(dmnew.herosheet.hero);
}
} else {
var4 = dmnew.herosheet.hero.weapon;
dmnew.herosheet.hero.weapon = dmnew.inhand;
dmnew.inhand = var4;
if (dmnew.inhand.number == 9) {
((Torch)dmnew.inhand).putOut();
dmnew.updateDark();
}
if (dmnew.herosheet.hero.weapon.number == 9) {
((Torch)dmnew.herosheet.hero.weapon).setPic();
dmnew.updateDark();
}
if (dmnew.inhand.type == 0 || dmnew.inhand.type == 1 || dmnew.inhand.number == 4) {
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
}
if (dmnew.herosheet.hero.weapon.type == 0 || dmnew.herosheet.hero.weapon.type == 1 || dmnew.herosheet.hero.weapon.number == 4) {
dmnew.herosheet.hero.weapon.equipEffect(dmnew.herosheet.hero);
}
}
dmnew.herosheet.repaint();
dmnew.herosheet.hero.repaint();
dmnew.this.weaponsheet.update();
}
} else if (this.x > 12 && this.x < 44 && this.y < 136 && this.y > 104) {
if (dmnew.iteminhand) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
}
if (dmnew.herosheet.hero.hand != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.hand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.hand.weight;
}
if (!dmnew.iteminhand && dmnew.herosheet.hero.hand != null) {
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.hand;
dmnew.herosheet.hero.hand = null;
if (dmnew.inhand.number == 9) {
((Torch)dmnew.inhand).putOut();
dmnew.updateDark();
}
if (dmnew.inhand.type == 1) {
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
}
dmnew.herosheet.repaint();
dmnew.herosheet.hero.repaint();
} else if (dmnew.iteminhand) {
if (dmnew.herosheet.hero.hand != null) {
var4 = dmnew.herosheet.hero.hand;
dmnew.herosheet.hero.hand = dmnew.inhand;
dmnew.inhand = var4;
if (dmnew.inhand.number == 9) {
((Torch)dmnew.inhand).putOut();
dmnew.updateDark();
}
if (dmnew.herosheet.hero.hand.number == 9) {
((Torch)dmnew.herosheet.hero.hand).setPic();
dmnew.updateDark();
}
if (dmnew.inhand.type == 1) {
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
}
if (dmnew.herosheet.hero.hand.type == 1) {
dmnew.herosheet.hero.hand.equipEffect(dmnew.herosheet.hero);
}
} else {
dmnew.herosheet.hero.hand = dmnew.inhand;
dmnew.iteminhand = false;
if (dmnew.herosheet.hero.hand.number == 9) {
((Torch)dmnew.herosheet.hero.hand).setPic();
dmnew.updateDark();
}
if (dmnew.inhand.type == 1) {
dmnew.herosheet.hero.hand.equipEffect(dmnew.herosheet.hero);
}
}
dmnew.herosheet.repaint();
dmnew.herosheet.hero.repaint();
}
} else if (this.x > 68 && this.x < 100 && this.y < 84 && this.y > 52) {
if (!dmnew.iteminhand && dmnew.herosheet.hero.head != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.head.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.head.weight;
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.head;
dmnew.herosheet.hero.head = null;
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
dmnew.herosheet.repaint();
} else if (dmnew.iteminhand && dmnew.inhand.type == 2) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
if (dmnew.herosheet.hero.head != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.head.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.head.weight;
var4 = dmnew.herosheet.hero.head;
dmnew.herosheet.hero.head = dmnew.inhand;
dmnew.inhand = var4;
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
dmnew.herosheet.hero.head.equipEffect(dmnew.herosheet.hero);
} else {
dmnew.herosheet.hero.head = dmnew.inhand;
dmnew.iteminhand = false;
dmnew.herosheet.hero.head.equipEffect(dmnew.herosheet.hero);
}
dmnew.herosheet.repaint();
}
} else if (this.x > 12 && this.x < 44 && this.y < 98 && this.y > 66) {
if (!dmnew.iteminhand && dmnew.herosheet.hero.neck != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.neck.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.neck.weight;
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.neck;
dmnew.herosheet.hero.neck = null;
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
if (dmnew.inhand.number == 89) {
dmnew.leveldark -= 60;
dmnew.updateDark();
}
dmnew.herosheet.repaint();
} else if (dmnew.iteminhand && dmnew.inhand.type == 4) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
if (dmnew.herosheet.hero.neck != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.neck.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.neck.weight;
var4 = dmnew.herosheet.hero.neck;
dmnew.herosheet.hero.neck = dmnew.inhand;
dmnew.inhand = var4;
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
dmnew.herosheet.hero.neck.equipEffect(dmnew.herosheet.hero);
if (dmnew.inhand.number == 89) {
dmnew.leveldark -= 60;
dmnew.updateDark();
} else if (dmnew.herosheet.hero.neck.number == 89) {
dmnew.leveldark += 60;
dmnew.updateDark();
}
} else {
dmnew.herosheet.hero.neck = dmnew.inhand;
dmnew.iteminhand = false;
dmnew.herosheet.hero.neck.equipEffect(dmnew.herosheet.hero);
if (dmnew.inhand.number == 89) {
dmnew.leveldark += 60;
dmnew.updateDark();
}
}
dmnew.herosheet.repaint();
}
} else if (this.x > 68 && this.x < 100 && this.y < 124 && this.y > 92) {
if (!dmnew.iteminhand && dmnew.herosheet.hero.torso != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.torso.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.torso.weight;
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.torso;
dmnew.herosheet.hero.torso = null;
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
dmnew.herosheet.repaint();
} else if (dmnew.iteminhand && dmnew.inhand.type == 3) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
if (dmnew.herosheet.hero.torso != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.torso.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.torso.weight;
var4 = dmnew.herosheet.hero.torso;
dmnew.herosheet.hero.torso = dmnew.inhand;
dmnew.inhand = var4;
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
dmnew.herosheet.hero.torso.equipEffect(dmnew.herosheet.hero);
} else {
dmnew.herosheet.hero.torso = dmnew.inhand;
dmnew.iteminhand = false;
dmnew.herosheet.hero.torso.equipEffect(dmnew.herosheet.hero);
}
dmnew.herosheet.repaint();
}
} else if (this.x > 68 && this.x < 100 && this.y < 164 && this.y > 132) {
if (!dmnew.iteminhand && dmnew.herosheet.hero.legs != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.legs.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.legs.weight;
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.legs;
dmnew.herosheet.hero.legs = null;
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
dmnew.herosheet.repaint();
} else if (dmnew.iteminhand && dmnew.inhand.type == 5) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
if (dmnew.herosheet.hero.legs != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.legs.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.legs.weight;
var4 = dmnew.herosheet.hero.legs;
dmnew.herosheet.hero.legs = dmnew.inhand;
dmnew.inhand = var4;
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
dmnew.herosheet.hero.legs.equipEffect(dmnew.herosheet.hero);
} else {
dmnew.herosheet.hero.legs = dmnew.inhand;
dmnew.iteminhand = false;
dmnew.herosheet.hero.legs.equipEffect(dmnew.herosheet.hero);
}
dmnew.herosheet.repaint();
}
} else if (this.x > 68 && this.x < 100 && this.y < 204 && this.y > 172) {
if (!dmnew.iteminhand && dmnew.herosheet.hero.feet != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.feet.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.feet.weight;
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.feet;
dmnew.herosheet.hero.feet = null;
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
dmnew.herosheet.repaint();
} else if (dmnew.iteminhand && dmnew.inhand.type == 6) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
if (dmnew.herosheet.hero.feet != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.feet.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.feet.weight;
var4 = dmnew.herosheet.hero.feet;
dmnew.herosheet.hero.feet = dmnew.inhand;
dmnew.inhand = var4;
dmnew.inhand.unEquipEffect(dmnew.herosheet.hero);
dmnew.herosheet.hero.feet.equipEffect(dmnew.herosheet.hero);
} else {
dmnew.herosheet.hero.feet = dmnew.inhand;
dmnew.iteminhand = false;
dmnew.herosheet.hero.feet.equipEffect(dmnew.herosheet.hero);
}
dmnew.herosheet.repaint();
}
} else if (this.x > 12 && this.x < 44 && this.y < 199 && this.y > 167) {
if (!dmnew.iteminhand && dmnew.herosheet.hero.pouch1 != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.pouch1.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.pouch1.weight;
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.pouch1;
dmnew.herosheet.hero.pouch1 = null;
dmnew.herosheet.repaint();
} else if (dmnew.iteminhand && dmnew.inhand.size < 2) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
if (dmnew.herosheet.hero.pouch1 != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.pouch1.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.pouch1.weight;
var4 = dmnew.herosheet.hero.pouch1;
dmnew.herosheet.hero.pouch1 = dmnew.inhand;
dmnew.inhand = var4;
} else {
dmnew.herosheet.hero.pouch1 = dmnew.inhand;
dmnew.iteminhand = false;
}
dmnew.herosheet.repaint();
}
} else if (this.x > 12 && this.x < 44 && this.y < 233 && this.y > 201) {
if (!dmnew.iteminhand && dmnew.herosheet.hero.pouch2 != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.pouch2.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.pouch2.weight;
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.pouch2;
dmnew.herosheet.hero.pouch2 = null;
dmnew.herosheet.repaint();
} else if (dmnew.iteminhand && dmnew.inhand.size < 2) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
if (dmnew.herosheet.hero.pouch2 != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.pouch2.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.pouch2.weight;
var4 = dmnew.herosheet.hero.pouch2;
dmnew.herosheet.hero.pouch2 = dmnew.inhand;
dmnew.inhand = var4;
} else {
dmnew.herosheet.hero.pouch2 = dmnew.inhand;
dmnew.iteminhand = false;
}
dmnew.herosheet.repaint();
}
} else {
byte var2;
Item var3;
if (this.x > 166 && this.x < 436 && this.y < 98 && this.y > 32) {
var2 = 0;
if (this.y > 65) {
var2 = 8;
}
if (dmnew.iteminhand) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
}
if (dmnew.herosheet.hero.pack[(this.x - 166) / 34 + var2] != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.pack[(this.x - 166) / 34 + var2].weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.pack[(this.x - 166) / 34 + var2].weight;
}
if (!dmnew.iteminhand && dmnew.herosheet.hero.pack[(this.x - 166) / 34 + var2] != null) {
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.pack[(this.x - 166) / 34 + var2];
dmnew.herosheet.hero.pack[(this.x - 166) / 34 + var2] = null;
dmnew.herosheet.repaint();
} else if (dmnew.iteminhand) {
if (dmnew.herosheet.hero.pack[(this.x - 166) / 34 + var2] != null) {
var3 = dmnew.herosheet.hero.pack[(this.x - 166) / 34 + var2];
dmnew.herosheet.hero.pack[(this.x - 166) / 34 + var2] = dmnew.inhand;
dmnew.inhand = var3;
} else {
dmnew.herosheet.hero.pack[(this.x - 166) / 34 + var2] = dmnew.inhand;
dmnew.iteminhand = false;
}
dmnew.herosheet.repaint();
}
} else if (this.x > 124 && this.x < 190 && this.y < 267 && this.y > 167) {
var2 = 0;
if (this.y > 234) {
var2 = 4;
} else if (this.y > 200) {
var2 = 2;
}
if (!dmnew.iteminhand && dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2] != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2].weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2].weight;
dmnew.iteminhand = true;
dmnew.inhand = dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2];
dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2] = null;
dmnew.herosheet.repaint();
} else if (dmnew.iteminhand && dmnew.inhand.type == 0 && (dmnew.inhand.projtype > 0 && dmnew.inhand.size < 2 || dmnew.inhand.size < 4 && (this.x - 124) / 34 + var2 == 0)) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
if (dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2] != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2].weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2].weight;
var3 = dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2];
dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2] = dmnew.inhand;
dmnew.inhand = var3;
} else {
dmnew.herosheet.hero.quiver[(this.x - 124) / 34 + var2] = dmnew.inhand;
dmnew.iteminhand = false;
}
dmnew.herosheet.repaint();
}
} else if (this.x > 227 && this.x < 431 && this.y > 206 && this.y < 271 && dmnew.herosheet.hero.weapon != null && dmnew.herosheet.hero.weapon.number == 5) {
var2 = 0;
if (this.y > 238) {
var2 = 6;
}
if (!dmnew.iteminhand && ((Chest)dmnew.herosheet.hero.weapon).contents[(this.x - 227) / 34 + var2] != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= ((Chest)dmnew.herosheet.hero.weapon).contents[(this.x - 227) / 34 + var2].weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += ((Chest)dmnew.herosheet.hero.weapon).contents[(this.x - 227) / 34 + var2].weight;
dmnew.iteminhand = true;
dmnew.inhand = ((Chest)dmnew.herosheet.hero.weapon).getItem((this.x - 227) / 34 + var2);
dmnew.herosheet.repaint();
} else if (dmnew.iteminhand) {
var10000 = dmnew.herosheet.hero;
var10000.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
if (((Chest)dmnew.herosheet.hero.weapon).contents[(this.x - 227) / 34 + var2] != null) {
var10000 = dmnew.herosheet.hero;
var10000.load -= ((Chest)dmnew.herosheet.hero.weapon).contents[(this.x - 227) / 34 + var2].weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += ((Chest)dmnew.herosheet.hero.weapon).contents[(this.x - 227) / 34 + var2].weight;
var3 = ((Chest)dmnew.herosheet.hero.weapon).getItem((this.x - 227) / 34 + var2);
((Chest)dmnew.herosheet.hero.weapon).putItem((this.x - 227) / 34 + var2, dmnew.inhand);
dmnew.inhand = var3;
} else {
((Chest)dmnew.herosheet.hero.weapon).putItem((this.x - 227) / 34 + var2, dmnew.inhand);
dmnew.iteminhand = false;
}
dmnew.herosheet.repaint();
}
} else if (this.x > 20 && this.x < 57 && this.y < 58 && this.y > 24) {
dmnew.herosheet.skipchestscroll = true;
dmnew.herosheet.paint(dmnew.herosheet.offg);
dmnew.this.viewing = true;
if (!dmnew.iteminhand) {
dmnew.herosheet.stats = true;
} else if (dmnew.inhand.number == 4) {
dmnew.inhand.temppic = dmnew.inhand.pic;
dmnew.inhand.pic = dmnew.inhand.epic;
dmnew.this.changeCursor();
}
dmnew.herosheet.repaint();
} else if (this.x > 109 && this.x < 146 && this.y < 58 && this.y > 24) {
if (dmnew.iteminhand && (dmnew.inhand.type == 7 || dmnew.inhand.ispotion || dmnew.inhand.number == 72 || dmnew.inhand.number == 73)) {
dmnew.herosheet.hero.eatdrink();
dmnew.herosheet.hero.repaint();
dmnew.herosheet.repaint();
}
} else if (this.x > 260 && this.x < 295 && this.y < 24 && this.y > 5) {
dmnew.this.sleeping = true;
dmnew.sleeper = 50;
dmnew.this.spellsheet.setVisible(false);
dmnew.this.weaponsheet.setVisible(false);
dmnew.herosheet.repaint();
} else if (this.x > 347 && this.x < 366 && this.y < 24 && this.y > 5 && dmnew.actionqueue.isEmpty()) {
dmnew.actionqueue.add("o");
}
}
} else {
dmnew.sheet = false;
dmnew.this.centerlay.show(dmnew.this.centerpanel, "dview");
dmnew.this.hupdate();
}
dmnew.this.changeCursor();
}
public void mouseReleased(MouseEvent var1) {
if (dmnew.this.viewing) {
dmnew.herosheet.skipchestscroll = false;
dmnew.herosheet.stats = false;
dmnew.this.viewing = false;
if (dmnew.iteminhand && dmnew.inhand.number == 4) {
dmnew.inhand.pic = dmnew.inhand.temppic;
dmnew.this.changeCursor();
}
dmnew.herosheet.paint(dmnew.herosheet.getGraphics());
}
}
}
class HeroSheet extends JComponent {
dmnew.Hero hero;
Image offscreen;
Graphics2D offg;
boolean mirror = false;
boolean stats = false;
boolean skipchestscroll = false;
public HeroSheet() {
this.setSize(448, 326);
this.setBackground(Color.black);
this.setDoubleBuffered(true);
}
public HeroSheet(dmnew.Hero var2) {
this.hero = var2;
this.setSize(448, 326);
this.setBackground(Color.black);
this.setDoubleBuffered(true);
}
public void setHero(dmnew.Hero var1) {
this.hero = var1;
this.repaint();
this.hero.repaint();
}
public void setHero(dmnew.Hero var1, int var2) {
this.hero = var1;
this.mirror = true;
this.repaint();
this.hero.repaint();
this.removeMouseListener(dmnew.this.sheetclick);
this.addMouseListener(dmnew.this.new MirrorClick());
}
public void paint(Graphics var1) {
if (dmnew.this.sleeping) {
this.sleepsheet();
var1.drawImage(this.offscreen, 0, 0, (ImageObserver)null);
} else if (this.stats) {
this.showStats();
var1.drawImage(this.offscreen, 0, 0, (ImageObserver)null);
} else if (dmnew.this.viewing) {
this.showItem();
var1.drawImage(this.offscreen, 0, 0, (ImageObserver)null);
} else {
this.offg.setFont(new Font("TimesRoman", 1, 14));
this.offg.drawImage(dmnew.hsheet, 0, 0, (ImageObserver)null);
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString(this.hero.name + " " + this.hero.lastname, 8, 18);
this.offg.drawString("Health", 18, 288);
this.offg.drawString(this.hero.health + " / " + this.hero.maxhealth, 128, 288);
this.offg.drawString("Stamina", 18, 306);
this.offg.drawString(this.hero.stamina + " / " + this.hero.maxstamina, 128, 306);
this.offg.drawString("Mana", 18, 324);
this.offg.drawString(this.hero.mana + " / " + this.hero.maxmana, 128, 324);
if (dmnew.leader == this.hero.heronumber) {
this.offg.setColor(Color.yellow);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString(this.hero.name + " " + this.hero.lastname, 5, 15);
if (dmnew.leader == this.hero.heronumber) {
this.offg.setColor(Color.white);
}
this.offg.drawString("Health", 15, 285);
this.offg.drawString("Stamina", 15, 303);
this.offg.drawString("Mana", 15, 321);
if (this.hero.health < this.hero.maxhealth / 3) {
this.offg.setColor(Color.red);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString(this.hero.health + " / " + this.hero.maxhealth, 125, 285);
if (this.hero.stamina < this.hero.maxstamina / 3) {
this.offg.setColor(Color.red);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString(this.hero.stamina + " / " + this.hero.maxstamina, 125, 303);
if (this.hero.mana < this.hero.maxmana / 3) {
this.offg.setColor(Color.red);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString(this.hero.mana + " / " + this.hero.maxmana, 125, 321);
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString("Load " + (float)((int)(this.hero.load * 10.0F + 0.5F)) / 10.0F + " / " + (float)((int)(this.hero.maxload * 10.0F + 0.5F)) / 10.0F, 263, 324);
this.offg.drawString("Kg", 423, 324);
if (this.hero.load > this.hero.maxload) {
this.offg.setColor(Color.red);
} else if (this.hero.load > this.hero.maxload * 3.0F / 4.0F) {
this.offg.setColor(Color.yellow);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString("Load " + (float)((int)(this.hero.load * 10.0F + 0.5F)) / 10.0F + " / " + (float)((int)(this.hero.maxload * 10.0F + 0.5F)) / 10.0F, 260, 321);
this.offg.drawString("Kg", 420, 321);
if (this.hero.ispoisoned) {
this.offg.setColor(new Color(0, 150, 0));
this.offg.setStroke(new BasicStroke(2.0F));
this.offg.drawRect(106, 22, 40, 37);
this.offg.drawImage(dmnew.poisonedpic, 224, 209, (ImageObserver)null);
}
if (this.hero.silenced) {
this.offg.setFont(new Font("TimesRoman", 1, 24));
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString("SILENCED", 264, 284);
this.offg.setColor(Color.red);
this.offg.drawString("SILENCED", 260, 280);
this.offg.setFont(new Font("TimesRoman", 1, 14));
}
if (this.hero.strengthboost < 0 || this.hero.dexterityboost < 0 || this.hero.vitalityboost < 0 || this.hero.intelligenceboost < 0 || this.hero.wisdomboost < 0 || this.hero.defenseboost < 0 || this.hero.magicresistboost < 0) {
this.offg.setColor(Color.red);
this.offg.setStroke(new BasicStroke(2.0F));
this.offg.drawRect(18, 22, 40, 37);
}
int var2;
int var3;
int var4;
if (!this.mirror && (this.hero.weapon == null || this.skipchestscroll || this.hero.weapon.number != 5 && this.hero.weapon.number != 4)) {
var2 = (int)((float)this.hero.food / 1000.0F * 170.0F);
this.offg.setColor(new Color(30, 30, 30));
this.offg.fillRect(245, 150, var2, 10);
if (this.hero.food < 75) {
this.offg.setColor(Color.red);
} else if (this.hero.food < 100) {
this.offg.setColor(Color.yellow);
} else {
this.offg.setColor(new Color(200, 130, 10));
}
this.offg.fillRect(240, 145, var2, 10);
var2 = (int)((float)this.hero.water / 1000.0F * 170.0F);
this.offg.setColor(new Color(30, 30, 30));
this.offg.fillRect(245, 197, var2, 10);
if (this.hero.water < 75) {
this.offg.setColor(Color.red);
} else if (this.hero.water < 100) {
this.offg.setColor(Color.yellow);
} else {
this.offg.setColor(Color.blue);
}
this.offg.fillRect(240, 192, var2, 10);
} else if (!this.mirror && this.hero.weapon != null && this.hero.weapon.number == 5) {
this.offg.drawImage(dmnew.openchest, 156, 104, (ImageObserver)null);
for(var2 = 0; var2 < 12; ++var2) {
if (((Chest)this.hero.weapon).contents[var2] != null) {
if (var2 < 6) {
this.offg.drawImage(((Chest)this.hero.weapon).contents[var2].pic, 227 + var2 * 34, 207, this);
} else {
this.offg.drawImage(((Chest)this.hero.weapon).contents[var2].pic, 227 + (var2 - 6) * 34, 239, this);
}
}
}
} else if (!this.mirror && this.hero.weapon != null && this.hero.weapon.number == 4) {
this.offg.drawImage(dmnew.scrollpic, 156, 104, (ImageObserver)null);
this.offg.setFont(new Font("Courier", 1, 16));
for(var2 = this.hero.weapon.scroll.length; this.hero.weapon.scroll[var2 - 1].equals(""); --var2) {
}
var3 = 188 - var2 * 10;
this.offg.setColor(new Color(30, 30, 30));
for(var4 = 0; var4 < var2; ++var4) {
this.offg.drawString(this.hero.weapon.scroll[var4], 320 - this.hero.weapon.scroll[var4].length() * 5, var3 + var4 * 20);
}
} else {
this.offg.drawImage(dmnew.ressreincpic, 206, 104, this);
}
this.offg.setColor(new Color(63, 63, 63));
this.offg.drawImage(this.hero.weapon.pic, 124, 106, this);
if (this.hero.hurtweapon) {
if (this.hero.weapon == dmnew.fistfoot) {
this.offg.drawImage(dmnew.hurtweapon, 124, 106, this);
}
this.offg.setColor(Color.red);
this.offg.setStroke(new BasicStroke(2.0F));
this.offg.drawRect(123, 105, 34, 34);
this.offg.setColor(new Color(63, 63, 63));
}
if (this.hero.head != null) {
this.offg.fillRect(68, 52, 32, 32);
this.offg.drawImage(this.hero.head.pic, 68, 52, this);
}
if (this.hero.hurthead) {
if (this.hero.head == null) {
this.offg.drawImage(dmnew.hurthead, 68, 52, this);
}
this.offg.setColor(Color.red);
this.offg.setStroke(new BasicStroke(2.0F));
this.offg.drawRect(67, 51, 34, 34);
this.offg.setColor(new Color(63, 63, 63));
}
if (this.hero.neck != null) {
this.offg.fillRect(12, 66, 32, 32);
this.offg.drawImage(this.hero.neck.pic, 12, 66, this);
}
if (this.hero.torso != null) {
this.offg.fillRect(68, 92, 32, 32);
this.offg.drawImage(this.hero.torso.pic, 68, 92, this);
}
if (this.hero.hurttorso) {
if (this.hero.torso == null) {
this.offg.drawImage(dmnew.hurttorso, 68, 92, this);
}
this.offg.setColor(Color.red);
this.offg.setStroke(new BasicStroke(2.0F));
this.offg.drawRect(67, 91, 34, 34);
this.offg.setColor(new Color(63, 63, 63));
}
if (this.hero.hand != null) {
this.offg.fillRect(12, 106, 32, 32);
this.offg.drawImage(this.hero.hand.pic, 12, 106, this);
}
if (this.hero.hurthand) {
if (this.hero.hand == null) {
this.offg.drawImage(dmnew.hurthand, 12, 106, this);
}
this.offg.setColor(Color.red);
this.offg.setStroke(new BasicStroke(2.0F));
this.offg.drawRect(11, 105, 34, 34);
this.offg.setColor(new Color(63, 63, 63));
}
if (this.hero.legs != null) {
this.offg.fillRect(68, 132, 32, 32);
this.offg.drawImage(this.hero.legs.pic, 68, 132, this);
}
if (this.hero.hurtlegs) {
if (this.hero.legs == null) {
this.offg.drawImage(dmnew.hurtlegs, 68, 132, this);
}
this.offg.setColor(Color.red);
this.offg.setStroke(new BasicStroke(2.0F));
this.offg.drawRect(67, 131, 34, 34);
this.offg.setColor(new Color(63, 63, 63));
}
if (this.hero.feet != null) {
this.offg.fillRect(68, 172, 32, 32);
this.offg.drawImage(this.hero.feet.pic, 68, 172, this);
}
if (this.hero.hurtfeet) {
if (this.hero.feet == null) {
this.offg.drawImage(dmnew.hurtfeet, 68, 172, this);
}
this.offg.setColor(Color.red);
this.offg.setStroke(new BasicStroke(2.0F));
this.offg.drawRect(67, 171, 34, 34);
this.offg.setColor(new Color(63, 63, 63));
}
if (this.hero.pouch1 != null) {
this.offg.drawImage(this.hero.pouch1.pic, 12, 167, this);
}
if (this.hero.pouch2 != null) {
this.offg.drawImage(this.hero.pouch2.pic, 12, 201, this);
}
for(var2 = 0; var2 < 8; ++var2) {
if (this.hero.pack[var2] != null) {
this.offg.drawImage(this.hero.pack[var2].pic, 166 + 34 * var2, 32, this);
}
}
for(var3 = 0; var3 < 8; ++var3) {
if (this.hero.pack[var3 + 8] != null) {
this.offg.drawImage(this.hero.pack[var3 + 8].pic, 166 + 34 * var3, 66, this);
}
}
for(var4 = 0; var4 < 2; ++var4) {
if (this.hero.quiver[var4] != null) {
this.offg.drawImage(this.hero.quiver[var4].pic, 124 + 34 * var4, 167, this);
}
}
for(int var5 = 0; var5 < 2; ++var5) {
if (this.hero.quiver[var5 + 2] != null) {
this.offg.drawImage(this.hero.quiver[var5 + 2].pic, 124 + 34 * var5, 201, this);
}
}
for(int var6 = 0; var6 < 2; ++var6) {
if (this.hero.quiver[var6 + 4] != null) {
this.offg.drawImage(this.hero.quiver[var6 + 4].pic, 124 + 34 * var6, 235, this);
}
}
var1.drawImage(this.offscreen, 0, 0, (ImageObserver)null);
}
}
public void showStats() {
this.offg.setColor(new Color(60, 60, 60));
this.offg.fillRect(206, 104, 232, 190);
this.offg.setColor(new Color(95, 95, 95));
this.offg.setStroke(new BasicStroke(2.0F));
this.offg.drawRect(207, 105, 230, 190);
this.offg.setFont(new Font("TimesRoman", 1, 14));
int var1 = 120;
if (dmnew.herosheet.hero.flevel > 0) {
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString(dmnew.LEVELNAMES[dmnew.herosheet.hero.flevel - 1] + " Fighter", 218, var1 + 3);
this.offg.setColor(Color.white);
this.offg.drawString(dmnew.LEVELNAMES[dmnew.herosheet.hero.flevel - 1] + " Fighter", 215, var1);
var1 += 15;
}
if (dmnew.herosheet.hero.nlevel > 0) {
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString(dmnew.LEVELNAMES[dmnew.herosheet.hero.nlevel - 1] + " Ninja", 218, var1 + 3);
this.offg.setColor(Color.white);
this.offg.drawString(dmnew.LEVELNAMES[dmnew.herosheet.hero.nlevel - 1] + " Ninja", 215, var1);
var1 += 15;
}
if (dmnew.herosheet.hero.wlevel > 0) {
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString(dmnew.LEVELNAMES[dmnew.herosheet.hero.wlevel - 1] + " Wizard", 218, var1 + 3);
this.offg.setColor(Color.white);
this.offg.drawString(dmnew.LEVELNAMES[dmnew.herosheet.hero.wlevel - 1] + " Wizard", 215, var1);
var1 += 15;
}
if (dmnew.herosheet.hero.plevel > 0) {
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString(dmnew.LEVELNAMES[dmnew.herosheet.hero.plevel - 1] + " Priest", 218, var1 + 3);
this.offg.setColor(Color.white);
this.offg.drawString(dmnew.LEVELNAMES[dmnew.herosheet.hero.plevel - 1] + " Priest", 215, var1);
}
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString("Strength", 218, 200);
this.offg.drawString("Dexterity", 218, 214);
this.offg.drawString("Vitality", 218, 228);
this.offg.drawString("Intelligence", 218, 242);
this.offg.drawString("Wisdom", 218, 256);
this.offg.drawString("Defense", 218, 275);
this.offg.drawString("Resist Magic", 218, 290);
this.offg.drawString("" + dmnew.herosheet.hero.strength, 303, 200);
this.offg.drawString("" + dmnew.herosheet.hero.dexterity, 303, 214);
this.offg.drawString("" + dmnew.herosheet.hero.vitality, 303, 228);
this.offg.drawString("" + dmnew.herosheet.hero.intelligence, 303, 242);
this.offg.drawString("" + dmnew.herosheet.hero.wisdom, 303, 256);
this.offg.drawString("" + dmnew.herosheet.hero.defense, 303, 275);
this.offg.drawString("" + dmnew.herosheet.hero.magicresist, 303, 290);
this.offg.setColor(Color.white);
this.offg.drawString("Strength", 215, 197);
this.offg.drawString("Dexterity", 215, 211);
this.offg.drawString("Vitality", 215, 225);
this.offg.drawString("Intelligence", 215, 239);
this.offg.drawString("Wisdom", 215, 253);
this.offg.drawString("Defense", 215, 272);
this.offg.drawString("Resist Magic", 215, 287);
if (dmnew.herosheet.hero.strengthboost > 0) {
this.offg.setColor(Color.green);
} else if (dmnew.herosheet.hero.strengthboost < 0) {
this.offg.setColor(Color.red);
}
this.offg.drawString("" + dmnew.herosheet.hero.strength, 300, 197);
if (dmnew.herosheet.hero.dexterityboost > 0) {
this.offg.setColor(Color.green);
} else if (dmnew.herosheet.hero.dexterityboost < 0) {
this.offg.setColor(Color.red);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString("" + dmnew.herosheet.hero.dexterity, 300, 211);
if (dmnew.herosheet.hero.vitalityboost > 0) {
this.offg.setColor(Color.green);
} else if (dmnew.herosheet.hero.vitalityboost < 0) {
this.offg.setColor(Color.red);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString("" + dmnew.herosheet.hero.vitality, 300, 225);
if (dmnew.herosheet.hero.intelligenceboost > 0) {
this.offg.setColor(Color.green);
} else if (dmnew.herosheet.hero.intelligenceboost < 0) {
this.offg.setColor(Color.red);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString("" + dmnew.herosheet.hero.intelligence, 300, 239);
if (dmnew.herosheet.hero.wisdomboost > 0) {
this.offg.setColor(Color.green);
} else if (dmnew.herosheet.hero.wisdomboost < 0) {
this.offg.setColor(Color.red);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString("" + dmnew.herosheet.hero.wisdom, 300, 253);
if (dmnew.herosheet.hero.defenseboost > 0) {
this.offg.setColor(Color.green);
} else if (dmnew.herosheet.hero.defenseboost < 0) {
this.offg.setColor(Color.red);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString("" + dmnew.herosheet.hero.defense, 300, 272);
if (dmnew.herosheet.hero.magicresistboost > 0) {
this.offg.setColor(Color.green);
} else if (dmnew.herosheet.hero.magicresistboost < 0) {
this.offg.setColor(Color.red);
} else {
this.offg.setColor(Color.white);
}
this.offg.drawString("" + dmnew.herosheet.hero.magicresist, 300, 287);
}
public void showItem() {
int var1;
int var2;
if (dmnew.inhand.number == 4) {
this.offg.drawImage(dmnew.scrollpic, 156, 104, (ImageObserver)null);
this.offg.setFont(new Font("Courier", 1, 16));
for(var1 = dmnew.inhand.scroll.length; dmnew.inhand.scroll[var1 - 1].equals(""); --var1) {
}
var2 = 188 - var1 * 10;
this.offg.setColor(new Color(30, 30, 30));
for(int var3 = 0; var3 < var1; ++var3) {
this.offg.drawString(dmnew.inhand.scroll[var3], 320 - dmnew.inhand.scroll[var3].length() * 5, var2 + var3 * 20);
}
} else if (dmnew.inhand.number == 5) {
this.offg.drawImage(dmnew.openchest, 156, 104, (ImageObserver)null);
for(var1 = 0; var1 < 12; ++var1) {
if (((Chest)dmnew.inhand).contents[var1] != null) {
if (var1 < 6) {
this.offg.drawImage(((Chest)dmnew.inhand).contents[var1].pic, 227 + var1 * 34, 207, this);
} else {
this.offg.drawImage(((Chest)dmnew.inhand).contents[var1].pic, 227 + (var1 - 6) * 34, 239, this);
}
}
}
} else {
this.offg.setColor(new Color(60, 60, 60));
this.offg.fillRect(208, 106, 228, 142);
this.offg.setColor(new Color(95, 95, 95));
this.offg.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
this.offg.drawOval(231, 111, 50, 50);
this.offg.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
this.offg.drawImage(dmnew.inhand.pic, 240, 120, (ImageObserver)null);
this.offg.setFont(new Font("TimesRoman", 1, 14));
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString(dmnew.inhand.name, 302, 142);
this.offg.drawString((float)((int)(dmnew.inhand.weight * 10.0F + 0.5F)) / 10.0F + " kg", 302, 158);
this.offg.setColor(Color.white);
this.offg.drawString(dmnew.inhand.name, 300, 140);
this.offg.drawString((float)((int)(dmnew.inhand.weight * 10.0F + 0.5F)) / 10.0F + " kg", 300, 156);
if (dmnew.inhand.number == 9) {
if (((Torch)dmnew.inhand).lightboost > 36) {
return;
}
String var4;
if (((Torch)dmnew.inhand).lightboost == 0) {
var4 = "(Burnt Out)";
} else {
var4 = "(Almost Out)";
}
this.offg.setFont(new Font("TimesRoman", 1, 12));
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString(var4, 282, 202);
this.offg.setColor(Color.white);
this.offg.drawString(var4, 280, 200);
return;
}
if (dmnew.inhand.number == 215) {
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString("Stealer of Souls", 281, 206);
this.offg.setColor(new Color(120, 120, 120));
this.offg.drawString("Stealer of Souls", 280, 205);
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString("Slayer of Friends", 281, 224);
this.offg.setColor(new Color(120, 120, 120));
this.offg.drawString("Slayer of Friends", 280, 223);
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString("Destroyer of Balance", 281, 247);
this.offg.setColor(new Color(120, 120, 120));
this.offg.drawString("Destroyer of Balance", 280, 246);
return;
}
if (dmnew.inhand.defense > 0) {
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString("Defense: " + dmnew.inhand.defense, 301, 173);
this.offg.setColor(new Color(250, 100, 100));
this.offg.drawString("Defense: " + dmnew.inhand.defense, 300, 172);
}
if (dmnew.inhand.magicresist > 0) {
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString("Resist Magic: " + dmnew.inhand.magicresist, 301, 186);
this.offg.setColor(new Color(250, 100, 100));
this.offg.drawString("Resist Magic: " + dmnew.inhand.magicresist, 300, 185);
}
var1 = 0;
for(var2 = 0; var2 < dmnew.inhand.functions; ++var2) {
if (dmnew.inhand.charges[var2] > 0 && (dmnew.herosheet.hero.wlevel > 4 && dmnew.inhand.function[var2][1].equals("w") || dmnew.herosheet.hero.plevel > 4 && dmnew.inhand.function[var2][1].equals("p"))) {
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString(dmnew.inhand.function[var2][0] + " charges: " + dmnew.inhand.charges[var2], 251, 206 + var1 * 14);
this.offg.setColor(new Color(120, 120, 255));
this.offg.drawString(dmnew.inhand.function[var2][0] + " charges: " + dmnew.inhand.charges[var2], 250, 205 + var1 * 14);
++var1;
}
}
if (dmnew.herosheet.hero.wlevel > 3 && dmnew.inhand.isbomb || dmnew.herosheet.hero.plevel > 3 && dmnew.inhand.ispotion && !dmnew.inhand.isbomb) {
this.offg.setColor(Color.white);
this.offg.drawString("(", 242, 178);
this.offg.drawString(")", 267, 178);
this.offg.drawImage(dmnew.this.spellsheet.spellsymbol[dmnew.inhand.potioncastpow - 1].getImage(), 251, 168, dmnew.herosheet);
} else if (dmnew.inhand.number == 73) {
this.offg.setColor(new Color(30, 30, 30));
this.offg.drawString("Drinks left: " + ((Waterskin)dmnew.inhand).drinks, 271, 247);
this.offg.setColor(new Color(100, 100, 255));
this.offg.drawString("Drinks left: " + ((Waterskin)dmnew.inhand).drinks, 270, 246);
}
}
}
public void sleepsheet() {
this.offg.setColor(Color.black);
this.offg.fillRect(0, 0, dmnew.herosheet.getSize().width, dmnew.herosheet.getSize().height);
this.offg.setFont(new Font("TimesRoman", 1, 14));
this.offg.setColor(new Color(70, 70, 70));
this.offg.drawString("Sleeping. Click mouse to wake up.", 143, 143);
this.offg.setColor(Color.white);
this.offg.drawString("Sleeping. Click mouse to wake up.", 140, 140);
}
}
class HeroClick extends MouseAdapter {
HeroClick() {
}
public void mousePressed(MouseEvent var1) {
int var2 = var1.getX();
int var3 = var1.getY();
dmnew.Hero var4 = (dmnew.Hero)var1.getSource();
if (dmnew.this.sleeping) {
dmnew.needredraw = true;
dmnew.this.sleeping = false;
dmnew.sleeper = 0;
dmnew.this.spellsheet.setVisible(true);
dmnew.this.weaponsheet.setVisible(true);
if (dmnew.herosheet.hero.isdead) {
dmnew.herosheet.setHero(dmnew.hero[dmnew.leader]);
} else {
dmnew.herosheet.repaint();
}
} else if ((var3 <= 17 || var3 >= 83) && !SwingUtilities.isRightMouseButton(var1)) {
dmnew.Hero var10000;
if (var3 < 18) {
if (dmnew.iteminhand) {
var4.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
}
dmnew.hero[dmnew.leader].isleader = false;
var4.isleader = true;
if (dmnew.hero[0].isleader) {
dmnew.leader = 0;
} else if (dmnew.hero[1].isleader) {
dmnew.leader = 1;
} else if (dmnew.hero[2].isleader) {
dmnew.leader = 2;
} else {
dmnew.leader = 3;
}
dmnew.this.hupdate();
if (dmnew.sheet) {
dmnew.herosheet.repaint();
}
} else {
Item var5;
if (var2 > 55 && var2 < 89) {
if (var4.weapon.number == 215) {
dmnew.message.setMessage("Stormbringer resists...", 4);
return;
}
if (var4.weapon.number == 219 || var4.weapon.number == 261) {
return;
}
if (dmnew.iteminhand) {
var4.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
}
if (var4.weapon != null) {
var4.load -= var4.weapon.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += var4.weapon.weight;
}
if (!dmnew.iteminhand && !var4.weapon.name.equals("Fist/Foot")) {
dmnew.iteminhand = true;
dmnew.inhand = var4.weapon;
var4.weapon = dmnew.fistfoot;
if (dmnew.inhand.number == 9) {
((Torch)dmnew.inhand).putOut();
dmnew.updateDark();
}
if (dmnew.inhand.type == 0 || dmnew.inhand.type == 1 || dmnew.inhand.number == 4) {
dmnew.inhand.unEquipEffect(var4);
}
var4.repaint();
if (dmnew.sheet) {
dmnew.herosheet.repaint();
}
dmnew.this.weaponsheet.update();
dmnew.this.changeCursor();
} else if (dmnew.iteminhand) {
if (var4.weapon.name.equals("Fist/Foot")) {
var4.weapon = dmnew.inhand;
dmnew.iteminhand = false;
if (var4.weapon.number == 9) {
((Torch)var4.weapon).setPic();
dmnew.updateDark();
}
if (dmnew.inhand.type == 0 || dmnew.inhand.type == 1 || dmnew.inhand.number == 4) {
var4.weapon.equipEffect(var4);
}
} else {
var5 = var4.weapon;
var4.weapon = dmnew.inhand;
dmnew.inhand = var5;
if (dmnew.inhand.number == 9) {
((Torch)dmnew.inhand).putOut();
dmnew.updateDark();
}
if (var4.weapon.number == 9) {
((Torch)var4.weapon).setPic();
dmnew.updateDark();
}
if (dmnew.inhand.type == 0 || dmnew.inhand.type == 1 || dmnew.inhand.number == 4) {
dmnew.inhand.unEquipEffect(var4);
}
if (var4.weapon.type == 0 || var4.weapon.type == 1 || var4.weapon.number == 4) {
var4.weapon.equipEffect(var4);
}
}
var4.repaint();
if (dmnew.sheet) {
dmnew.herosheet.repaint();
}
dmnew.this.weaponsheet.update();
dmnew.this.changeCursor();
}
} else if (var2 < 45 && var2 > 11) {
if (dmnew.iteminhand) {
var4.load += dmnew.inhand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
}
if (var4.hand != null) {
var4.load -= var4.hand.weight;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += var4.hand.weight;
}
if (!dmnew.iteminhand && var4.hand != null) {
dmnew.iteminhand = true;
dmnew.inhand = var4.hand;
var4.hand = null;
if (dmnew.inhand.number == 9) {
((Torch)dmnew.inhand).putOut();
dmnew.updateDark();
}
if (dmnew.inhand.type == 1) {
dmnew.inhand.unEquipEffect(var4);
}
var4.repaint();
if (dmnew.sheet) {
dmnew.herosheet.repaint();
}
dmnew.this.changeCursor();
} else if (dmnew.iteminhand) {
if (var4.hand != null) {
var5 = var4.hand;
var4.hand = dmnew.inhand;
dmnew.inhand = var5;
if (dmnew.inhand.number == 9) {
((Torch)dmnew.inhand).putOut();
dmnew.updateDark();
}
if (var4.hand.number == 9) {
((Torch)var4.hand).setPic();
dmnew.updateDark();
}
if (dmnew.inhand.type == 1) {
dmnew.inhand.unEquipEffect(var4);
}
if (var4.hand.type == 1) {
var4.hand.equipEffect(var4);
}
} else {
var4.hand = dmnew.inhand;
dmnew.iteminhand = false;
if (var4.hand.number == 9) {
((Torch)var4.hand).setPic();
dmnew.updateDark();
}
if (dmnew.inhand.type == 1) {
var4.hand.equipEffect(var4);
}
}
var4.repaint();
if (dmnew.sheet) {
dmnew.herosheet.repaint();
}
dmnew.this.changeCursor();
}
}
}
} else if (!dmnew.sheet) {
dmnew.herosheet.setHero((dmnew.Hero)var1.getSource());
dmnew.sheet = true;
dmnew.this.centerlay.show(dmnew.this.centerpanel, "herosheet");
} else {
dmnew.sheet = false;
dmnew.this.centerlay.show(dmnew.this.centerpanel, "dview");
dmnew.this.hupdate();
if (!dmnew.herosheet.hero.equals((dmnew.Hero)var1.getSource())) {
((dmnew.Hero)var1.getSource()).dispatchEvent(var1);
}
}
}
}
class DungClick extends MouseAdapter {
DungClick() {
}
public void mousePressed(MouseEvent var1) {
if (SwingUtilities.isRightMouseButton(var1) && dmnew.numheroes > 0) {
dmnew.herosheet.setHero(dmnew.hero[dmnew.leader]);
dmnew.sheet = true;
dmnew.this.centerlay.show(dmnew.this.centerpanel, "herosheet");
} else {
if (dmnew.clickqueue.isEmpty()) {
dmnew.clickqueue.add(var1.getX() + "," + var1.getY());
}
}
}
public void processClick(int var1, int var2) {
int var3 = dmnew.partyy;
int var4 = dmnew.partyx;
byte var5 = 1;
if (dmnew.facing == 0) {
--var3;
} else if (dmnew.facing == 1) {
--var4;
} else if (dmnew.facing == 2) {
++var3;
} else {
++var4;
}
Object var6;
if (var4 >= 0 && var3 >= 0 && var4 < dmnew.mapwidth && var3 < dmnew.mapheight) {
var6 = dmnew.DungeonMap[dmnew.level][var4][var3];
} else {
var6 = dmnew.outWall;
}
MapObject var7 = dmnew.DungeonMap[dmnew.level][dmnew.partyx][dmnew.partyy];
if (dmnew.numheroes == 0) {
if (var6 instanceof Mirror) {
((MapObject)var6).tryWallSwitch(var1, var2);
}
} else {
dmnew.Hero var10000;
if (dmnew.iteminhand) {
if (var2 < 236) {
dmnew.iteminhand = ((MapObject)var6).tryWallSwitch(var1, var2, dmnew.inhand);
if (dmnew.doorkeyflag) {
dmnew.doorkeyflag = false;
} else if (!dmnew.iteminhand) {
if (dmnew.inhand.number != 71) {
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
} else {
dmnew.iteminhand = true;
}
} else if (var2 < 190 && var1 < 356 && var1 > 94 && (((MapObject)var6).canPassProjs || var6 instanceof Door || var6 instanceof Stairs)) {
dmnew.playSound("swing.wav", -1, -1);
dmnew.inhand.shotpow = dmnew.hero[dmnew.leader].strength / 10 + dmnew.randGen.nextInt(4);
byte var8 = 0;
if (var1 > 224) {
var8 = 1;
}
dmnew.hero[dmnew.leader].gainxp('n', 1);
dmnew.hero[dmnew.leader].vitalize(-dmnew.randGen.nextInt((int)dmnew.inhand.weight + 2));
dmnew.hero[dmnew.leader].wepThrow(dmnew.inhand, var8);
dmnew.iteminhand = false;
dmnew.hero[dmnew.leader].weaponcount = (int)dmnew.inhand.weight + 8;
if (dmnew.hero[dmnew.leader].dexterity < 40) {
++dmnew.hero[dmnew.leader].weaponcount;
if (dmnew.hero[dmnew.leader].dexterity < 30) {
var10000 = dmnew.hero[dmnew.leader];
var10000.weaponcount += 2;
if (dmnew.hero[dmnew.leader].dexterity < 20) {
var10000 = dmnew.hero[dmnew.leader];
var10000.weaponcount += 2;
if (dmnew.hero[dmnew.leader].dexterity < 10) {
var10000 = dmnew.hero[dmnew.leader];
var10000.weaponcount += 4;
}
}
}
} else if (dmnew.hero[dmnew.leader].dexterity > 50) {
--dmnew.hero[dmnew.leader].weaponcount;
if (dmnew.hero[dmnew.leader].dexterity > 70) {
--dmnew.hero[dmnew.leader].weaponcount;
if (dmnew.hero[dmnew.leader].dexterity > 90) {
--dmnew.hero[dmnew.leader].weaponcount;
}
}
}
if (dmnew.hero[dmnew.leader].weaponcount < 1) {
dmnew.hero[dmnew.leader].weaponcount = 1;
}
if (dmnew.hero[dmnew.leader].stamina < dmnew.hero[dmnew.leader].maxstamina / 5 || dmnew.hero[dmnew.leader].load > dmnew.hero[dmnew.leader].maxload) {
var10000 = dmnew.hero[dmnew.leader];
var10000.weaponcount += 4;
}
dmnew.hero[dmnew.leader].repaint();
}
dmnew.this.changeCursor();
} else if (var2 > 235 && var1 > 64 && var1 < 384) {
if (var2 > 278) {
var6 = var7;
var5 = 0;
}
if (((MapObject)var6).canHoldItems) {
if (var1 < 224) {
dmnew.inhand.subsquare = (3 * var5 - dmnew.facing + 4) % 4;
} else {
dmnew.inhand.subsquare = (1 + var5 - dmnew.facing + 4) % 4;
}
dmnew.iteminhand = false;
var10000 = dmnew.hero[dmnew.leader];
var10000.load -= dmnew.inhand.weight;
dmnew.this.changeCursor();
((MapObject)var6).tryFloorSwitch(2);
if (!((MapObject)var6).tryTeleport(dmnew.inhand)) {
((MapObject)var6).addItem(dmnew.inhand);
}
dmnew.needredraw = true;
}
}
} else if (var2 > 235 && var1 > 64 && var1 < 384) {
if (var2 > 278) {
var6 = var7;
var5 = 0;
}
if (((MapObject)var6).canHoldItems && ((MapObject)var6).hasItems) {
int var11;
if (var1 < 224) {
var11 = (3 * var5 - dmnew.facing + 4) % 4;
} else {
var11 = (1 + var5 - dmnew.facing + 4) % 4;
}
if (var5 != 0) {
dmnew.Monster var9 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + var4 + "," + var3 + "," + var11);
if (var9 == null) {
var9 = (dmnew.Monster)dmnew.dmmons.get(dmnew.level + "," + var4 + "," + var3 + "," + 5);
}
if (var9 != null && !var9.isflying) {
return;
}
}
dmnew.inhand = ((MapObject)var6).pickUpItem(var11);
if (dmnew.inhand != null) {
dmnew.needredraw = true;
dmnew.iteminhand = true;
var10000 = dmnew.hero[dmnew.leader];
var10000.load += dmnew.inhand.weight;
if (dmnew.inhand.number == 8 && !dmnew.this.compass.contains(dmnew.inhand)) {
dmnew.this.compass.add(dmnew.inhand);
((Compass)dmnew.inhand).setPic(dmnew.facing);
} else if (dmnew.inhand.number == 5) {
for(int var12 = 0; var12 < 6; ++var12) {
Item var10 = ((Chest)dmnew.inhand).itemAt(var12);
if (var10 != null && var10.number == 8 && !dmnew.this.compass.contains(var10)) {
dmnew.this.compass.add(var10);
((Compass)var10).setPic(dmnew.facing);
}
}
}
dmnew.this.changeCursor();
((MapObject)var6).tryFloorSwitch(3);
}
}
} else {
((MapObject)var6).tryWallSwitch(var1, var2);
if (dmnew.iteminhand && dmnew.inhand.number == 8 && !dmnew.this.compass.contains(dmnew.inhand)) {
dmnew.this.compass.add(dmnew.inhand);
((Compass)dmnew.inhand).setPic(dmnew.facing);
}
dmnew.this.changeCursor();
}
}
}
}
class DungView extends JComponent {
BufferedImage offscreen;
Graphics2D offg;
Graphics2D offg2;
public DungView() {
this.setDoubleBuffered(false);
this.setBackground(Color.black);
this.setSize(448, 326);
}
public void paint(Graphics var1) {
if (dmnew.this.needdrawdungeon || dmnew.nomovement || this.offscreen == null) {
int var2;
int var3;
int var5;
int var6;
int var7;
label141:
switch(dmnew.facing) {
case 0:
for(int var4 = 0; var4 < 4; ++var4) {
var3 = dmnew.partyy - 3 + var4;
for(var5 = 0; var5 < 5; ++var5) {
var2 = dmnew.partyx - 2 + var5;
if (var2 >= 0 && var3 >= 0 && var2 <= dmnew.mapwidth - 1 && var3 <= dmnew.mapheight - 1) {
dmnew.this.visibleg[var4][var5] = dmnew.DungeonMap[dmnew.level][var2][var3];
} else {
dmnew.this.visibleg[var4][var5] = dmnew.outWall;
}
}
}
break;
case 1:
var6 = 0;
while(true) {
if (var6 >= 4) {
break label141;
}
var2 = dmnew.partyx - 3 + var6;
for(var7 = 0; var7 < 5; ++var7) {
var3 = dmnew.partyy + 2 - var7;
if (var2 >= 0 && var3 >= 0 && var2 <= dmnew.mapwidth - 1 && var3 <= dmnew.mapheight - 1) {
dmnew.this.visibleg[var6][var7] = dmnew.DungeonMap[dmnew.level][var2][var3];
} else {
dmnew.this.visibleg[var6][var7] = dmnew.outWall;
}
}
++var6;
}
case 2:
var5 = 0;
while(true) {
if (var5 >= 4) {
break label141;
}
var3 = dmnew.partyy + 3 - var5;
for(var6 = 0; var6 < 5; ++var6) {
var2 = dmnew.partyx + 2 - var6;
if (var2 >= 0 && var3 >= 0 && var2 <= dmnew.mapwidth - 1 && var3 <= dmnew.mapheight - 1) {
dmnew.this.visibleg[var5][var6] = dmnew.DungeonMap[dmnew.level][var2][var3];
} else {
dmnew.this.visibleg[var5][var6] = dmnew.outWall;
}
}
++var5;
}
case 3:
for(var7 = 0; var7 < 4; ++var7) {
var2 = dmnew.partyx + 3 - var7;
for(int var8 = 0; var8 < 5; ++var8) {
var3 = dmnew.partyy - 2 + var8;
if (var2 >= 0 && var3 >= 0 && var2 <= dmnew.mapwidth - 1 && var3 <= dmnew.mapheight - 1) {
dmnew.this.visibleg[var7][var8] = dmnew.DungeonMap[dmnew.level][var2][var3];
} else {
dmnew.this.visibleg[var7][var8] = dmnew.outWall;
}
}
}
}
if (!dmnew.mirrorback) {
this.offg.drawImage(dmnew.back, 0, 0, (ImageObserver)null);
} else {
this.offg.drawImage(dmnew.back, 448, 0, 0, 326, 0, 0, 448, 326, (ImageObserver)null);
}
dmnew.this.visibleg[0][0].drawPic(3, 0, 0, 62, this.offg, this);
dmnew.this.visibleg[0][1].drawPic(3, 1, 0, 62, this.offg, this);
dmnew.this.visibleg[0][4].drawPic(3, 4, 416, 62, this.offg, this);
dmnew.this.visibleg[0][3].drawPic(3, 3, 448, 62, this.offg, this);
dmnew.this.visibleg[0][2].drawPic(3, 2, 148, 62, this.offg, this);
dmnew.this.visibleg[1][1].drawPic(2, 1, 0, 50, this.offg, this);
dmnew.this.visibleg[1][3].drawPic(2, 3, 448, 50, this.offg, this);
dmnew.this.visibleg[1][2].drawPic(2, 2, 120, 50, this.offg, this);
dmnew.this.visibleg[2][1].drawPic(1, 1, 0, 22, this.offg, this);
dmnew.this.visibleg[2][3].drawPic(1, 3, 448, 22, this.offg, this);
if (dmnew.magicvision > 0 && !(dmnew.this.visibleg[2][2] instanceof Floor) && !(dmnew.this.visibleg[2][2] instanceof Door) && !(dmnew.this.visibleg[2][2] instanceof Stairs)) {
dmnew.this.visibleg[2][2].drawPic(1, 2, 64, 22, this.offg2, this);
} else {
dmnew.this.visibleg[2][2].drawPic(1, 2, 64, 22, this.offg, this);
}
dmnew.this.visibleg[3][1].drawPic(0, 1, 0, 0, this.offg, this);
dmnew.this.visibleg[3][3].drawPic(0, 3, 448, 0, this.offg, this);
dmnew.this.visibleg[3][2].drawPic(0, 2, 0, 0, this.offg, this);
if (!dmnew.NODARK && dmnew.level > 0 && dmnew.darkfactor < 255) {
this.offg.setColor(new Color(0, 0, 0, 255 - dmnew.darkfactor));
this.offg.fillRect(0, 0, 448, 326);
}
dmnew.this.needdrawdungeon = false;
}
var1.drawImage(this.offscreen, 0, 0, (ImageObserver)null);
}
}
class FluxCage {
int level;
int x;
int y;
int counter;
boolean mirrored;
public FluxCage(int var2, int var3, int var4) {
dmnew.FluxCage var5 = (dmnew.FluxCage)dmnew.fluxcages.get(var2 + "," + var3 + "," + var4);
if (var5 != null) {
var5.counter = 0;
var5.mirrored = !var5.mirrored;
} else {
this.level = var2;
this.x = var3;
this.y = var4;
this.counter = 0;
dmnew.fluxcages.put(var2 + "," + var3 + "," + var4, this);
dmnew.fluxchanging = true;
}
}
public boolean update() {
if (dmnew.DungeonMap[this.level][this.x][this.y] instanceof Wall) {
return false;
} else {
++this.counter;
boolean var1;
if (this.counter > 100) {
var1 = false;
} else {
var1 = true;
}
if (this.level == dmnew.level) {
int var2 = this.x - dmnew.partyx;
if (var2 < 0) {
var2 *= -1;
}
int var3 = this.y - dmnew.partyy;
if (var3 < 0) {
var3 *= -1;
}
if (var2 < 4 && var3 < 4 && this.counter % 3 == 0) {
this.mirrored = !this.mirrored;
dmnew.needredraw = true;
}
}
return var1;
}
}
}
class PoisonCloud {
int level;
int x;
int y;
int stage;
int stagecounter;
public PoisonCloud(int var2, int var3, int var4, int var5) {
if (dmnew.DungeonMap[var2][var3][var4].hasCloud) {
Iterator var7 = dmnew.cloudstochange.iterator();
while(var7.hasNext()) {
dmnew.PoisonCloud var6 = (dmnew.PoisonCloud)var7.next();
if (var6.x == var3 && var6.y == var4) {
var6.stagecounter = 0;
var6.stage += var5;
if (var6.stage > 6) {
var6.stage = 6;
}
break;
}
}
} else {
this.level = var2;
this.x = var3;
this.y = var4;
this.stage = var5;
this.stagecounter = 0;
dmnew.cloudstochange.add(this);
dmnew.DungeonMap[this.level][var3][var4].hasCloud = true;
dmnew.cloudchanging = true;
}
}
public boolean update() {
if (dmnew.DungeonMap[this.level][this.x][this.y] instanceof Wall && dmnew.DungeonMap[this.level][this.x][this.y].mapchar != '>' && dmnew.DungeonMap[this.level][this.x][this.y].mapchar != '2') {
dmnew.DungeonMap[this.level][this.x][this.y].hasCloud = false;
return false;
} else {
++this.stagecounter;
boolean var1 = true;
if (this.stagecounter > 6) {
--this.stage;
this.stagecounter = 0;
}
int var3;
if (this.stage > 0) {
if (dmnew.DungeonMap[this.level][this.x][this.y].hasMons) {
dmnew.Monster var2;
for(var3 = 0; var3 < 4; ++var3) {
var2 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + var3);
if (var2 != null && !var2.isImmaterial) {
var2.damage(4 * this.stage / 3, 2);
}
}
var2 = (dmnew.Monster)dmnew.dmmons.get(this.level + "," + this.x + "," + this.y + "," + 5);
if (var2 != null && !var2.isImmaterial) {
var2.damage(4 * this.stage / 3, 2);
}
} else if (dmnew.DungeonMap[this.level][this.x][this.y].hasParty) {
for(var3 = 0; var3 < dmnew.numheroes; ++var3) {
dmnew.hero[var3].damage(4 * this.stage / 3, 2);
}
}
} else {
dmnew.DungeonMap[this.level][this.x][this.y].hasCloud = false;
var1 = false;
}
if (!dmnew.needredraw && this.level == dmnew.level) {
int var4 = this.x - dmnew.partyx;
if (var4 < 0) {
var4 *= -1;
}
var3 = this.y - dmnew.partyy;
if (var3 < 0) {
var3 *= -1;
}
if (var4 < 4 && var3 < 4) {
dmnew.needredraw = true;
}
}
return var1;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment