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.

Enchantment


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;
    }


}

Comments

Popular posts from this blog

Dungeon Fantasy RPG PDFs to Backers!

It is, at long last, out! Sort of! PDFs of the Dungeon Fantasy Roleplaying Game have been released to Kickstarter backers. I don't think it'll be generally available until next month, but since it's in the wild in at least a limited way, I feel I can talk about this a bit more like a customer than someone involved in the project.

The Dungeon Fantasy RPG is a complete fantasy tabletop roleplaying game. It's based on GURPS 4th edition rules, but it's a stand-alone game, requiring no other books, or even prior knowledge of GURPS. I've already made some general comments elsewhere (I got an advanced peek for a number of reasons, not the least of which is that I was called on to write some follow-up material coming out later). I'll expand on that here.

For those unfamiliar with GURPS, it's a point-buy system rather than randomly rolled, class-and-level, or life path, and pretty much everything in play boils down to "try to roll a target number or less o…

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 …

Silk Road Miscellaneous Comments

GURPS Hot Spots: The Silk Road is, at long last, out, after languishing for some months behind the Dungeon Fantasy Roleplaying Game. There's a more substantial bit on this forthcoming, but I've got some other thoughts that didn't make it into that, so...


The Silk Road is something of a departure from previous Hot Spots volumes. Instead of a single city, it covers a large, more vaguely defined, and much more culturally diverse region. In the pitch I sent to SJ Games, I described it as being more like GURPS Conan than any of the previous Hot Spots. It's more about trends and areas than specific people and events. And I think that actually makes it a much better setting for setting adventures. It's more of a sandbox (indeed, the Taklamakan desert is one of the world's biggest sandboxes) where the GM is relieved of the weight of specific historical events. And the specific nature of this region and its time make it easy for anybody from that time (or, at least, any …