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

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 …