League of Legends is a competitive Multiplayer Online Battle Arena (MOBA) type game that relies on teamwork and basic grinding mechanics
You need money for items and you get money by killing minions. The goal of the game is basically to take the oppenents base.
Here is a link to the official site http://www.leagueoflegends.com/
Here is a link to a game from a tournament http://www.own3d.tv/video/126962/Rock_Solid__RS__vs_Epik_Gaming__EG__G1_-_League_of_Legends_NA_Dreamhack_Qualifier
{{{id=4| ''' Champion Implementation Known Issues: - There is no current way of implementing runes and masteries - There are no unique passives and damage is only calculated on damage and mitigation - Creating a champion requires too many parameters should come up with a way to create a more simple one - Champion object lacks many additional attributes such as critical chance, dodge chance and other such things - There is no way to calculate True damage or %damage skills because there is no HP attribute yet - There is no level up system + champion's level is "static" once created + can be changed but will not affect the damage calculation tests Things to-do: - Adding on the additional attributes would be good. - HP to see if a champion can be killed in a certain amount of attacks - Can solo baron function - Create a level up system/max level function - Implement a check system so to make sure all inputs are valid How to Use: -Champion Creation: + To create a champion you must specify all the parameters + The parameters(in order with type): * name - a String * level - Integer * attack damage - Integer * attack damage per level - Integer * ability power - Integer * armor - Positive RR * armor per level - Positive RR * magic resistance - Positive RR * magic resistance per level - Positive RR * rank of Q skill - Integer [0,5] * base damage of Q skill - Integer * damage per level or Q skill - Integer * bonus damage for Q skill - tuple - has the ratios scaling in this order (AttackDamage, Bonus AttackDamage, AP) e.g. (1,0,0) - if there are additive ratios then you need to specify both - if skill does no damage then specify a tuple with all zeroes * type of damage of Q skill - Boolean - if the damage type is physical then use True - if the damage type is magical then use False - there is currently no way to specify true damage * The same thing again but for the W, E, and R skills Example(I suggest just copying and pasting this making the changes where needed): Irelia = champion("Irelia", 1,56.3,3.3,0,15,3.75,30,1.25,0,20, 30, (1,0,0),True, 0,0,0,(0,0,0),False, 0,80,50 (0,0,.5),False, 0,85, 50, (0,.6,.5),True) ''' import pickle class champion: def __init__(self, name,level,ad, adperlevel, ap, armor,armorperlevel, mres,mresperlevel, qRank,qBase,qperlevel, qBonus,qType, wRank, wBase,wperlevel,wBonus,wType, eRank,eBase,eperlevel,eBonus,eType, rRank,rBase,rperlevel,rBonus,rType): self.name = name self.level = level self.baseAD = ad self.ad = ad + adperlevel * level self.adperlevel = adperlevel self.ap = ap self.armor = armor + armorperlevel*level self.mres = mres + mresperlevel*level self.qRank = qRank self.qBase = qBase self.qperlevel = qperlevel self.qBonus = qBonus self.qType = qType self.wRank = wRank self.wBase = wBase self.wperlevel = wperlevel self.wBonus = wBonus self.wType = wType self.eRank = eRank self.eBase = eBase self.eperlevel = eperlevel self.eBonus = eBonus self.eType = eType self.rRank = rRank self.rBase = rBase self.rperlevel = rperlevel self.rBonus = rBonus self.rType = rType self.equips = [] def __repr__(self): return 'Champion %s'%self.name def __str__(self): return "Champion: " + self.name + "\nCurrent Level: " + str(self.level) + "\nAttack Damage: " + str(self.ad) + "\nAbility Power " + str(self.ap) ''' Equipping your champion and viewing equipment: This is how you give your champion equip that will modify your stats Here is a list of implemented [BFSword, infinityEdge, blackCleaver, bloodthirster, bloodthirster100, pickAxe, lastWhisper, tiamat, bilgewaterCutlass, madredsBloodrazor, longSword, madredsRazor, wrigglesLanturn, brutalizer, hexdrinker, phage, frozenMallet, ampTome, fiendishCodex, hauntingGuise, hextechRevolver, kagesLuckyPick, malady, rylaisCrystalScepter, sheen, voidStaff, willOfTheAncients, blastingWand, abyssalScepter, lichBane, morellosEvilTome, rodOfAges, rodOfAges80, needlesslyLargeRod, rabadonsDeathcap, zhonyasHourglass, hextechGunblade, guinsoosRageblade, trinityForce, clothArmor, chainVest, aeigisOfTheLegion, frozenHeart, guardianAngel, randuinsOmen, wardensMail, thornmail, sunfireCape, glacialShroud, atmasImpaler, nullMagicMantle, chaliceOfHarmony, spiritVisage, witsEnd, negatronCloak, bansheesVeil, forceOfNature, quickSilverSash] The way to equip champions is quite easy since the item implementation system is simple Example: champion.equip(itemObject) Assuming you're using the example champion from before Input: Irelia.equip(trinityForce) Output: "Irelia has equipped trinityForce" To view the equipment simply look at the equips array of your champion Example: Input: Irelia.equips Output: ['trinityForce'] ''' def equip(self, item): if len(self.equips) < 6: self.equips.append(item.name) self.ap += item.ap self.ad += item.ad self.armor += item.armor self.mres += item.mres return "You have equipped " + item.name else: return "You have reached your maximum amount of items" ''' The unequip function works exactly the same as equip except it removes stats and bonuses ''' def unequip(self,item): if self.equips.__contains__(item.name): self.equips.remove(item.name) self.ad -= item.ad self.ap -= item.ap self.armor -= item.armor self.mres -= item.mres return "You have unequipped " + item.name else: return "You do not have that item equipped or you do not have any equips" ''' Damage Calculation: This function will give you the damage output when attacking another champion with a specified skill or attack. Its parameters in order are: - the type of attack - String + the only valid strings are "q", "w", "e", "r", and "aa" + "aa" is auto attack, the rest are the respective skill - enemy champion- champion object Example: Input: Irelia.attackWith("aa", Jarvan) Output: Assuming Jarvan is level 1 with the correct base stats 50.94017094017093 ''' def attackWith(self, type, enemyChampion): if isinstance(enemyChampion, champion): if type == 'aa': return self.damageCalc(enemyChampion.armor, self.ad) elif type == 'q': if self.qType: return self.damageCalc(enemyChampion.armor, self.qBase + self.qRank*self.qperlevel + self.qBonus[0]*self.ad +(self.qBonus[1]*self.ad -self.level*self.adperlevel - self.baseAD ) + self.qBonus[2]*self.ap) else: return self.damageCalc(enemyChampion.mres, self.qBase + self.qRank*self.qperlevel + self.qBonus[0]*self.ad +(self.qBonus[1]*self.ad -self.level*self.adperlevel - self.baseAD ) + self.qBonus[2]*self.ap) elif type == 'w': if self.wType: return self.damageCalc(enemyChampion.armor, self.wBase + self.wRank*self.wperlevel + self.wBonus[0]*self.ad +(self.wBonus[1]*self.ad -self.level*self.adperlevel - self.baseAD ) + self.wBonus[2]*self.ap) else: return self.damageCalc(enemyChampion.mres, self.wBase + self.wRank*self.wperlevel + self.wBonus[0]*self.ad +(self.wBonus[1]*self.ad -self.level*self.adperlevel - self.baseAD ) + self.wBonus[2]*self.ap) elif type == 'e': if self.eType: return self.damageCalc(enemyChampion.armor, self.eBase + self.eRank*self.eperlevel + self.eBonus[0]*self.ad +(self.eBonus[1]*self.ad -self.level*self.adperlevel - self.baseAD ) + self.eBonus[2]*self.ap) else: return self.damageCalc(enemyChampion.mres, self.eBase + self.eRank*self.eperlevel + self.eBonus[0]*self.ad +(self.eBonus[1]*self.ad -self.level*self.adperlevel - self.baseAD ) + self.eBonus[2]*self.ap) elif type == 'r': if self.rType: return self.damageCalc(enemyChampion.armor, self.rBase + self.rRank*self.rperlevel + self.rBonus[0]*self.ad +(self.rBonus[1]*self.ad -self.level*self.adperlevel - self.baseAD ) + self.rBonus[2]*self.ap) else: return self.damageCalc(enemyChampion.mres, self.rBase + self.rRank*self.rperlevel + self.rBonus[0]*self.ad +(self.rBonus[1]*self.ad -self.level*self.adperlevel - self.baseAD ) + self.rBonus[2]*self.ap) else: raise ValueError, "Valid values for first parameter 'q', 'w', 'e', 'r', 'aa'" else: raise TypeError, "2nd parameter is not of type champion" ''' Simple helper function for damage calculation ''' def damageCalc(self, armor, trueDamage): return float((trueDamage)*(1-(armor/(100+armor)))) ''' A follow up function to the attackWith making it easy to see how much damage a chain of attacks will do The parameters: - the combo of attacks - tuple or list + the tuple or list is of strings that are valid inputs for attackWith, i.e. "aa", "q", "w","e","r" - an enemy champion - champion object Example: Input: Irelia.comboWith(("aa","aa","e"),Jarvan) Output: 154.15384615384613 ''' def comboWith(self, combo, enemyChampion): damage = 0 for attack in combo: damage += self.attackWith(attack, enemyChampion) return damage /// }}} {{{id=8| ''' item implementation Known Issues: - weapon and armor unique passives were not included - items only include 4 stat changing attributes, ad, ap, armor, mres - items should include additional stat changing attributes such as critical chance, lifesteal, spellvamp, hp, mp and such - the list of items is not complete - the string passed into the item object should be changed to a string that looks nicer - if implementation of unique passives are made then the addition of "charged" items should be implemented/improved + such items include archangel staff, manamune, bloodthister Item creation: very simple since there are only a few parameters example = item("item name", 10,0,0,0) The parameter order is as follows with type - item name - String - attack damage - Integer - ability power - Integer - armor - Integer - magic resistance - Integer ''' import pickle class item: def __init__(self, name, ad, ap, armor, mres): self.name = name self.ad = ad self.ap = ap self.armor = armor self.mres = mres def __repr__(self): return self.name def __str__(self): return "Item: " + self.name + "\nAttack Damage: " + str(self.ad) + "\nAbility Power: " + str(self.ap) + "\nArmor: " + str(self.armor) + "\nMagic Resistance: " + str(self.mres) #bf sword items BFSword = item("BFSword",45,0,0,0) infinityEdge = item("infinityEdge",80,0,0,0) blackCleaver = item("blackCleaver", 55,0,0,0) bloodthirster = item("bloodthister", 60,0,0,0) bloodthirster100 = item("bloodthister100", 100,0,0,0) #pick axe items pickAxe = item("pickAxe",25,0,0,0) lastWhisper = item("lastWhisper", 40,0,0,0) tiamat = item("tiamat",50,0,0,0) bilgewaterCutlass = item("bilgewaterCutlass", 35,0,0,0) madredsBloodrazor = item("madredsBloodrazor", 30,0,25,0) #long sword items longSword = item("longSword", 10,0,0,0) madredsRazor = item("madredsRazor", 15,0,23,0) wrigglesLanturn = item("wrigglesLanturn", 23,0,0,30) brutalizer = item("brutalizer", 25,0,0,0) hexdrinker = item("hexdrinker",35,0,0,30) phage = item("phage", 18,0,0,0) frozenMallet = item("frozenMallet", 20,0,0,0) #amp tome items ampTome = item("ampTome",0,20,0,0) fiendishCodex = item("fiendishCodex", 0,30,0,0) hauntingGuise = item("hauntingGuise", 0, 25,0,0) hextechRevolver = item("hextechRevolver", 0,40,0,0) kagesLuckyPick = item("kagesLuckyPick", 0,25,0,0) malady = item("malady", 0,25,0,0) rylaisCrystalScepter = item("rylaisCrystalScepter", 0,80,0,0) sheen = item("sheen", 0,25,0,0) voidStaff = item("voidStaff", 0,70,0,0) willOfTheAncients = item("willOfTheAncients", 0,80,0,0) #blasting wand items blastingWand = item("blastingWand", 0,40,0,0) abyssalScepter = item("abyssalScepter", 0,70,0,5) lichBane = item("lichBane", 0,80,0,30) morellosEvilTome = item("morellosEvilTome", 0,75,0,0) rodOfAges = item("rodOfAges", 0,60,0,0) rodOfAges80 = item("rodOfAges80", 0,80,0,0) #needlessly large wand items needlesslyLargeRod = item("needlesslyLargeRod", 0,80,0,0) rabadonsDeathcap = item("rabadonsDeathcap", 0,155,0,0) zhonyasHourglass = item("zhonyasHourglass", 0,100,50,0) #hybrid items hextechGunblade = item("hextechGunblade", 60,75,0,0) guinsoosRageblade = item("guinsoosRageblade", 35,45,0,0) trinityForce = item("trinityForce", 30,30,0,0) #armor items clothArmor = item("clothArmor", 0,0,18,0) chainVest = item("chainVest", 0,0,45,0) aeigisOfTheLegion = item("aegisOfTheLegion", 8,0,30,39) frozenHeart = item("frozenHeart", 0,0,99,0) guardianAngel = item("guardianAngel", 0,0,68,38) randuinsOmen = item("randuinsOmen", 0,0,75,0) wardensMail = item("wardensMail", 0,0,50,0) thornmail = item("thornmail", 0,0,100,0) sunfireCape = item("sunfireCape", 0,0,45,0) glacialShroud = item("glacialShroud", 0,0, 45,0) atmasImpaler = item("atmasImpaler", 0 ,0, 45,0) #magic res items nullMagicMantle = item("nullMagicMantle", 0,0,0,24) chaliceOfHarmony = item("chaliceOfHarmony", 0,0,0,30) spiritVisage = item("spiritVisage", 0,0,0,30) witsEnd = item("witsEnd", 0,0,0,30) negatronCloak = item("negatronCloak", 0,0,0,48) bansheesVeil = item("bansheesVeil", 0,0,0,50) forceOfNature = item("forceOfNature", 0,0,0,76) quickSilverSash = item("quickSilverSash",0,0,0,56) /// }}} {{{id=17| Jarvan = champion("Jarvan", 1,50,3.4,0,14,3,30,1.25,0,70, 50, (0,1.1,0),True, 0,0,0,(0,0,0), True, 0,60, 50, (0,0,.8),False,1,200, 125, (0,1.5,0),True) Irelia = champion("Irelia", 1,56.3,3.3,0,15,3.75,30,1.25,0,20, 30, (1,0,0),True, 0 ,0,0,(0,0,0),False, 0,80,50,(0,0,.5),False, 0,85, 50, (0,.6,.5),True) Jarvan.equip(infinityEdge) Jarvan.attackWith("r",Irelia) /// }}} {{{id=30| print Irelia.equip(trinityForce) print Irelia.equip(BFSword) print Irelia.equips Jarvan.attackWith("r",Irelia) Irelia.comboWith(("aa","aa","r"),Jarvan) /// }}} {{{id=28| print str(Irelia) +"\n" print Jarvan /// }}} {{{id=23| allItems = [BFSword, infinityEdge, blackCleaver, bloodthirster, bloodthirster100, pickAxe, lastWhisper, tiamat, bilgewaterCutlass, madredsBloodrazor, longSword, madredsRazor, wrigglesLanturn, brutalizer, hexdrinker, phage, frozenMallet, ampTome, fiendishCodex, hauntingGuise, hextechRevolver, kagesLuckyPick, malady, rylaisCrystalScepter, sheen, voidStaff, willOfTheAncients, blastingWand, abyssalScepter, lichBane, morellosEvilTome, rodOfAges, rodOfAges80, needlesslyLargeRod, rabadonsDeathcap, zhonyasHourglass, hextechGunblade, guinsoosRageblade, trinityForce, clothArmor, chainVest, aeigisOfTheLegion, frozenHeart, guardianAngel, randuinsOmen, wardensMail, thornmail, sunfireCape, glacialShroud, atmasImpaler, nullMagicMantle, chaliceOfHarmony, spiritVisage, witsEnd, negatronCloak, bansheesVeil, forceOfNature, quickSilverSash] allChampions = [Jarvan,Irelia] import sqlite3 file = 'sqlite0' if os.path.exists(file): os.unlink(file) db = sqlite3.connect(file) cursor = db.cursor() cursor.execute("""CREATE TABLE items (name TEXT, data TEXT, UNIQUE(name))""") cursor.execute("""CREATE TABLE champions (name TEXT, data TEXT, UNIQUE(name))""") for item in allItems: try: s = pickle.dumps(item) t = (item.name, s) cursor.execute('INSERT INTO items VALUES(?,?)', t) except: print "Unable to insert value " + item.name for champion in allChampions: try: s = pickle.dumps(champion) t = (champion.name, s) cursor.execute('INSERT INTO items VALUES(?,?)', t) except: print "Unable to insert value " + champion.name db.commit() items = cursor.execute("SELECT * FROM items") champions = cursor.execute("SELECT * FROM champions") for item in items: print item /// }}}