Armor.java

jmud-0.11/src/Armor.java · 1.1 KB

From the archive jmud-0_11.tgz

Download the archive   « Back to the archive contents

import java.io.BufferedWriter;
import java.io.IOException;

import misc.Separators;

class Armor extends Item {

  private int physical;
  private int mental;
  private int mystic;

  Armor(ArmorProto a) {
    super(a);

    physical = a.physical;
    mental   = a.mental;
    mystic   = a.mystic;
  }

  protected void finalize() {
    super.finalize();
  }

  int getType() {
    return T_ARMOR;
  }

  /////////////
  // Sheetable:

  public String getSheet() {
    return super.getSheet() + Separators.NL +
      "Proteção: Física [" + physical + "]  Mental [" + mental + "]  Mística [" + mystic + "]";
  }

    //
    //////////////

    void save(BufferedWriter writer) throws IOException {
	super.save(writer);
	writer.write(physical + " " + mental + " " + mystic); writer.newLine();
    }

    void affectEquipper(Char ch) {
	ch.addToResistancePool(Char.C_PHY, physical);
	ch.addToResistancePool(Char.C_MEN, mental);
	ch.addToResistancePool(Char.C_MYS, mystic);
    }

    void unnaffectEquipper(Char ch) {
	ch.addToResistancePool(Char.C_PHY, -physical);
	ch.addToResistancePool(Char.C_MEN, -mental);
	ch.addToResistancePool(Char.C_MYS, -mystic);
    }

}

Site Stats

Snippets: 1791
Codebases: 571