def getLegendary(): legendary = {} legendaryDescription = raw_input("Input description for legendary actions: ") if legendaryDescription is not "": legendary["DESCRIPTION"] = legendaryDescription legendaryActions = [] legendaryActionName = raw_input("Legendary action " + str(len(legendaryActions) + 1) + ": ") while legendaryActionName is not "": legendaryAction = {} legendaryAction["NAME"] = legendaryActionName legendaryActionCost = raw_input("Legendary action cost (e.g. Costs 2 Actions): ") legendaryAction["ACTION_COST"] = legendaryActionCost legendaryActionDescription = raw_input("Legendary action description: ") legendaryAction["ACTION_DESCRIPTION"] = legendaryActionDescription spellReferencesAnswer = raw_input("Are there any spell references (italic) in the description? ") if utils.validYesNo(spellReferencesAnswer): spellReferences = [] spellReference = raw_input("Spell reference name: ") while spellReference is not "": spellReferences.append(spellReference) spellReference = raw_input("Spell reference " + str(len(spellReferences) + 1) + "name: ") legendaryAction["SPELL_REFERENCES"] = spellReferences legendaryActions.append(legendaryAction) legendaryActionName = raw_input("Legendary action " + str(len(legendaryActions) + 1) + ": ") legendary["ACTIONS"] = legendaryActions return legendary
def getActions(): actions = [] actionName = raw_input("Action name " + str(len(actions) + 1) + ": ") while actionName is not "": action = {} action["ACTION_NAME"] = actionName actionFreq = raw_input("Action frequency (e.g. 1/Day or Recharge 5-6): ") if actionFreq is not "": action["ACTION_FREQ"] = actionFreq actionDescriptionsAnswer = raw_input("Is this action characterized by a description with 1 or more paragraphs? ") if utils.validYesNo(actionDescriptionsAnswer): actionDescriptions = [] actionDescription = raw_input("Description " + str(len(actionDescriptions) + 1) + ": ") while actionDescription is not "": actionDescriptions.append(actionDescription) actionDescription = raw_input("Description " + str(len(actionDescriptions) + 1) + ": ") action["ACTION_DESCRIPTIONS"] = actionDescriptions actionAttackAnswer = raw_input("Is this action characterized by a melee, ranged, or spell attack? ") if utils.validYesNo(actionAttackAnswer): actionAttack = {} attackType = raw_input("Type of attack (e.g. Melee Weapon Attack): ") if utils.equalsIgnoreCase(attackType, "mwa"): attackType = "Melee Weapon Attack" elif utils.equalsIgnoreCase(attackType, "rwa"): attackType = "Ranged Weapon Attack" actionAttack["ATTACK_TYPE"] = attackType bonusHit = raw_input("Bonus to hit: ") actionAttack["BONUS_HIT"] = bonusHit reachRange = {} hasReach = False hasRange = False if attackType.find("melee") >= 0 or attackType.find("Melee") >= 0: reach = raw_input("Reach (ft): ") reach = "reach " + reach + " ft." reachRange["reach"] = reach hasReach = True if attackType.find("ranged") >= 0 or attackType.find("Ranged") >= 0: range = raw_input("Range (ft): ") range = "range " + range + " ft." reachRange["range"] = range hasRange = True actionAttack["REACH"] = reachRange targetType = raw_input("Type of target affected? (e.g. '1 target', 'one Medium or smaller creature'.) ") actionAttack["TARGET_TYPE"] = targetType damage = {} addDamage = False standardDamage = {} if hasReach: reachAttack = raw_input("Reach damage dice: ") if reachAttack is not "": addDamage = True reachAttackType = raw_input("Reach damage type: ") standardDamage["REACH_DAMAGE"] = { "DAMAGE_DICE": reachAttack, "DAMAGE_TYPE": reachAttackType } if hasRange: rangeAttack = raw_input("Range damage dice: ") if rangeAttack is not "": addDamage = True rangeAttackType = raw_input("Range damage type: ") standardDamage["RANGE_DAMAGE"] = { "DAMAGE_DICE": rangeAttack, "DAMAGE_TYPE": rangeAttackType } if hasReach or hasRange: damage = standardDamage ''' else: attack_1h_damage = raw_input("Standard damage e.g. 1d8: ") if attack_1h_damage is not "": addDamage = True attack_1h_damage_type = raw_input("Type of damage: ") damage["STANDARD_DAMAGE"] = {"DAMAGE_DICE": attack_1h_damage, "DAMAGE_TYPE": attack_1h_damage_type} ''' attack_2h_answer = raw_input("Does this attack have 2h damage? ") if utils.validYesNo(attack_2h_answer): attack_2h_damage = raw_input("2H damage: ") if attack_2h_damage is not "": addDamage = True attack_2h_damage_type = raw_input("Type of damage: ") damage["2H_DAMAGE"] = {"DAMAGE_DICE": attack_2h_damage, "DAMAGE_TYPE": attack_2h_damage_type} advantageAnswer = raw_input("Does this attack have advantage damage? ") if utils.validYesNo(advantageAnswer): advantageDamage = raw_input("Advantage damage: ") if advantageDamage is not "": addDamage = True advantageDamageType = raw_input("Type of damage: ") damage["ADVANTAGE_DAMAGE"] = {"DAMAGE_DICE": advantageDamage, "DAMAGE_TYPE": advantageDamageType} extraDamageAnswer = raw_input("Does this attack apply extra damage? ") if utils.validYesNo(extraDamageAnswer): extraDamage = raw_input("Extra damage: ") if extraDamage is not "": addDamage = True extraDamageType = raw_input("Type of extra damage: ") damage["EXTRA_DAMAGE"] = {"DAMAGE_DICE": extraDamage, "DAMAGE_TYPE": extraDamageType} if addDamage is True: actionAttack["DAMAGE"] = damage attackEffectDesc = [] attackEffect = raw_input("Attack effect description " + str(len(attackEffectDesc) + 1)+ ": ") while attackEffect != "": attackEffectDesc.append(attackEffect) attackEffect = raw_input("Attack effect description " + str(len(attackEffectDesc) + 1)+ ": ") actionAttack["EFFECT"] = attackEffectDesc action["ATTACK"] = actionAttack actionEffectsAnswer = raw_input("Does this action have a list of effects based on a roll? ") if utils.validYesNo(actionEffectsAnswer): actionEffects = [] actionEffectName = raw_input("Effect " + str(len(actionEffects) + 1) + " name: ") while actionEffectName is not"": actionEffectDescriptions = [] actionEffectDescription = raw_input("Effect " + str(len(actionEffects) + 1) + " description " + str(len(actionEffectDescriptions) + 1) + ": ") while actionEffectDescription is not "": actionEffectDescriptions.append(actionEffectDescription) actionEffectDescription = raw_input("Effect " + str(len(actionEffects) + 1) + " description " + str(len(actionEffectDescriptions) + 1) + ": ") actionEffects.append({"EFFECT_NAME": actionEffectName, "EFFECT_DESCRIPTION": actionEffectDescriptions}) actionEffectName = raw_input("Effect " + str(len(actionEffects) + 1) + " name: ") if len(actionEffects) > 0: action["EFFECTS"] = actionEffects spellReferencesAnswer = raw_input("Are there any spell references (italic) in the description? ") if utils.validYesNo(spellReferencesAnswer): spellReferences = [] spellReference = raw_input("Spell reference " + str(len(spellReferences) + 1) + " name: ") while spellReference is not "": spellReferences.append(spellReference) spellReference = raw_input("Spell reference " + str(len(spellReferences) + 1) + " name: ") action["SPELL_REFERENCES"] = spellReferences actions.append(action) actionName = raw_input("Action name " + str(len(actions) + 1) + ": ") return actions
def getPassives(): passives = [] passiveName = raw_input("Passive Name " + str(len(passives) + 1) + ": ") while passiveName is not "": passive = {} passive["PASSIVE_NAME"] = passiveName passiveDescriptions = [] passiveDesc = raw_input("Passive Description " + str(len(passiveDescriptions) + 1) + ": ") while passiveDesc is not "": passiveDescriptions.append(passiveDesc) passiveDesc = raw_input("Passive Description " + str(len(passiveDescriptions) + 1) + ": ") passive["PASSIVE_DESCRIPTION"] = passiveDescriptions passiveItemListAnswer = raw_input("Does this passive description have a list associated with it of the format: (item or subject).(description)? ") if utils.validYesNo(passiveItemListAnswer): passiveItemList = [] passiveItemName = raw_input("Item/Subject to be described: ") while passiveItemName is not "": passiveItemDescriptions = [] passiveItemDescription = raw_input("Description for " + passiveItemName + ". If multiple paragraphs, enter them separately: ") while passiveItemDescription is not "": passiveItemDescriptions.append(passiveItemDescription) passiveItemDescription = raw_input("Paragraph " + str(len(passiveItemDescriptions) + 1) + " for description of " + passiveItemName + ": ") passiveItemList.append({"ITEM": passiveItemName, "DESCRIPTION": passiveItemDescriptions}) passiveItemName = raw_input("Item/Subject " + str(len(passiveItemList) + 1) + " to be described: ") passive["PASSIVE_LIST"] = passiveItemList spellReferencesAnswer = raw_input("Are there any spell references (italic) in the description? ") if utils.validYesNo(spellReferencesAnswer): spellReferences = [] spellReference = raw_input("Spell reference name: ") while spellReference is not "": spellReferences.append(spellReference) spellReference = raw_input("Spell reference name: ") passive["SPELL_REFERENCES"] = spellReferences spellsAnswer = raw_input("Are there any spells granted by this passive? ") if utils.validYesNo(spellsAnswer): spells = [] spellFreq = raw_input("Specify the frequency of the list of spells (e.g. At will or 1/day): ") while spellFreq is not "": spellFreqAlreadyGiven = False for _spell in spells: if _spell["FREQ"] is spellFreq: spellRef = _spell spellFreqAlreadyGiven = True break; if not spellFreqAlreadyGiven: spellRef = {"FREQ": spellFreq, "SPELL_LIST": []} spellsAtSpellFreq = raw_input("List spells with frequency (" + spellFreq + "): ") while spellsAtSpellFreq is not "": listedSpells = spellsAtSpellFreq.replace(", ", ",") listedSpells = listedSpells.split(",") for _listed_spell in listedSpells: spellRef["SPELL_LIST"].append(_listed_spell) spellsAtSpellFreq = raw_input("Additional spells with frequency (" + spellFreq + "): ") spells.append(spellRef) spellFreq = raw_input("Specify the frequency of the list of spells (e.g. At will or 1/day): ") if len(spells) > 0: passive["SPELLS"] = spells passives.append(passive) passiveName = raw_input("Passive Name " + str(len(passives) + 1) + ": ") return passives