Skip to main content

Hoardomatic Code: Enchantment Class

Enchantments are structurally very similar to Embellishments. The big difference is how costs are accounted for by the Item containing them.


String Enchantment_name: The name of the enchantment, usually just the name of a spell, though it may include a degree (Accuracy 3) or notation about which version of an enchantment the item has (Bravery (Cast only)).
Double cf: The embellishment's CF value. Not actually used, but it's there because I started enchantments by copying the embellishment class.
Double flat_cost: The base cost of the enchantment.
Double wt_mod: Weight adjustment, if any, which spells generally don't have.
String motif_option: Not used.
String ench_code: A code similar to the embellishment codes, indicating what kind of item the enchantment can be on. Most are generally applicable, but a few are limited to weapons or armor.

This class works very much like the Embellishments class: it takes a node provided to it and populates the enchantment's properties.

package hoardomatic;

import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Enchantment {
    private String Enchantment_name;
    private Double cf;
    private Double flat_cost;
    private Double wt_mod;
    private String motif_option;
    private String ench_code;

    public Enchantment() {

        Enchantment_name = "";
        cf = 0.0;
        flat_cost = 0.0;
        wt_mod = 1.0;
        motif_option = "";
        ench_code = "";
    public Enchantment(Node node) {
        flat_cost = 0.0;

        NodeList tempNodes = node.getChildNodes();
        for (int j = 0; j < tempNodes.getLength(); j++) {
            Node subnode = tempNodes.item(j);

            if (subnode.getNodeType() == Node.ELEMENT_NODE) {
                Element element = (Element) subnode;
                if (element.getNodeName().contentEquals("Enchantment")) {
                    Enchantment_name = element.getTextContent();

                if (element.getNodeName().contentEquals("CF")) {
                    cf =Double.parseDouble(element.getTextContent());

                if (element.getNodeName().contentEquals("Cost")) {
                    flat_cost =Double.parseDouble(element.getTextContent());

                if (element.getNodeName().contentEquals("wtmod")) {
                    wt_mod = Double.parseDouble(element.getTextContent());

                if (element.getNodeName().contentEquals("ench_code")) {
                    ench_code = element.getTextContent();

                if (element.getNodeName().contentEquals("Type")) {
                    ench_code = element.getTextContent();




    public Enchantment(String the_name, Double the_cf, Double the_wt_mod) {

        Enchantment_name = the_name;
        cf = the_cf;
        wt_mod = the_wt_mod;
    public void setCost(Double new_cost){
        flat_cost = new_cost;
    public Double getCost(){
        return flat_cost;
    public void setCF(Double new_cf){
        cf = new_cf;
    public String getEnchantmentName(){
        return Enchantment_name;
    public String getMotifOption(){
        return motif_option;
    public Double getCf(){
        return cf;

    public Double getWtMod(){
        return wt_mod;
    public String getenchCode(){
        return ench_code;



Popular posts from this blog

Panel Discussion Addendum

I was late to Douglas Cole's panel discussion of SJ Games staff and frequent contributors to Pyramid magazine, so I missed a lot of the questions asked directly to the authors, and technical issues prevented me from answering some others once I got there. These, then, are some things I might have said, had I been able:

Douglas: How well does that mission statement resonate with you guys? Do you like to write crazy stuff? Do you like to get out there with expansions on existing material? How do you tie what you’re writing to either the themes Steven has suggested or what’s in your heart.

I like to write a range of stuff; how I do it varies. I get an idea and go where that takes me. On one end, there's the pure historicals. In things like "A Brief History of the Thieves' Guild," it's mostly ideas and background information. Maybe I mention a skill or advantage to give it a fig-leaf of GURPS, but that's about it. At the other end, there are the crunch-heavy,…

CW Listicle Notes

Turns out I've got rather a lot to say about a rather short piece. Specifically, the Car Wars vignette in Pyramid #89. It's all in general pursuit of world-building, but there's probably as much world-building going on in this one as all of my previous vignettes put together. Four out of the five locations make glancing reference to notable aspects of the world of the new Car Wars, so there are some significant bits of history and culture to tease out there. The fifth...well, that was mostly just me amusing myself.

There's also a certain amount of--pardon the expression--reality in there. In figuring out where to put the various arenas, I looked at a lot of maps, lists of roadside attractions, locations of current sports venues, and other such materials. Each place has a definite location in the real world, sometimes to the point of using existing buildings. Here's where everything came from:

Big Swede Arena: Parking garage at the Emeryville Ikea. We went there a fe…

The Occasional Dungeon: Overview

In order to get some more GURPS out there and play with some maps, I started toying with something. I've worked up a large map ("ground level" is below; I may need to poke around with image hosting to keep enough maps at the proper scales) of a dungeon complex. From time to time, I'll post magnified excerpts from the map with details in GURPS terms, with specific reference to Dungeon Fantasy (that is, mostly stocked with things from GURPS Dungeon Fantasy 8: Treasure Tables and the Dungeon Fantasy Monsters volumes, but occasional pointers elsewhere). They may prove useful to somebody somewhere under some odd set of circumstances.

This dungeon is set in a fairly steep, rocky hill. The natural caves underneath it have long been home to a variety of creatures, natural and otherwise, but pretty much all horrible. There's also a large natural cavern accessible through a very large opening at the top of the hill where the surface caved in. It has been home to a number …