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...

Briefly, How To Play GURPS

For a long time, I’ve maintained that GURPS, despite its reputation for complexity, is actually pretty simple in play. I was thinking recently that I should see if I can express the fundamentals of playing GURPS in a short, easily digested form, and so here I am.   This does not address a more general “how to play rpgs” for those who know nothing on the topic. How to approach GURPS, at that level, isn’t necessarily a lot different from how to approach D&D or TFT or any other RPG system. It doesn’t get into optional and campaign-specific sets of rules or equipment. Rather, this is stuff applicable to playing GURPS no matter what the campaign is. It also doesn’t address how to build GURPS characters, which is a vastly more complicated topic. Rather, this is about how to engage GURPS rules when you’ve already got your character sheet and are sitting at the table to play. It’s a trifle over 1000 words, which I think isn’t too bad.   How To Play GURPS Most of what you’ll need t...