[ogs-changes] dist/java/ogs/spells/conjurations CureWounds.java,NONE,1.1 package.html,NONE,1.1
Status: Alpha
Brought to you by:
elemings
|
From: <ele...@us...> - 2003-04-04 20:38:10
|
Update of /cvsroot/ogs/dist/java/ogs/spells/conjurations
In directory sc8-pr-cvs1:/tmp/cvs-serv9450/java/ogs/spells/conjurations
Added Files:
CureWounds.java package.html
Log Message:
See ChangeLog files (Apr 3-4) for details.
--- NEW FILE: CureWounds.java ---
/*
* CureWounds.java -- class declaration for cure wounds spells
* Copyright (C) 2003 Eric Lemings <ele...@us...>
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA
*
* RCS: $Id: CureWounds.java,v 1.1 2003/04/04 20:22:59 elemings Exp $
*/
package ogs.spells.conjurations;
import java.util.Vector;
import ogs.core.Creature;
import ogs.magic.Component;
import ogs.magic.Range;
import ogs.magic.School;
import ogs.magic.Subschool;
import ogs.spells.Conjuration;
/**
* A spell that heals damage to living creatures. Cure wounds spells
* have the opposite effect on undead creatures: the spell causes damage
* to undead creatures instead of curing it. Cure wounds spells can
* have different degrees. The degree of the spell determines how much
* damage is healed (or dealt in the case of undead creatures).
*/
public class CureWounds extends Conjuration {
private byte casterLevel;
private Creature target;
private byte degree;
/** Cures 1 point of damage. */
public static final byte MINOR = 1;
/**
* Cures 1d8 points of damage plus 1 per caster level (up to 5).
*/
public static final byte LIGHT = 2;
/**
* Cures 2d8 points of damage plus 1 per caster level (up to 10).
*/
public static final byte MODERATE = 3;
/**
* Cures 3d8 points of damage plus 1 per caster level (up to 15).
*/
public static final byte SERIOUS = 4;
/**
* Cures 4d8 points of damage plus 1 per caster level (up to 20).
*/
public static final byte CRITICAL = 5;
/**
* Create a new Cure Minor Wounds spell.
*
* @param casterLevel Level of caster.
* @return A new Cure Minor Wounds spell.
*/
public CureWounds createMinor (byte casterLevel) {
return (new CureWounds (casterLevel, MINOR));
}
/**
* Create a new Cure Light Wounds spell.
*
* @param casterLevel Level of caster.
* @return A new Cure Light Wounds spell.
*/
public CureWounds createLight (byte casterLevel) {
return (new CureWounds (casterLevel, LIGHT));
}
/**
* Create a new Cure Moderate Wounds spell.
*
* @param casterLevel Level of caster.
* @return A new Cure Moderate Wounds spell.
*/
public CureWounds createModerate (byte casterLevel) {
return (new CureWounds (casterLevel, MODERATE));
}
/**
* Create a new Cure Serious Wounds spell.
*
* @param casterLevel Level of caster.
* @return A new Cure Serious Wounds spell.
*/
public CureWounds createSerious (byte casterLevel) {
return (new CureWounds (casterLevel, SERIOUS));
}
/**
* Create a new Cure Critical Wounds spell.
*
* @param casterLevel Level of caster.
* @return A new Cure Critical Wounds spell.
*/
public CureWounds createCritical (byte casterLevel) {
return (new CureWounds (casterLevel, CRITICAL));
}
/**
* Create a new cure wounds spell.
*
* @param casterLevel Level of caster.
* @param degree Degree of cure wounds spell.
*/
private CureWounds (byte casterLevel, byte degree) {
this.casterLevel = casterLevel;
this.target = null;
this.degree = degree;
}
/**
* Determine the school (or subschool) for this type of spell. All
* cure wounds spells are in the Healing subschool of the Conjuration
* school.
*
* @return Healing subshool of the Conjuration school.
*/
public School getSchool () {
return (new Subschool (Subschool.HEALING));
}
/**
* Determine the components needed to cast this spell. The components
* of a cure wounds spell are normally verbal and somantic. Silence
* Spell and Still spell feats however may negate one or both of these
* components.
*
* @return Array of components for this spell.
*/
public Vector getComponents () {
Vector components = new Vector ();
// TODO: Determine if Silence or Still metamagic feats apply.
components.add (Component.Verbal ());
components.add (Component.Somantic());
return (components);
}
/**
* Determine the range of this spell. Cure wounds spells always have
* touch range.
*
* @return Touch range.
*/
public Range getRange () {
return (Range.Touch ());
}
/**
* Determine the target of this spell. The target of this spell is
* the entity that will be healed (or damaged). If the entity is not
* a creature, the spell does nothing. If the spell does not yet have
* a target, the function returns NULL.
*
* @return Target of spell or NULL if spell is not targeted.
*/
public Creature getTarget () {
return (this.target);
}
/**
* Determine the degree of this cure wounds spell.
*
* #return Degree of cure wounds spell.
*/
public byte getDegree () {
return (this.degree);
}
/**
* Cast this spell. When a cure wounds spell is cast, this function
* first checks to see if there is a target. If there is not target,
* nothing happens. (In other words, this function does nothing).
* Otherwise, the target is checked to see if it is a creature. If
* the target is not a creature, nothing happens. If the target is a
* creature, this function rolls a random number of hit points
* according to the degree of spell. Next, the creature is checked to
* see if it is undead. If it is, a Will save is rolled for the
* undead creature. If the save fails, the points are subtracted from
* the current hit points of the undead creature. If the creature is
* not undead, the points are added to the current hit points of the
* creature (up to its maximum points).
*/
public void castSpell () {
// TODO: Translate C++ implementation.
}
}
--- NEW FILE: package.html ---
<HTML>
<HEAD>
<TITLE>ogs.spells.conjurations (Open Gaming System)</TITLE>
</HEAD>
<BODY>
A collection of common Conjuration spells.
</BODY>
</HTML>
|