Effect.java

jmud-0.11/src/Effect.java · 526 B

From the archive jmud-0_11.tgz

Download the archive   « Back to the archive contents

abstract class Effect implements Sheetable {

  protected int        theDuration;
  protected Affectable theVictim;

  Effect(int duration, Affectable vict) {
    theDuration = duration;
    theVictim   = vict;
  }

  void update() {
    --theDuration;
  }

  boolean hasExpired() {
    return theDuration <= 0;
  }

  void apply(boolean quiet) {
    theVictim.insertEffect(this);
  }

  void undo(boolean quiet) {
    theVictim.removeEffect(this);
  }

  public String getSheet() {
    return theDuration + " hora(s)";
  }
}

Site Stats

Snippets: 1791
Codebases: 571