410 lines
11 KiB
Python
410 lines
11 KiB
Python
import array as arr
|
|
|
|
from evennia.utils import evtable
|
|
|
|
_GENERAL_SKILL_LEVEL_DESCRIPTIONS = {
|
|
1: "Inept",
|
|
2: "Mediocre",
|
|
3: "Mediocre",
|
|
4: "Average",
|
|
5: "Average",
|
|
6: "Rather skilled",
|
|
7: "Rather skilled",
|
|
8: "Well trained",
|
|
9: "Well trained",
|
|
10: "Expert"
|
|
}
|
|
|
|
_WEAPON_SKILL_LEVEL_DESCRIPTIONS = {
|
|
1: "Astoundingly bad",
|
|
2: "Astoundingly bad",
|
|
3: "Clumsy",
|
|
4: "Unskilled",
|
|
5: "Novice",
|
|
6: "Veteran",
|
|
7: "Expert",
|
|
8: "Master",
|
|
9: "Master",
|
|
10: "Wizard"
|
|
}
|
|
|
|
_SKILL_COST = {
|
|
1: {
|
|
"Easy": 1,
|
|
"Average": 2,
|
|
"Hard": 4,
|
|
"Very Hard": 8
|
|
},
|
|
|
|
2: {
|
|
"Easy": 2,
|
|
"Average": 4,
|
|
"Hard": 8,
|
|
"Very Hard": 12
|
|
},
|
|
|
|
3: {
|
|
"Easy": 4,
|
|
"Average": 8,
|
|
"Hard": 12,
|
|
"Very Hard": 16
|
|
},
|
|
|
|
4: {
|
|
"Easy": 8,
|
|
"Average": 12,
|
|
"Hard": 16,
|
|
"Very Hard": 20
|
|
},
|
|
|
|
5: {
|
|
"Easy": 12,
|
|
"Average": 16,
|
|
"Hard": 20,
|
|
"Very Hard": 24
|
|
},
|
|
|
|
7: {
|
|
"Easy": 16,
|
|
"Average": 20,
|
|
"Hard": 24,
|
|
"Very Hard": 28
|
|
},
|
|
|
|
8: {
|
|
"Easy": 20,
|
|
"Average": 24,
|
|
"Hard": 28,
|
|
"Very Hard": 32
|
|
},
|
|
|
|
9: {
|
|
"Easy": 24,
|
|
"Average": 28,
|
|
"Hard": 32,
|
|
"Very Hard": 36
|
|
},
|
|
|
|
10: {
|
|
"Easy": 28,
|
|
"Average": 32,
|
|
"Hard": 36,
|
|
"Very Hard": 40
|
|
}
|
|
}
|
|
|
|
_SKILL_DATA = {
|
|
# Animal Skills
|
|
1: {
|
|
"Name": "Animal Handling",
|
|
"Category": "Animal Skills",
|
|
"Difficulty": "Hard",
|
|
"Attribute": "Mental",
|
|
"Defaults": {
|
|
"IQ": 6
|
|
},
|
|
"Prerequisite": 0,
|
|
"Subskills": [3, 5],
|
|
"Description": "This is the ability to train and work with all types of animals"
|
|
},
|
|
|
|
2: {
|
|
"Name": "Falconry",
|
|
"Category": "Animal Skills",
|
|
"Difficulty": "Average",
|
|
"Attribute": "Mental",
|
|
"Defaults": {
|
|
"IQ": 5
|
|
},
|
|
"Prerequisite": 0,
|
|
"Subskills": [0],
|
|
"Description": "Hunting small game with a trained hawk"
|
|
},
|
|
|
|
3: {
|
|
"Name": "Packing",
|
|
"Category": "Animal Skills",
|
|
"Difficulty": "Hard",
|
|
"Attribute": "Mental",
|
|
"Prerequisite": 1,
|
|
"Subskills": [0],
|
|
"Defaults": {
|
|
"IQ": 6,
|
|
1: 6
|
|
},
|
|
"Description": "Ability to efficiently and speedily get loads on and off pack animals"
|
|
},
|
|
|
|
4: {
|
|
"Name": "Riding",
|
|
"Category": "Animal Skills",
|
|
"Difficulty": "Average",
|
|
"Attribute": "Physical",
|
|
"Prerequisite": 0,
|
|
"Subskills": [0],
|
|
"Defaults": {
|
|
"DX": 5,
|
|
1: 3
|
|
},
|
|
"Description": "Riding tamed animals suited for travel"
|
|
},
|
|
|
|
5: {
|
|
"Name": "Teamster",
|
|
"Category": "Animal Skills",
|
|
"Difficulty": "Average",
|
|
"Attribute": "Physical",
|
|
"Prerequisite": 1,
|
|
"Subskills": [0],
|
|
"Defaults": {
|
|
1: 4,
|
|
4: 2
|
|
},
|
|
"Description": "Skill of driving and harnessing teams/herds of animals, such as a wagon or gun teams"
|
|
},
|
|
|
|
6: {
|
|
"Name": "Veterinary",
|
|
"Category": "Animal Skills",
|
|
"Difficulty": "Hard",
|
|
"Attribute": "Mental",
|
|
"Prerequisite": 0,
|
|
"Subskills": [0],
|
|
"Defaults": {
|
|
0: {
|
|
"Typename": "Animal",
|
|
"Roll": 5,
|
|
"Create": "Specify the name of the animal species you are able to care for/doctor"
|
|
}
|
|
},
|
|
"Description": "Skill at caring for sick or wounded animals"
|
|
},
|
|
|
|
# Artistic skills
|
|
|
|
7: {
|
|
"Name": "Artist",
|
|
"Category": "Artistic Skills",
|
|
"Difficulty": "Hard",
|
|
"Attribute": "Mental",
|
|
"Prerequisite": 0,
|
|
"Subskills": [0],
|
|
"Defaults": {
|
|
"IQ": 6
|
|
},
|
|
"Prerequisite": 0,
|
|
"Description": "Ability to paint and draw with both accuracy and beauty"
|
|
},
|
|
|
|
8: {
|
|
"Name": "Bard",
|
|
"Category": "Artistic Skills",
|
|
"Difficulty": "Average",
|
|
"Attribute": "Mental",
|
|
"Defaults": {
|
|
"IQ": 5
|
|
},
|
|
"Prerequisite": 0,
|
|
"Subskills": [0],
|
|
"Description": "Ability to tell stories and to speak extemporaneously"
|
|
},
|
|
|
|
9: {
|
|
"Name": "Musical Instrument",
|
|
"Category": "Artistic Skills",
|
|
"Difficulty": "Hard",
|
|
"Attribute": "Mental",
|
|
"Defaults": {
|
|
0: {
|
|
"Typename": "Instrument",
|
|
"Roll": 3,
|
|
"Create": "Specify the name of the instrument you are able to play"
|
|
}
|
|
},
|
|
"Prerequisite": 0,
|
|
"Subskills": [0],
|
|
"Description": "Skill at playing a specific instrument"
|
|
},
|
|
|
|
# Athletic skills
|
|
|
|
10: {
|
|
"Name": "Acrobatics",
|
|
"Category": "Athletic Skills",
|
|
"Difficulty": "Hard",
|
|
"Attribute": "Physical",
|
|
"Defaults": {
|
|
"DX": 6
|
|
},
|
|
"Prerequisite": 0,
|
|
"Subskills": [0],
|
|
"Description": "The art of pulling off acrobatic and gymnastic stunts, roll, take falls, balance and so on"
|
|
},
|
|
|
|
11: {
|
|
"Name": "Jumping",
|
|
"Category": "Athletic Skills",
|
|
"Difficulty": "Easy",
|
|
"Attribute": "Physical",
|
|
"Defaults": 0,
|
|
"Prerequisite": 0,
|
|
"Subskills": [0],
|
|
"Description": "This is the trained ability to use your strength to its best advantage when you jump"
|
|
},
|
|
|
|
12: {
|
|
"Name": "Running",
|
|
"Category": "Athletic Skills",
|
|
"Difficulty": "Hard",
|
|
"Attribute": "Physical",
|
|
"Defaults": {
|
|
"Special": {
|
|
0: "Self",
|
|
1: "Divide",
|
|
2: 8,
|
|
3: "Add",
|
|
4: "Move"
|
|
}
|
|
},
|
|
"Prerequisite": 0,
|
|
"Subskills": [0],
|
|
"Description": "This represents training in sprints and long distance running"
|
|
},
|
|
|
|
13: {
|
|
"Name": "Swimming",
|
|
"Category": "Arhletic Skills",
|
|
"Difficulty": "Easy",
|
|
"Attribute": "Physical",
|
|
"Defaults": {
|
|
"ST": 5,
|
|
"DX": 4
|
|
},
|
|
"Prerequisite": 0,
|
|
"Subskills": [0],
|
|
"Description": "Ability to stay afloat and swim in water"
|
|
}
|
|
}
|
|
|
|
def skillTable(caller, category, excludeCharacterSkills = True):
|
|
table = evtable.EvTable("#", "Skill name", "Attribute", "Difficulty", "Description")
|
|
for key in _SKILL_DATA:
|
|
if not excludeCharacterSkills:
|
|
if _SKILL_DATA[key]["Category"] == category:
|
|
table.add_row(
|
|
key,
|
|
_SKILL_DATA[key]["Name"],
|
|
_SKILL_DATA[key]["Attribute"],
|
|
_SKILL_DATA[key]["Difficulty"],
|
|
_SKILL_DATA[key]["Description"]
|
|
)
|
|
else:
|
|
if _SKILL_DATA[key]["Category"] == category and key not in caller.db.skills:
|
|
table.add_row(
|
|
key,
|
|
_SKILL_DATA[key]["Name"],
|
|
_SKILL_DATA[key]["Attribute"],
|
|
_SKILL_DATA[key]["Difficulty"],
|
|
_SKILL_DATA[key]["Description"]
|
|
)
|
|
|
|
return table
|
|
|
|
def idInCategory(caller, category, number):
|
|
legitimateValues = []
|
|
for key in _SKILL_DATA:
|
|
if _SKILL_DATA[key]["Category"] == category:
|
|
legitimateValues.append(key)
|
|
|
|
if number in legitimateValues:
|
|
return True
|
|
else:
|
|
return False
|
|
|
|
def getSkillName(skillId):
|
|
return _SKILL_DATA[skillId]["Name"]
|
|
|
|
def addSkill(caller, skillId):
|
|
cost = getSkillCost(skillId)
|
|
caller.db.skills.append(skillId)
|
|
caller.db.attribpoints = caller.db.attribpoints - cost
|
|
caller.db.skillevel[skillId] = 1
|
|
|
|
def addSkillTypeName(caller, skillId, typeName):
|
|
caller.db.skillproperties[skillId] = typeName
|
|
|
|
def characterSkills(caller):
|
|
table = evtable.EvTable("#", "Skill name", "Level", "Attribute", "Difficulty", "Description")
|
|
for key in caller.db.skills:
|
|
table.add_row(
|
|
key,
|
|
_SKILL_DATA[key]["Name"],
|
|
"%i |w%s|n" % (caller.db.skillevel[key], getSkillDescription(caller.db.skillevel[key])),
|
|
_SKILL_DATA[key]["Attribute"],
|
|
_SKILL_DATA[key]["Difficulty"],
|
|
_SKILL_DATA[key]["Description"]
|
|
)
|
|
|
|
return table
|
|
|
|
def skillInCharacter(caller, skillId):
|
|
for key in caller.db.skills:
|
|
if key == skillId:
|
|
return True
|
|
|
|
return False
|
|
|
|
def removeFromCharacter(caller, skillId):
|
|
for key in caller.db.skills:
|
|
if skillId == _SKILL_DATA[key]["Prerequisite"]:
|
|
return False
|
|
|
|
level = caller.db.skillevel[skillId]
|
|
gain = getSkillCost(skillId, level)
|
|
caller.db.skills.remove(skillId)
|
|
caller.db.attribpoints = caller.db.attribpoints + gain
|
|
caller.db.skillevel[skillId] = 0
|
|
caller.db.skillproperties[skillId] = 0
|
|
return True
|
|
|
|
def checkPrerequisite(caller, skillId):
|
|
if _SKILL_DATA[skillId]["Prerequisite"] == 0:
|
|
return True
|
|
elif _SKILL_DATA[skillId]["Prerequisite"] > 0 and _SKILL_DATA[skillId]["Prerequisite"] in caller.db.skills:
|
|
return True
|
|
return False
|
|
|
|
def prerequisiteName(caller, skillId):
|
|
if _SKILL_DATA[skillId]["Prerequisite"] > 0:
|
|
prerequisiteId = _SKILL_DATA[skillId]["Prerequisite"]
|
|
return _SKILL_DATA[prerequisiteId]["Name"]
|
|
return None
|
|
|
|
def requiredByName(caller, skillId):
|
|
skillNames = []
|
|
for key in _SKILL_DATA[skillId]["Subskills"]:
|
|
for keyid in caller.db.skills:
|
|
if keyid == key:
|
|
skillNames.append(getSkillName(key))
|
|
|
|
return skillNames
|
|
|
|
def hasTypes(caller, skillId):
|
|
if 0 in _SKILL_DATA[skillId]["Defaults"]:
|
|
return True
|
|
return False
|
|
|
|
def getTypeDescription(skillId):
|
|
return _SKILL_DATA[skillId]["Defaults"][0]["Create"]
|
|
|
|
def getTypenameOfSkill(skillId):
|
|
return _SKILL_DATA[skillId]["Defaults"][0]["Typename"]
|
|
|
|
def getSkillCost(skillId, level = 1):
|
|
return _SKILL_COST[level][_SKILL_DATA[skillId]["Difficulty"]]
|
|
|
|
def getSkillDescription(level, sType = "Generic"):
|
|
if sType == "Generic":
|
|
return _GENERAL_SKILL_LEVEL_DESCRIPTIONS[level]
|
|
else:
|
|
return _WEAPON_SKILL_LEVEL_DESCRIPTIONS[level] |