Skip to main content

Hoardomatic Code: Embellishment Class

This represents an individual decorative or functional embellishment on an item.

Embellishment


String embellishment_name: Name of the embellishment (for example, "Fine material" or "Tassels").
Double cf: The embellishment's CF value.
Double wt_mod: Weight adjustment, if any. This defaults to 1 and is expressed as a decimal multiplier to the base item's weight. For example, 0.9 for an embellishment which reduces the weight of the item by 10%.
String motif_option: Some options don't lead to item having a particular decorative motif (for example, improved materials). Some do (for example, relief carving). Some could go either way (for example, painting; an item could simply be painted, say, entirely green, or have figures painted on it in green). This defaults to "N".
String emb_code: A single string corresponding to the range of attributes which items may have.

The constructor I'm using takes a node (from Embelishments.xml) handed to it by the calling class. It goes through the node's elements and extracts various bits of data, putting them into the appropriate variables.


package hoardomatic;

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

public class Embellishment {
   
    private String embellishment_name;
    private Double cf;
    private Double flat_cost;
    private Double wt_mod;
    private String motif_option;
    private String emb_code;

    public Embellishment() {

        embellishment_name = "";
        cf = 0.0;
        flat_cost = 0.0;
        wt_mod = 1.0;
        motif_option = "";
        emb_code = "";
    }
   
    public Embellishment(Node node) {

        motif_option = "";
        wt_mod = 1.0;
        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("Embellishment")) {
                    embellishment_name = element.getTextContent();
                }

                if (element.getNodeName().contentEquals("motif")) {
                    motif_option = 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("emb_code")) {
                    emb_code = element.getTextContent();
                }

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

            }

        }

    }

   
   
    public Embellishment(String the_name, Double the_cf, Double the_wt_mod) {
        // TODO Auto-generated constructor stub
        embellishment_name = the_name;
        cf = the_cf;
        wt_mod = the_wt_mod;
    }

    public void setWtMod(Double new_wt_mod){
        flat_cost = new_wt_mod;
    }
   
    public void setCost(Double new_cost){
        flat_cost = new_cost;
    }
   
    public void setCF(Double new_cf){
        cf = new_cf;
    }
   
   
    public String getEmbellishmentName(){
        return embellishment_name;
    }
   
    public void setEmbellishmentName(String new_name){
        embellishment_name = new_name;
    }
   
    public String getMotifOption(){
        return motif_option;
    }
   
    public Double getCf(){
        return cf;
    }

    public Double getWtMod(){
        return wt_mod;
    }
   
    public String getEmbCode(){
        return emb_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