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

Writing GURPS Adventures

Someone over on the forum asked for advice on writing adventures for GURPS. Or more specifically, in context, writing GURPS adventures with an eye towards publication by SJ Games, which is a very different animal. Whatever method and structure you have for writing up adventures for your own use is, of course, the best and you should use it for your own purposes. But we're talking about commerce here, not just art, so this should be thought of as advice on how to do business with a particular publisher, not generally useful advice on how to write adventures.

I need to start by defining a term. SJ Games means something specific by "adventure." As the wish list uses the word, an adventure has a plot, or at least something plot-like in it. It presents a specific problem to solve through a progression of encounters. They are not sandboxes. Sandbox-style adventures, with their multiplicity of possible PC objectives, are, in the terminology of the wish list, locations. There ar…

Writing Historical RPGs, Doing Diversity

For a few years now, I've been seeing things like this and reading pieces elsewhere about apparent conflicts between historical accuracy in historical or pseudo-historical fantasy games and issues of deep interest to some parts (and some potential parts) of the modern gaming audience. I tend to write things which are both connected to history and are written to enable the fantasies of modern people, some of whom have a specific interest in not reproducing problematic parts of the past and present in their recreations, so it's something which touches on stuff that I do. And I think I tend to move and write in circles where this tends not to get much thought or attention even though I write for a game which makes accuracy a priority, so while none of this is new to people who grapple with these issues regularly, I'm thinking maybe I should say something about it to get it into spaces where I work.

So, how do I approach the demands of both accuracy and diversity in the stuff …

Still More GURPS Terrain

I've been playing with a few more hex floor pieces.

One thing I've been seeing in a lot of printable floors is a sort of natural stone texture. It's a little irregular and uneven, though not so much so to make it unusable as terrain. It crossed my mind that rather than build a "natural stone floor" set of pieces, I could print flat floor pieces, shear some "rock" designs in half, scale appropriately, and print with a very, very small Z height. Those get glued to the flat floor and painted. That way, I'm not dealing with huge files (those rock forms use a lot of triangles). Seems to work pretty well.


What I'm not quite so happy with is a wooden plank texture. I swiped some very detailed wood plank hexes from a design on Thingiverse and scaled it down to my 1-inch hexes. Unfortunately, it doesn't look like it works well at that scale. That said, I recently switched down from a .4 to a .3mm nozzle, so I'll try it again and see if that helps…