[ogs-changes] dist/java/ogs/feats Alertness.java,NONE,1.1 AllWeapons.java,NONE,1.1 ImprovedSave.java
Status: Alpha
Brought to you by:
elemings
Update of /cvsroot/ogs/dist/java/ogs/feats
In directory sc8-pr-cvs1:/tmp/cvs-serv9450/java/ogs/feats
Modified Files:
ArmorProficiency.java ImprovedInitiative.java
ShieldProficiency.java Toughness.java WeaponProficiency.java
Added Files:
Alertness.java AllWeapons.java ImprovedSave.java
SingleWeapon.java
Removed Files:
ExoticWeapon.java GreatFortitude.java HeavyArmor.java
IronWill.java LightArmor.java LightningReflexes.java
MartialWeapon.java MediumArmor.java SimpleWeapon.java
Log Message:
See ChangeLog files (Apr 3-4) for details.
--- NEW FILE: Alertness.java ---
/*
* Alertness.java -- class declaration for Alertness feats
* 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: Alertness.java,v 1.1 2003/04/04 20:22:54 elemings Exp $
*/
package ogs.feats;
import ogs.support.Object;
import ogs.core.Feat;
import ogs.core.Modifier;
/**
* A feat that adds a +2 bonus to all Listen and Spot skill checks.
*/
public class Alertness extends Feat {
private static Modifier modifier = new Modifier (+2);
/**
* Create a new Alertness feat.
*/
public Alertness () {
super ();
}
/**
* Determine the compatability of this feat. Alertness feats are
* exclusive feats.
*
* @return Feat.EXCLUSIVE
*/
public int getCompatibility () {
return (Feat.EXCLUSIVE);
}
/**
* Determine the group that this feat belongs to. Alertness feats are
* general feats.
*
* @return Feat.GENERAL
*/
public int getGroup () {
return (Feat.GENERAL);
}
/**
* Determine if this feat can be attached to an object. Since
* Alertness feats are exclusive feats, they can only be attached to
* objects that do not already have this feat.
*
* @param object Object to attach this feature to.
* @return True if the feature is attached to the object.
*/
protected boolean canAttach (Object object) {
return (super.canAttach (object) &&
!super.findFeat (object, getClass ()));
}
/**
* Attach this feat to an object. This function adds a +2 bonus to
* Listen and Spot skill checks if the creature has either or both of
* these skills.
*
* @param object Object to attach this feat to.
* @return True if feat is attached to object.
*/
public boolean attachObject (Object object) {
boolean canAttach = super.attachObject (object);
if (canAttach) {
addSkillModifier (object);
}
return (canAttach);
}
/**
* Add modifier of this feat to Listen and Spot skills.
*
* @param object Object to add skill modifier to.
*/
private void addSkillModifier (Object object) {
}
/**
* Detach this feat from an object.
*
* @return True if this feat is detached from the object.
*/
public boolean detachObject () {
Object object = getObject ();
boolean canDetach = super.detachObject ();
if (canDetach) {
removeSkillModifier (object);
}
return (canDetach);
}
/**
* Remove modifier of this feat from Listen and Spot skills.
*/
private void removeSkillModifier (Object object) {
}
}
--- NEW FILE: AllWeapons.java ---
/*
* Alertness.java -- class declaration for Alertness feats
* 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: AllWeapons.java,v 1.1 2003/04/04 20:22:54 elemings Exp $
*/
package ogs.feats;
import ogs.core.Creature;
import ogs.feats.WeaponProficiency;
import ogs.items.Weapon;
/**
* A weapon proficiency for all weapons of one group. Simple Weapon
* Proficiency is a general feat that indicates that a creature is
* proficient with all simple weapons. Some cclasses are also
* proficient with all martial weapons. Exotic weapons can only be
* selected as single weapons. This class can be used instead of the
* @c SingleWeapon class to indicate that a creature is proficient with
* all weapons in one of these groups.
*
* @see SingleWeapon
*/
public class AllWeapons extends WeaponProficiency {
private int proficiency;
/**
* Create a new Simple Weapon Proficiency feat.
*
* @return A new Simple Weapon Proficiency feat.
*/
public static AllWeapons createSimple () {
return (new AllWeapons (Weapon.SIMPLE));
}
/**
* Create a new Martial Weapon Proficiency feat.
*
* @return A new Simple Weapon Proficiency feat.
*/
public static AllWeapons createMartial () {
return (new AllWeapons (Weapon.MARTIAL));
}
/**
* Create a new All Weapons Proficiency feat.
*/
private AllWeapons (int proficiency) {
this.proficiency = proficiency;
}
/**
* Determine the compatability of this feat. Weapon proficiency feats
* for all weapons are exclusive feats.
*
* @return Feat.EXCLUSIVE
*/
public int getCompatibility () {
return (Feat.EXCLUSIVE);
}
/**
* Determine weapon proficiency that this feat applies to.
*
* @return Proficiency of weapon: SIMPLE or MARTIAL.
*/
public int getProficiency () {
return (this.proficiency);
}
/**
* Determine if this feat can be attached to an object. An all weapons
* proficiency feat can be attached to a creature if the creature does
* not already have this feat.
*
* @param object Object to attach this feat to.
* @return True if this feat is attached to object.
*/
private boolean canAttach (Object object) {
if (!super.canAttach (object)) {
return (false);
}
Creature creature = (Creature) object;
Vector feats = creature.getFeats ();
for (int i = 0; i < feats.size (); ++i) {
AllWeapons allWeapons = null;
try {
allWeapons = (AllWeapons) feats.elementAt (i);
} catch (ClassCastException exception) {
// Object is not an All Weapons feat. Skip it.
}
if (allWeapons != null) {
if (allWeapons.getProficiency () == this.proficiency) {
return (false);
}
}
}
return (true);
}
/**
* Determine if a weapon is a proficient weapon. A proficient weapon
* is a weapon that a creature with this feat is proficient with. If
* this feat is not attached to a creature, the weapon is not a
* proficient weapon.
*
* @return True if weapon is a proficient weapon.
*/
public boolean isProficient (Weapon weapon) {
return (weapon.getProficiency () == this.proficiency);
}
}
--- NEW FILE: ImprovedSave.java ---
/*
* Alertness.java -- class declaration for Alertness feats
* 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: ImprovedSave.java,v 1.1 2003/04/04 20:22:54 elemings Exp $
*/
package ogs.feats;
import java.util.Collection;
import java.util.Iterator;
import ogs.support.Object;
import ogs.core.Creature;
import ogs.core.Feat;
import ogs.core.Modifier;
import ogs.core.Saves;
/**
* A feat that adds a +2 bonus to saving throws. Improved Save feats
* come in three varieties: Great Fortitude, Iron Will, and Lightning
* Reflexes. Each variety applies to a different type of save.
*/
public class ImprovedSave extends Feat {
/** Bonus is added to all Fortitude saves. */
public static final byte GREAT_FORTITUDE = 1;
/** Bonus is added to all Will saves. */
public static final byte IRON_WILL = 2;
/** Bonus is added to all Reflex saves. */
public static final byte LIGHTNING_REFLEXES = 3;
/**
* Create a new Great Fortitude feat.
*
* @return A new Great Fortitude feat.
*/
public static ImprovedSave createGreatFortitude () {
return (new ImprovedSave (GREAT_FORTITUDE));
}
/**
* Create a new Iron Will feat.
*
* @return A new Iron Will feat.
*/
public static ImprovedSave createIronWill () {
return (new ImprovedSave (IRON_WILL));
}
/**
* Create a new Lightning Reflexes feat.
*
* @return A new Lightning Reflexes feat.
*/
public static ImprovedSave createLightningReflexes () {
return (new ImprovedSave (LIGHTNING_REFLEXES));
}
private byte type;
private Modifier modifier;
/**
* Create a new Improved Save feat.
*
* @param type One of the three types of improved saves.
*/
private ImprovedSave (byte type) {
this.type = type;
this.modifier = new Modifier (+2);
}
/**
* Determine the compatability of this feat. Improved Save feats are
* exclusive feats.
*
* @return Feat.EXCLUSIVE
*/
public int getCompatibility () {
return (Feat.EXCLUSIVE);
}
/**
* Determine the group that this feat belongs to. Improved Save feats
* are general feats.
*
* @return Feat.GENERAL
*/
public int getGroup () {
return (Feat.GENERAL);
}
/**
* Determine the type of this Improved Save feat.
*
* @return GREAT_FORTITUDE, IRON_WILL, or LIGHTNING_REFLEXES.
*/
public int getType () {
return (this.type);
}
/**
* Determine if this feat can be attached to an object. An improved
* save feat can only be attached to a creature if the creature does
* not already have this feat.
*
* @param object Object to attach this feature to.
* @return True if the feature is attached to the object.
*/
protected boolean canAttach (Object object) {
if (! super.canAttach (object)) {
return (false);
}
Creature creature = (Creature) object;
Collection feats = creature.getFeats ();
Iterator itor = feats.iterator ();
while (itor.hasNext ()) {
ImprovedSave improvedSave = null;
try {
improvedSave = (ImprovedSave) itor.next ();
} catch (ClassCastException exception) {
// Object is not an Improved Save feat. Skip it.
}
if (improvedSave != null) {
if (improvedSave.getType () == this.type) {
return (false);
}
}
}
return (true);
}
/**
* Attach this Improved Save feat to a creature.
*
* @param object Creature to attach Improved Save to.
* @return True if feat is attached to creature.
*/
public boolean attachObject (Object object) {
boolean attached = super.attachObject (object);
if (attached) {
Creature creature = (Creature) object;
Saves saves = creature.getSaves ();
if (this.type == GREAT_FORTITUDE) {
saves.fort.addModifier (this.modifier);
} else if (this.type == IRON_WILL) {
saves.will.addModifier (this.modifier);
} else if (this.type == LIGHTNING_REFLEXES) {
saves.ref.addModifier (this.modifier);
}
}
return (attached);
}
/**
* Detach this Improved Save feat from a creature.
*
* @return True if feat is detached from creature.
*/
public boolean detachObject () {
Creature creature = (Creature) getObject ();
boolean detached = detachObject ();
if (creature != null && detached) {
Saves saves = creature.getSaves ();
if (this.type == GREAT_FORTITUDE) {
saves.fort.removeModifier (this.modifier);
} else if (this.type == IRON_WILL) {
saves.will.removeModifier (this.modifier);
} else if (this.type == LIGHTNING_REFLEXES) {
saves.ref.removeModifier (this.modifier);
}
}
return (detached);
}
}
--- NEW FILE: SingleWeapon.java ---
/*
* Alertness.java -- class declaration for Alertness feats
* 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: SingleWeapon.java,v 1.1 2003/04/04 20:22:55 elemings Exp $
*/
package ogs.feats;
import ogs.core.Feat;
import ogs.feats.WeaponProficiency;
import ogs.items.Weapon;
/**
* A weapon proficiency for a single weapon. Some classes are
* automatically proficient only with specific types of weapons, some of
* which are simple weapons. Single weapon proficiency feats for
* martial weapons and exotic weapons can also be taken optionally.
*/
public class SingleWeapon extends WeaponProficiency {
private Class weaponClass = null;
/**
* Create a new Weapon Proficiency feat for a single weapon.
*
* @param weaponClass A class of weapon.
* @throws ClassCastException If class is not a weapon class.
*/
public SingleWeapon (Class weaponClass) {
if (! Weapon.class.isAssignableFrom (weaponClass)) {
String s = "weaponClass (" + weaponClass.toString () +
") is not a weapon class.";
throw new ClassCastException (s);
} else {
this.weaponClass = weaponClass;
}
}
/**
* Determine the compatability of this feat. Single weapon
* proficiency feats are repeatable feats. Each time a single weapon
* feat is taken, it applies to a new weapon.
*
* @return Feat.EXCLUSIVE
*/
public int getCompatibility () {
return (Feat.REPEATABLE);
}
/**
* Determine proficiency of weapon that this feat applies to.
*
* @return Proficiency of weapon: SIMPLE, MARTIAL, or EXOTIC.
*/
public int getProficiency () {
Weapon weapon = null;
try {
weapon = (Weapon) weaponClass.newInstance ();
} catch (Exception exception) {
// Shouldn't happen but has to be caught at least.
}
return (weapon == null? 0: weapon.getProficiency ());
}
/**
* Determine if a weapon is a proficient weapon. A proficient weapon
* is a weapon that a creature with this feat is proficient with. If
* this feat is not attached to a creature, the weapon is not a
* proficient weapon.
*
* @return True if weapon is a proficient weapon.
*/
public boolean isProficient (Weapon weapon) {
return (weaponClass.isInstance (weapon));
}
}
Index: ArmorProficiency.java
===================================================================
RCS file: /cvsroot/ogs/dist/java/ogs/feats/ArmorProficiency.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ArmorProficiency.java 27 Feb 2003 01:24:44 -0000 1.2
--- ArmorProficiency.java 4 Apr 2003 20:22:54 -0000 1.3
***************
*** 23,32 ****
package ogs.feats;
import ogs.core.Feat;
/**
! * A feat that allows the use of armor without penalties.
*/
! public abstract class ArmorProficiency extends Feat {
/**
* Determine the compatibility of this type of feat. Armor
--- 23,84 ----
package ogs.feats;
+ import java.util.Collection;
+ import java.util.Iterator;
+
+ import ogs.support.Object;
+ import ogs.core.Creature;
import ogs.core.Feat;
+ import ogs.items.Armor;
/**
! * A feat that allows the effective use of armor. A creature that uses
! * armor without begin proficient with it suffers the armor check
! * penalty to attack rolls and skill checks that involve moving
! * including Ride. A creature must be proficient with light armor
! * before the creature can be proficient with medium armor. (The Light
! * Armor Proficiency feat is a prerequisite for the Medium Armor
! * Proficiency feat.) A creature must be proficient with medium armor
! * before the creature can be proficient with heavy armor.
*/
! public class ArmorProficiency extends Feat {
!
! private int proficiency;
!
! /**
! * Create a new Light Armor Proficiency feat.
! *
! * @return A new Light Armor Proficiency feat.
! */
! public static ArmorProficiency createLight () {
! return (new ArmorProficiency (Armor.LIGHT));
! }
!
! /**
! * Create a new Medium Armor Proficiency feat.
! *
! * @return A new Medium Armor Proficiency feat.
! */
! public static ArmorProficiency createMedium () {
! return (new ArmorProficiency (Armor.MEDIUM));
! }
!
! /**
! * Create a new Heavy Armor Proficiency feat.
! *
! * @return A new Heavy Armor Proficiency feat.
! */
! public static ArmorProficiency createHeavy () {
! return (new ArmorProficiency (Armor.HEAVY));
! }
!
! /**
! * Create a new armor proficiency feat.
! *
! * @param proficiency Proficiency of armor: LIGHT, MEDIUM, or HEAVY.
! */
! protected ArmorProficiency (int proficiency) {
! this.proficiency = proficiency;
! }
!
/**
* Determine the compatibility of this type of feat. Armor
***************
*** 38,41 ****
--- 90,187 ----
public int getCompatibility () {
return (Feat.EXCLUSIVE);
+ }
+
+ /**
+ * Determine the group that this feat belongs to. Armor proficiency
+ * feats are general feats.
+ *
+ * @return Feat.GENERAL
+ */
+ public int getGroup () {
+ return (Feat.GENERAL);
+ }
+
+ /**
+ * Determine the proficiency of this feat.
+ *
+ * @return Type of armor proficiency: LIGHT, MEDIUM, or HEAVY.
+ */
+ public int getProficiency () {
+ return (this.proficiency);
+ }
+
+ /**
+ * Determine if this feat can be attached to an object. An armor
+ * proficiency feat can be attached to a creature if the creature does
+ * not already have this type of armor proficiency feat and already
+ * has the prerequisite feats (if any).
+ *
+ * @param object Object to attach this feat to.
+ * @return True if this feat is attached to object.
+ */
+ protected boolean canAttach (Object object) {
+ if (! super.canAttach (object)) {
+ return (false);
+ }
+
+ boolean attach = false;
+ Creature creature = (Creature) object;
+ if (this.proficiency == Armor.LIGHT) {
+ attach = !findArmorProficiency (creature, Armor.LIGHT);
+ } else if (this.proficiency == Armor.MEDIUM) {
+ attach = findArmorProficiency (creature, Armor.LIGHT) &&
+ !findArmorProficiency (creature, Armor.MEDIUM);
+ } else if (this.proficiency == Armor.HEAVY) {
+ attach = findArmorProficiency (creature, Armor.MEDIUM) &&
+ !findArmorProficiency (creature, Armor.HEAVY);
+ }
+
+ return (attach);
+ }
+
+ /**
+ * Determine if a creature has an armor proficiency.
+ *
+ * @param creature Creature to be checked for proficiency.
+ * @param proficiency Proficiency of armor.
+ * @return True if creature has armor proficiency.
+ */
+ private boolean findArmorProficiency (Creature creature, int proficiency) {
+ Collection feats = creature.getFeats ();
+ Iterator itor = feats.iterator ();
+ boolean found = false;
+
+ while (!found && itor.hasNext ()) {
+ ArmorProficiency armorProficiency = null;
+ try {
+ armorProficiency = (ArmorProficiency) itor.next ();
+ } catch (ClassCastException exception) {
+ // Ignore it.
+ }
+
+ if (armorProficiency != null) {
+ found = armorProficiency.getProficiency () == proficiency;
+ }
+ }
+
+ return (found);
+ }
+
+ /**
+ * Determine if armor is proficient armor. Proficient armor is armor
+ * that a creature is proficient with. If this armor proficiency feat
+ * is not attached to a creature, then the armor is not proficient
+ * armor.
+ *
+ * @param armor A suit of armor.
+ * @return True if armor is proficient armor.
+ */
+ public boolean isProficient (Armor armor) {
+ int proficiency = armor.getProficiency ();
+ return (getObject () != null &&
+ this.proficiency == Armor.HEAVY ||
+ (this.proficiency == Armor.MEDIUM &&
+ proficiency != Armor.HEAVY) ||
+ proficiency == Armor.LIGHT);
}
}
Index: ImprovedInitiative.java
===================================================================
RCS file: /cvsroot/ogs/dist/java/ogs/feats/ImprovedInitiative.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ImprovedInitiative.java 27 Feb 2003 01:24:44 -0000 1.2
--- ImprovedInitiative.java 4 Apr 2003 20:22:54 -0000 1.3
***************
*** 48,51 ****
--- 48,61 ----
/**
+ * Determine the group that this feat belongs to. Improved Initiative
+ * feats are general feats.
+ *
+ * @return Feat.GENERAL
+ */
+ public int getGroup () {
+ return (Feat.GENERAL);
+ }
+
+ /**
* Attach this feat to a creature. This method adds the initative
* modifier to the list of intiative modifiers for the creature.
Index: ShieldProficiency.java
===================================================================
RCS file: /cvsroot/ogs/dist/java/ogs/feats/ShieldProficiency.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ShieldProficiency.java 27 Feb 2003 01:24:44 -0000 1.2
--- ShieldProficiency.java 4 Apr 2003 20:22:54 -0000 1.3
***************
*** 33,38 ****
/**
* Determine the compatibility of this type of feat. Shield profiency
! * feats are exclusive feats: only one instance of the feat can be
! * attached to a creature at one time.
*
* @return Feat.EXCLUSIVE.
--- 33,37 ----
/**
* Determine the compatibility of this type of feat. Shield profiency
! * feats are exclusive feats.
*
* @return Feat.EXCLUSIVE.
***************
*** 40,43 ****
--- 39,52 ----
public int getCompatibility () {
return (Feat.EXCLUSIVE);
+ }
+
+ /**
+ * Determine the group that this feat belongs to. Shield Proficiency
+ * feats are general feats.
+ *
+ * @return Feat.GENERAL
+ */
+ public int getGroup () {
+ return (Feat.GENERAL);
}
Index: Toughness.java
===================================================================
RCS file: /cvsroot/ogs/dist/java/ogs/feats/Toughness.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Toughness.java 27 Feb 2003 01:24:44 -0000 1.2
--- Toughness.java 4 Apr 2003 20:22:55 -0000 1.3
***************
*** 32,37 ****
/**
* Determine the compatibility of this type of feat. Toughness feats
! * are exclusive feats: only one instance of the feat can be attached
! * to a creature at one time.
*
* @return Feat.EXCLUSIVE.
--- 32,36 ----
/**
* Determine the compatibility of this type of feat. Toughness feats
! * are exclusive feats.
*
* @return Feat.EXCLUSIVE.
***************
*** 39,42 ****
--- 38,51 ----
public int getCompatibility () {
return (Feat.EXCLUSIVE);
+ }
+
+ /**
+ * Determine the group that this feat belongs to. Toughness feats are
+ * general feats.
+ *
+ * @return Feat.GENERAL
+ */
+ public int getGroup () {
+ return (Feat.GENERAL);
}
Index: WeaponProficiency.java
===================================================================
RCS file: /cvsroot/ogs/dist/java/ogs/feats/WeaponProficiency.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** WeaponProficiency.java 27 Feb 2003 01:24:44 -0000 1.2
--- WeaponProficiency.java 4 Apr 2003 20:22:55 -0000 1.3
***************
*** 23,80 ****
package ogs.feats;
- import java.lang.reflect.InvocationTargetException;
- import java.lang.reflect.Method;
-
import ogs.core.Feat;
import ogs.items.Weapon;
/**
! * A weapon proficiency allows the use of certain weapons without
! * a penalty to attack rolls.
*/
public abstract class WeaponProficiency extends Feat {
/**
! * Calls the getProficiency() method of a weapon class.
*
! * @param weaponClass A subclass of the Weapon class.
! * @return SIMPLE, MARTIAL, or EXOTIC
! * @throws ClassCastException If weaponClass is not a subclass
! * of Weapon.
*/
! protected int getProficiency (Class weaponClass) {
! Integer result = null;
!
! if (! Weapon.class.isAssignableFrom (weaponClass)) {
! String msg = "weaponClass (" + weaponClass.getName () +
! ") is not a subclass of Weapon";
! throw new ClassCastException (msg);
! }
!
! // None of these exceptions should be thrown so catch them here.
! try {
! Method method = weaponClass.getMethod ("getProficiency", null);
! result = (Integer) method.invoke (weaponClass, null);
! } catch (NoSuchMethodException e) {
! System.out.println (e);
! } catch (IllegalAccessException e) {
! System.out.println (e);
! } catch (InvocationTargetException e) {
! System.out.println (e);
! }
!
! return (result.intValue ());
}
/**
! * Determine the compatibility of this type of feat. Weapon
! * proficiency feats are exclusive feats: only one instance of each
! * feat can be attached to a creature at one time.
*
! * @return Feat.EXCLUSIVE.
*/
! public int getCompatibility () {
! return (Feat.EXCLUSIVE);
! }
}
--- 23,63 ----
package ogs.feats;
import ogs.core.Feat;
import ogs.items.Weapon;
/**
! * A feat that allows the effective use of a weapon. A creature that
! * uses a weapon without being proficient with it suffers a -4 penatly
! * to attack rolls. This class is the base class for derived classes
! * that identify specific types of weapons for this proficiency feat.
*/
public abstract class WeaponProficiency extends Feat {
/**
! * Determine the group that this feat belongs to. Weapon proficiency
! * feats are general feats.
*
! * @return Feat.GENERAL
*/
! public int getGroup () {
! return (Feat.GENERAL);
}
/**
! * Determine weapon proficiency that this feat applies to.
*
! * @return Proficiency of weapon: SIMPLE, MARTIAL, or EXOTIC.
*/
! public abstract int getProficiency ();
!
! /**
! * Determine if a weapon is a proficient weapon. A proficient
! * weapon is a weapon that a creature with this feat is proficient
! * with. If this feat is not attached to a creature, the weapon is
! * not a proficient weapon.
! *
! * @return True if weapon is a proficient weapon.
! */
! public abstract boolean isProficient (Weapon weapon);
}
--- ExoticWeapon.java DELETED ---
--- GreatFortitude.java DELETED ---
--- HeavyArmor.java DELETED ---
--- IronWill.java DELETED ---
--- LightArmor.java DELETED ---
--- LightningReflexes.java DELETED ---
--- MartialWeapon.java DELETED ---
--- MediumArmor.java DELETED ---
--- SimpleWeapon.java DELETED ---
|