Skip to content

Instantly share code, notes, and snippets.

@mooman219
Created June 13, 2013 19:36
Show Gist options
  • Save mooman219/5776677 to your computer and use it in GitHub Desktop.
Save mooman219/5776677 to your computer and use it in GitHub Desktop.
package com.gmail.mooman219.module.rpg.stat.store;
import com.gmail.mooman219.frame.MongoHelper;
import com.gmail.mooman219.frame.text.TextHelper;
import com.gmail.mooman219.handler.database.UploadReason;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.util.JSON;
public class PDSkill {
public final String tag = "skill";
public int health = 0;
public int mana = 0;
// -+ Strength is a measure of muscle, endurance and stamina combined. Strength affects
// the ability of characters to lift and carry weights, melee attack rolls, damage rolls
// (for both melee and ranged weapons,) the Jump, Climb, and Swim skills, several combat
// actions, and general checks involving moving or breaking stubborn objects.
public int strength = 0;
// -+ Dexterity encompasses a number of physical attributes including eye–hand coordination,
// agility, reflexes, fine motor skills, balance and speed of movement; a high dexterity
// score indicates superiority in all these attributes. Dexterity affects characters with
// regard to initiative in combat, ranged attack rolls, Armor Class, Reflex saves, and
// the Balance, Escape Artist, Hide, Move Silently, Open Lock, Ride, Sleight of Hand,
// Tumble, and Use Rope skills. It also affects the number of additional attacks of
// opportunity granted by the Combat Reflexes feat. Dexterity is the ability most
// influenced by outside influences (such as armor).
public int dexterity = 0;
// -+ Constitution is a term which encompasses the character's physique, toughness, health
// and resistance to disease and poison. The higher a character's Constitution, the more
// hit points that character will have. Constitution also is important for Fortitude saves,
// the Concentration skill, and fatigue-based general checks. Constitution also determines
// the duration of a barbarian's rage. Unlike the other ability scores, which render the
// character unconscious or immobile when they hit 0, having 0 Constitution is fatal.
public int constitution = 0;
// Intelligence is similar to IQ, but also includes mnemonic ability, reasoning and learning
// ability outside those measured by the written word. Intelligence dictates the number of
// languages a character can learn, and it influences the number of spells a preparation-based
// arcane spellcaster (like a Wizard) may cast per day, and the effectiveness of said spells.
// It also affects how many skill points a character gains per level, the Appraise, Craft,
// Decipher Script, Disable Device, Forgery, Knowledge, Search, and Spellcraft skills, and
// bardic knowledge checks.
public int intelligence = 0;
// -+ Wisdom is a composite term for the character's enlightenment, judgment, wile, willpower
// and intuitiveness. Wisdom influences the number of spells a divine spellcaster (like clerics,
// druids, paladins, and rangers) can cast per day, and the effectiveness of said spells. It
// also affects Will saving throws, the Heal, Listen, Profession, Sense Motive, Spot, and Survival
// skills, the effectiveness of the Stunning Fist feat, and a monk's quivering palm attack.
public int wisdom = 0;
// -+ Charisma is the measure of the character's combined physical attractiveness, persuasiveness,
// and personal magnetism. A generally non-beautiful character can have a very high charisma due
// to strong measures of the other two aspects of charisma. Charisma influences how many spells
// spontaneous arcane spellcasters (like sorcerers and bards) can cast per day, and the effectiveness
// of said spells. It also affects Bluff, Diplomacy, Disguise, Gather Information, Handle Animal,
// Intimidate, Perform, and Use Magic Device checks, how often and how effectively clerics and
// paladins can turn undead, the wild empathy of druids and rangers, and a paladin's lay on hands ability.
public int charisma = 0;
public int unspentPoints = 0;
public void sync(DBObject chat) {
this.health = MongoHelper.getValue(chat, "health", health);
this.mana = MongoHelper.getValue(chat, "mana", mana);
this.strength = MongoHelper.getValue(chat, "strength", strength);
this.dexterity = MongoHelper.getValue(chat, "dexterity", dexterity);
this.constitution = MongoHelper.getValue(chat, "constitution", constitution);
this.intelligence = MongoHelper.getValue(chat, "intelligence", intelligence);
this.wisdom = MongoHelper.getValue(chat, "wisdom", wisdom);
this.charisma = MongoHelper.getValue(chat, "charisma", charisma);
this.unspentPoints = MongoHelper.getValue(chat, "unspentpoints", unspentPoints);
}
public DBObject getTemplate(UploadReason reason) {
switch(reason) {
case CREATION:
case SAVE:
return (DBObject) JSON.parse("{" +
TextHelper.buildQuery(tag, "health", health) +
TextHelper.buildQuery(tag, "mana", mana) +
TextHelper.buildQuery(tag, "strength", strength) +
TextHelper.buildQuery(tag, "dexterity", dexterity) +
TextHelper.buildQuery(tag, "constitution", constitution) +
TextHelper.buildQuery(tag, "intelligence", intelligence) +
TextHelper.buildQuery(tag, "wisdom", wisdom) +
TextHelper.buildQuery(tag, "charisma", charisma) +
TextHelper.buildQuery(tag, "unspentpoints", unspentPoints) +
"}");
case STATUS:
default:
return new BasicDBObject();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment