Weapon.java

jmud-0.11/src/Weapon.java · 1.3 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;
import string.StrUtil;

class Weapon extends Item {

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

  private int damageType;

  Weapon(WeaponProto w) {
    super(w);

    physical   = w.physical;
    mental     = w.mental;
    mystic     = w.mystic;

    damageType = w.damageType;
  }

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

  int getType() {
    return T_WEAPON;
  }

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

  public String getSheet() {
    return super.getSheet() + Separators.NL +
      "Dano: Físico [" + physical + "]  Mental [" + mental + "]  Místico [" + mystic + "]" + Separators.NL + "Tipo: " + StrUtil.listFlags(damageType, Damage.labels);
  }

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

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

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

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

Site Stats

Snippets: 1791
Codebases: 571