import curses.py class tile: def __init__(self ,x , y): self.x = x self.y = y class map: def __init__(self): self.tiles = [] def generateNewMap(self): #WIP on the map generator. pass #class job: #Anything that your minions can do. A job can range from constructing buildings to #fishing in a lake or crafting. class skill: def __init__(self, name, level, experience, adv_flag): self.name = name self.level = level self.exp = experience self.adv_flag = adv_flag #For every completed job, minions gain 10 experience in the associated skill. #The number of items gathered can be found by dividing total exp needed by 10. #With the ladder, each time the minion levels up the exp gets reset to 0. #Then the minion must gain the new amount of exp to gain a level. #For example, at level 1, Bob must do this skill's job 10 times. #And then he must complete this skill's job 21 more times to get level 3. self.exp_ladder = [ 0, 100, 210, 330, 460, 600, 750, 910, 1080, 1260, 1450, 1650, 1860, 2080, 2310, 2550, 2800, 3060, 3330, 3610, 3900, 4200, 4510, 4830, 5160, 5500, 5850, 6210, 6580, 10000 ] def checkLevelUp(self): if exp > exp_ladder[level]: #Show level up text and have an icon appear above his head that is clickable so the user #can see what skill that minion leveled up and his stats. exp = 0 level += 1 def getLevel(self): if adv_flag == True: value = level + 30 elif adv_flag != True: value = level return value def getTotalExp(self): return exp def gain_exp(self, amount): exp = exp + amount class entity: def __init__(self, x, y, width, height): self.x = x self.y = y self.width = width self.height = height class building(entity): def __init__(self, item, job, human): self.job = job self.material = item.desc self.hitpoints = ((self.width * self.height) / 2) * item.buildMOD self.armor = item.buildMOD + human.getBuildSkillLevel() / 3 class human(entity): def __init__(self, name, HP, ATK, DEF, MATK, MDEF): self.name = name self.HP = HP self.ATK = ATK self.DEF = DEF self.MATK = MATK self.MDEF = MDEF self.exp = 0 self.level = 1 self.job = "None" ''' Skills to add: Basic Skills: 1. Construction 2. Cooking 3. Crafting 4. Farming 5. Fishing 6. First Aid 7. Foraging 8. Hunting 9. Mining 10. Woodcutting Advanced Skills (When the basic skill is level 30): 1. Architecture 2. Culinary 3. Inventing 4. Industry 5. Hatchery 6. Surgery 7. Conservation 8. Herding 9. Drilling 10. Logging Combat Skills: 1. Fighting 2. Shooting 3. Casting 4. Blocking 5. Dodging 6. Resisting ''' def setCurrentJob(self, newJob): self.job = newJob def getCurrentJob(self): return self.job def gather(self, resource): #Add code to make a path between the resource and the collection building. pass def checkDeath(self): if self.hitpoints <= 0: #Delete this object pass class resource(entity): def __init__(self, name, numItems, gatherTime): self.name = name self.numItems = numItems self.gatherTime = gatherTime def reduceItems(self, itemsReduced): self.numItems = self.numItems - itemsReduced def checkDeath(self): if self.numItems <= 0: #Delete this object pass class item: def __init__(self, parentResource, x, y, weight, buildMOD): self.parent = parentResource self.x = x self.y = y self.weight = weight self.buildMOD = buildMOD
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question