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

More Nattering About Writing Historical RPGs

omeone made the mistake of asking me to expand on some things I'd said about writing historical rpg material, so you all must suffer for it. I write a lot of historical rpg stuff as well as entirely fictional setting material. So why make historically themed games rather than just making stuff up? Well, because it's an effective way of achieving the purpose of writing settings and adventures in general. The purpose of settings and adventures, I would aver, is to give players things to do in a convincing context. Convincing context doesn't necessarily mean realism. Players have different levels of understanding of what's "realistic" in different situations and are more or less sensitive to how closely those situations adhere to reality. For example, I'm a history and culture guy. Put me in SF campaigns (which happens with some regularity) and the specifics of how reaction drives, orbital mechanics, and subatomic physics work entirely escape me. I don't,

Stuff I Wouldn't Do With Purchased Minis

One of the great things about the advent of 3d printing, when it comes to gaming, is that it allows me to take more risks and try stuff I wouldn't do otherwise. Take, for example, experimenting with painting techniques. Maybe I want to see what an unusual color scheme would look like or try doing an odd way of achieving an effect. Factory-made miniatures are expensive. Too expensive for me to risk it. Which, as someone who's not very good at painting minis and needs lots of practice, is one reason I've never gotten into them. I don't feel like I can afford the implied expense of getting better. Enter 3d printing. With the right files, I can print as many minis as I can like and mess around with them to my heart's content. Mess one up? That's fine. Resin isn't cheap , but it doesn't cost nearly as much as pre-made molded plastic. I can take it as a learning experience and move on. Which brings me to messing around with some Car Wars minis. I'd been m

Ferrous Metal Food Fighting Guy!

(This is something I wrote up some years back. I'm putting it here so I can find it more easily when I want to. Though it's rather silly, it's also where I came up with the idea of high-quality materials which don't provide a bonus to the craftsman's skill, but do add to the margin of success, a mechanism which later appeared in the crafting rules in GURPS Low-Tech Companion 3 .) One of the things not to be found in GURPS 4e is extensive rules for competitive cooking. If two cooks of steely resolve rise up to face one another across a cooking coliseum, the GM can only fall back on hand-waving and contests of skill. This article fills that much-needed gap. GURPS chefs can now stage furious contests wherein they construct fanciful dishes, the more elaborate the better, and prove whose cooking rules the day. To the kitchen! Procedure These rules provide guidance for attempting to cook complex dishes and comparing their quality when the cooking is done. A che