7e6ce878 by Barry

Added skills and Partial support for feats.. Breaking change.. I really

need to start doing pull requests and branches..
1 parent 1ebbbf31
......@@ -30,6 +30,7 @@
}
}]
},
"skills" : { },
"prompt": "hp %hp mp %mp> ",
"aliases": {},
"level": 1,
......
import sys
if 'WiPy' in sys.platform:
from ucrypto import getrandbits
import network
wlan = network.WLAN(mode=network.WLAN.STA)
wlan.connect('Volley', auth=(network.WLAN.WPA2, '6198472223'))
import weemud
\ No newline at end of file
......
{"name": "test", "password": "6c76899eb15393064b4f4db94805e5862232920b", "room": "town/tavern", "abilities": {"str": 10, "dex": 23, "con": 10, "int": 12, "wis": 10, "cha": 8}, "equipment": {"finger": [null, null], "hand": [null, null], "arm": [null, null], "leg": [null, null], "foot": [null, null], "head": null, "neck": null, "back": null, "body": null, "waist": null}, "inventory": {"bag": [{"expires": 0, "inventory": {"shirt": [{"expires": 0}]}}]}, "prompt": "hp %hp mp %mp> ", "aliases": {}, "hp": 100, "mp": 10, "maxhp": 100, "maxmp": 10, "maxsta": 10, "sta": 10, "aa": "1d2", "mpr": 0.25, "star": 0.4, "weapon": null, "sp": {}, "at": {"kick": {"cost": 5, "dmg": "2d4", "desc": "You unleash a powerful kick"}}, "createstep": 7, "color_enabled": true, "over_13": true, "race": "Android", "theme": "Ace Pilot", "class": "Envoy", "abilitypoints": 0, "baseattack": 0, "fort": 0, "ref": 2, "will": 2}
\ No newline at end of file
{"name": "test", "password": "6c76899eb15393064b4f4db94805e5862232920b", "room": "town/tavern", "abilities": {"str": 10, "dex": 11, "con": 10, "int": 10, "wis": 10, "cha": 10}, "equipment": {"finger": [null, null], "hand": [null, null], "arm": [null, null], "leg": [null, null], "foot": [null, null], "head": null, "neck": null, "back": null, "body": null, "waist": null}, "inventory": {"bag": [{"expires": 0, "inventory": {"shirt": [{"expires": 0}]}}]}, "skills": {}, "prompt": "hp %hp mp %mp> ", "aliases": {}, "level": 1, "hp": 10, "mp": 10, "maxhp": 10, "maxmp": 10, "maxsta": 10, "sta": 10, "aa": "1d2", "mpr": 0.25, "star": 0.4, "weapon": null, "sp": 7, "at": {"kick": {"cost": 5, "dmg": "2d4", "desc": "You unleash a powerful kick"}}, "createstep": 7, "color_enabled": true, "over_13": true, "race": "Human", "theme": "Ace Pilot", "class": "Envoy", "abilitypoints": 12, "baseattack": 0, "fort": 0, "ref": 2, "will": 2, "maxsp": 7, "maxrp": 3, "rp": 3, "skillpoints": 9}
\ No newline at end of file
......
......@@ -3,6 +3,8 @@ import sys
if 'esp' in sys.platform:
from urandom import getrandbits
elif 'WiPy' in sys.platform:
from ucrypto import getrandbits
else:
from random import getrandbits
......@@ -15,7 +17,7 @@ codes = {'resetall': 0, 'bold': 1, 'underline': 4,
def password_hash(name, password):
if 'esp' in sys.platform:
if sys.platform in ['esp', 'WiPy']:
import uhashlib
return ''.join(['%.2x' % i for i in uhashlib.sha1(password + 'weemud' + name).digest()])
else:
......
......@@ -3,7 +3,7 @@
"""
MudServer author: Mark Frimston - mfrimston@gmail.com
Micropython port and expansion author: Barry Ruffner - barryruffner@gmail.com
Micropython port and extensions for more protocol author: Barry Ruffner - barryruffner@gmail.com
"""
from time import sleep
......@@ -68,6 +68,134 @@ races = {
}
}
feats = {
"""
Adaptive Fighting*
Three or more combat feats Once per day as a move action, gain the benefit of a combat feat you don’t have
Amplified Glitch*
Computers 3 ranks, Intimidate 3 ranks Disrupt devices, causing targets to become shaken for 1 round or more Antagonize Diplomacy 5 ranks, Intimidate 5 ranks Anger a foe, causing it to become off-target and take a −2 penalty to skill checks for 1 round or more
Barricade*
Engineering 1 rank Create your own fragile cover
Basic Melee Weapon Proficiency*
— No penalty to attacks with basic melee weapons
Advanced Melee Weapon Proficiency*
Basic Melee Weapon Proficiency No penalty to attacks with advanced melee weapons
Special Weapon Proficiency*
Basic Melee Weapon Proficiency or Small Arm Proficiency No penalty to attacks with one special weapon
Blind-Fight*
— Reroll miss chances from concealment
Bodyguard*
— Add a +2 bonus to an adjacent ally’s AC as a reaction
In Harm’s Way*
Bodyguard Take the damage of a successful attack against an adjacent ally
Cleave*
Str 13, base attack bonus +1 Make an additional melee attack if the first one hits
Great Cleave*
Str 13, Cleave, base attack bonus +4 Make an additional melee attack after each melee attack that hits Climbing Master Athletics 5 ranks Gain a climb speed equal to your base speed
Combat Casting*
Ability to cast 2nd-level spells +2 bonus to AC and saves against attacks of opportunity when casting spells Connection Inkling Wis 15, character level 5th, no mystic levels Gain the ability to cast minor mystic spells
Coordinated Shot*
Base attack bonus +1 Allies gain a +1 bonus to ranged attacks against foes you threaten
Deadly Aim*
Base attack bonus +1 Take a −2 penalty to weapon attacks to deal extra damage
Deflect Projectiles*
Base attack bonus +8 Spend 1 Resolve Point to attempt to avoid a ranged attack
Reflect Projectiles*
Deflect Projectiles, base attack bonus +16 Spend 1 Resolve Point to attempt to redirect a ranged attack Diehard — You can spend Resolve Points to stabilize and to stay in the fight in the same round Dive for Cover*
Base Reflex save bonus +2 Fall prone in an adjacent square to roll a Reflex save twice Diversion — Use Bluff to create a distraction so that your allies can hide
Drag Down*
— When you are tripped, you can attempt to trip an adjacent foe Enhanced Resistance Base attack bonus +4 Gain damage reduction or energy resistance Extra Resolve Character level 5th Gain 2 additional Resolve Points
Far Shot*
Base attack bonus +1 Reduce penalty due to range increments Fast Talk Bluff 5 ranks Baffle a potential foe, causing it to be surprised when combat begins
Fleet*
— Increase your base speed
Fusillade*
Base attack bonus +1, 4 or more arms Make an automatic-mode attack with multiple small arms Great Fortitude — +2 bonus to Fortitude saves Improved Great Fortitude Great Fortitude, character level 5th Spend 1 Resolve Point to reroll a Fortitude save
Grenade Proficiency*
— No penalty to attacks made with grenades Harm Undead Healing channel connection power, mystic level 1st Expend a spell slot for healing channel to also damage undead
Improved Combat Maneuver*
Base attack bonus +1 +4 bonus to perform one combat maneuver
Pull the Pin*
Improved Combat Maneuver (disarm) Perform a disarm to activate a foe’s grenade
Improved Critical*
Base attack bonus +8 The DC to resist the critical effects of your critical hits increases by 2
Improved Feint*
— Use Bluff to feint as a move action
Greater Feint*
Improved Feint, base attack bonus +6 Foes you feint against are flat-footed for 1 round
Improved Initiative*
— +4 bonus to initiative checks
Improved Unarmed Strike*
— Deal more damage and threaten squares with unarmed strikes Iron Will — +2 bonus to Will saves Improved Iron Will Iron Will, character level 5th Spend 1 Resolve Point to reroll a Will save Jet Dash — Move faster when running, double height and distance when jumping
Kip Up*
Acrobatics 1 rank Stand from prone as a swift action
Light Armor Proficiency*
— No penalty to attack rolls while wearing light armor
Heavy Armor Proficiency*
Str 13, Light Armor Proficiency No penalty to attack rolls while wearing heavy armor
Powered Armor Proficiency*
Str 13, Light Armor Proficiency, Heavy Armor Proficiency, base attack bonus +5 No penalty to attack rolls while wearing powered armor Lightning Reflexes — +2 bonus to Reflex saves Improved Lightning Reflexes Lightning Reflexes, character level 5th Spend 1 Resolve Point to reroll a
Reflex save Lunge*
Base attack bonus +6 Increase reach of melee attacks by 5 feet until the end of your turn Master Crafter Computers, Engineering, Life Science, Mysticism, Physical Science, or Profession 5 ranks Craft items in half the normal time Medical Expert Life Science 1 rank, Medicine 1 rank, Physical Science 1 rank Treat deadly wounds more quickly, and provide long-term care without a medical lab Minor Psychic Power Cha 11 Cast a 0-level spell as a spell-like ability 3/day Psychic Power Cha 13, Minor Psychic Power, character level 4th Cast a 1st-level spell as a spell-like ability 1/day Major Psychic Power Cha 15, Minor Psychic Power, Psychic Power, character level 7th Cast a 2nd-level spell as a spell-like ability 1/day
Mobility*
Dex 13 +4 bonus to AC against attacks of opportunity from movement Agile Casting Key ability score 15, Dex 15, Mobility, caster level 4th Cast a spell at any point during movement Shot on the
Run*
Dex 15, Mobility, base attack bonus +4 Make a ranged attack at any point during movement
Parting Shot*
Dex 15, Mobility, Shot on the Run, base attack bonus +6 Make a single ranged attack when withdrawing Sidestep* Dex 15, Mobility or trick attack Take guarded step as a reaction when a foe misses you with melee attack
Improved Sidestep* Dex 17, Mobility or trick attack class feature, Sidestep Reduce penalties from Sidestep Spring Attack*
Dex 15, Mobility, base attack bonus +4 Move before and after a melee attack
Multi-Weapon Fighting*
— Reduce the penalty for full attacks when using multiple small arms or operative melee weapons
Mystic Strike*
Ability to cast spells Melee and ranged attacks count as magic
Nimble Moves*
Dex 15 Ignore 20 feet of difficult terrain when you move
Opening Volley*
— +2 bonus to a melee attack against a target you damaged with a ranged attack
Penetrating Attack*
Base attack bonus +12 Reduce enemy's DR and energy resistance against your weapons by 5 Penetrating Spell Ability to cast 4th-level spells Reduce enemy's DR and energy resistance against your spells by 5
Quick Draw*
Base attack bonus +1 Draw a weapon as a swift action Skill Focus — +3 insight bonus to one skill Skill Synergy — Gain two new class skills or a +2 insight bonus to those skills Sky Jockey Piloting 5 ranks Make jetpacks, vehicles, and starships go faster
Slippery Shooter*
Dex 15, base attack bonus +6 +3 bonus to AC against attacks of opportunity when making ranged attacks
Small Arm Proficiency*
— No penalty to attacks with small arms
Longarm Proficiency*
Small Arm Proficiency No penalty to attacks with longarms
Heavy Weapon Proficiency*
Str 13, Longarm Proficiency, Small Arm Proficiency No penalty to attacks with heavy weapons
Special Weapon Proficiency*
Basic Melee Weapon Proficiency or Small Arm Proficiency No penalty to attacks with one special weapon
Sniper Weapon Proficiency*
— No penalty to attacks with sniper weapons Spell Focus Ability to cast spells, character level 3rd DCs of spells you cast increase Spell Penetration — +2 bonus to caster level checks to overcome SR Greater Spell Penetration Spell Penetration Additional +2 bonus to caster level checks to overcome SR Spellbane Unable to cast spells or use spell-like abilities +2 insight bonus to saving throws against spells and spell-like abilities
Spry Cover*
Base attack bonus +1 Covering fire grants a +4 bonus to an ally’s Acrobatics check to tumble
Stand Still*
— Make an attack of opportunity to stop a foe’s movement
Improved Stand Still*
Stand Still +4 bonus to melee attacks with Stand Still
Step Up*
Base attack bonus +1 Take a guarded step as a reaction to an adjacent foe moving Step Up
and Strike*
Dex 13, Step Up, base attack bonus +6 Make an attack of opportunity as part of Step Up
Suppressive Fire*
Base attack bonus +1, proficiency with heavy weapons Provide covering fire or harrying fire in an area
Strike Back*
Base attack bonus +1 Ready an action to make a melee attack against a foe with reach Swimming Master Athletics 5 ranks Gain a swim speed equal to your base speed Technomantic Dabbler Int 15, character level 5th, no levels in technomancer Gain the ability to cast minor technomancer spells Toughness — +1 Stamina Point per character level and other bonuses
Unfriendly Fire*
Bluff 5 ranks Trick an attacker into shooting at another enemy adjacent to you Veiled Threat Cha 15, Intimidate 1 rank Intimidated foe doesn’t become hostile
Weapon Focus*
Proficiency with selected weapon type +1 bonus to attack rolls with selected weapon type
Versatile Focus*
Weapon Focus +1 bonus to attack rolls with all weapon types you are proficient with
Weapon Specialization*
Character level 3rd, proficiency with selected weapon type Deal extra damage with selected weapon type
Versatile Specialization*
Weapon Specialization, character level 3rd Deal extra damage with all weapon types you are proficient with
"""
}
themes = {
"Ace Pilot": {
"mods": {"dex": 1}
......@@ -272,8 +400,8 @@ def isalnum(c):
def show_list(id, title, singular_title, subject_list, instructions='Please choose a {} from the list by number: '):
mud.send_message(id, " %green+------------={}=------------+".format(title), nowrap=True)
for idx, subject in enumerate(subject_list):
mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{}. {:<28}'.format(idx, subject),), nowrap=True)
mud.send_message(id, " %green+-------------------------------+", nowrap=True)
mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{:<2}. {:<28}'.format(idx, subject),), nowrap=True)
mud.send_message(id, " %green+--------------------------------+", nowrap=True)
mud.send_message(id, ' (Type %boldhelp [{}]%reset for details)\r\n'.format(singular_title))
mud.send_message(id, instructions.format(singular_title))
......@@ -286,8 +414,20 @@ def get_base_abilities(id):
base[name] += value
return base
def show_skills(id):
mud.send_message(id, "%greenEnter the number of the skill you wish to modify, 1 point will be added to that skill rank. You may not exceed the available skill points.")
mud.send_message(id, '%greenYou can reset to the base values by typing %boldreset')
mud.send_message(id, " %green+--------=Skill Ranks=-------+", nowrap=True)
for idx, skill in enumerate(classes[players[id]["class"]]["skills"]):
skill_rank = players[id]["skills"].get(skill, 0)
mud.send_message(id, " %%green|%%reset%%bold%%white%s%%reset%%green|" % ('{:<2}. {:<19} {:^4}'.format(idx, skill, skill_rank),), nowrap=True)
mud.send_message(id, " %green+- Points: %bold{:<2}%reset%green ---------------+".format(players[id]["skillpoints"]), nowrap=True)
mud.send_message(id, ' (Type %boldhelp [skill]%reset for details)\r\n')
mud.send_message(id, '%greenWhen finished type %bolddone')
def show_abilities(id):
mud.send_message(id, "%greenEnter the number of the ability you wish to modify 1 point will be added to that ability. You may not exceed the available ability points.")
mud.send_message(id, "%greenEnter the number of the ability you wish to modify, 1 point will be added to that ability. You may not exceed the available ability points.")
mud.send_message(id, '%greenYou can reset to the base values by typing %boldreset')
mud.send_message(id, " %green+-----=Abilities=-----+", nowrap=True)
for idx, ability in enumerate(players[id]["abilities"]):
......@@ -396,8 +536,12 @@ def handle_character_create(id, command, params):
if players[id]["maxrp"] < 1:
players[id]["maxrp"] = 1
players[id]["rp"] = players[id]["maxrp"]
players[id]["skillpoints"] = get_ability_mod(id, 'int') + pclass["skillperlevel"]
players[id]["createstep"] = 7
show_skills(id)
elif not command.isdigit() or int(command) + 1 > len(players[id]["abilities"]) or int(command) < 0:
mud.send_message(id, '%cyanInvalid number')
show_abilities(id)
else:
ability_name = list(players[id]["abilities"])[int(command)]
......@@ -407,6 +551,46 @@ def handle_character_create(id, command, params):
players[id]["abilities"][ability_name] += 1
players[id]["abilitypoints"] -= 1
show_abilities(id)
elif players[id]['createstep'] == 7:
if command.lower().startswith("help"):
cmd_handler.parse(id, command, params.lower().strip(), mud, players)
elif command.lower().startswith("reset"):
pclass = classes[players[id]["class"]]
players[id]["skills"] = { }
players[id]["skillpoints"] = get_ability_mod(id, 'int') + pclass["skillperlevel"]
show_skills(id)
elif command.lower().startswith("done"):
if players[id]["skillpoints"] > 0:
mud.send_message(id, '%cyanPlease spend all available skill points.')
show_skills(id)
else:
players[id]["createstep"] = 8
show_list(id, "Feats", "feat", feats)
elif not command.isdigit() or int(command) + 1 > len(themes) or int(command) < 0:
show_skills(id)
else:
skill_name = classes[players[id]["class"]]["skills"][int(command)]
if players[id]["skillpoints"] > 0:
if players[id]["skills"].get(skill_name):
players[id]["skills"][skill_name] += 1
else:
players[id]["skills"][skill_name] = 1
players[id]["skillpoints"] -= 1
show_skills(id)
elif players[id]['createstep'] == 8:
if command.lower().startswith("help"):
cmd_handler.parse(id, command, params.lower().strip(), mud, players)
elif not command.isdigit() or int(command) + 1 > len(themes) or int(command) < 0:
show_list(id, "Feats", "feat", feats)
else:
# skill_name = classes[players[id]["class"]]["skills"][int(command)]
# if players[id]["skillpoints"] > 0:
# if players[id]["skills"].get(skill_name):
# players[id]["skills"][skill_name] += 1
# else:
# players[id]["skills"][skill_name] = 1
# players[id]["skillpoints"] -= 1
show_list(id, "Feats", "feat", feats)
save_object_to_file(players[id], "players/{}.json".format(players[id]["name"]))
# main game loop. We loop forever (i.e. until the program is terminated)
......