from __future__ import division import wcs, playerlib, es, random, gamethread from wcs import wcs en = 'Enchantress' race = wcs.Race(en) raceskill = wcs.Race(en).registerSkill raceskill('Impetus', 5, 2, "Deal extra damage based on the distance between you and your victim") raceskill('Enchant', 5, 1, "Freeze your victim 3-7% chance") raceskill('Untouchable' , 5, 3, "Dodge bullets chance 2-10%") raceskill('Eyes Of Night', 3, 1, "33-100% chance of complete light") race.registerUltimate("Nature's Attendents", 3, 3, 5, "Heal nearby teammates and yourself for your level * 10 hp") race.registerMinLevel(90) race.registerTeamLimit(2) def player_ultimate_on(event_var): userid = int(event_var['userid']) if wcs.GetRace(userid) == en: if wcs.GetLevel(userid, en, "Nature's Attendents"): player_loc = es.getplayerlocation(userid) es.ServerVar('Heal').set(0) health_range = wcs.GetLevel(userid, en, "Nature's Attendents") * 100 wcs.Effect().Ring1(userid, wcs.GetLevel(userid, en, "Nature's Attendents") * 150, 2, 0, 0, 255) if playerlib.getPlayer(userid).attributes['teamid'] == 2: wcs.Command(userid).Near(health_range, health_range, health_range, give_health, '#t') elif playerlib.getPlayer(userid).attributes['teamid'] == 3: wcs.Command(userid).Near(health_range, health_range, health_range, give_health, '#t') wcs.Command(userid).SetCoolDown("Nature's Attendents", 12) def give_health(userid, attacker): health_to_give = wcs.GetLevel(attacker, en, "Nature's Attendents") * 10 health = playerlib.getPlayer(userid).get('health') if health + health_to_give <= 150: playerlib.getPlayer(userid).set('health', health + health_to_give) elif health < 150 and health > 100: playerlib.getPlayer(userid).set('health', 150) def player_hurt(event_var): if event_var['weapon'] != 'point_hurt': userid = int(event_var['userid']) attacker = int(event_var['attacker']) distance = playerlib.getPlayer(userid).get('distance', [attacker, 'xyz']) if wcs.GetRace(attacker) == en: if wcs.GetLevel(attacker, en, 'Impetus'): wcs.Command(userid).Damage(int(((wcs.GetLevel(attacker, en, 'Impetus') + ((3 * wcs.GetLevel(attacker, en, 'Impetus')))) / 2000) * distance), 32, attacker) if random.randint(1, 4) == 4: wcs.Effect().Misc5(userid, 1, 1) if wcs.GetLevel(attacker, en, 'Enchant'): if random.randint((wcs.GetLevel(attacker, en, 'Enchant') + wcs.GetLevel(attacker, en, 'enchant')), 100) > 50: es.server.queuecmd('est_freeze %s 1'%userid) gamethread.delayed(wcs.GetLevel(attacker, en, 'Enchant') * 0.3, es.server.queuecmd, 'est_freeze %s 0'%userid) if random.randint(1, 3) == 1: wcs.Effect().Misc2(userid, 1, 1) def prep_hurt(event_var): if wcs.GetRace(userid) == en: if wcs.GetLevel(userid, en, 'Untouchable'): if random.randint(1, 100) <= wcs.GetLevel(userid, en, 'Untouchable') * 4: wcs.Command(userid).SaveLife(int(event_var['dmg_health'])) wcs.Effect().Misc2(userid, 1, 1) wcs.Effect().Misc3(userid, 1, 1) def player_spawn(event_var): userid = int(event_var['userid']) if wcs.GetRace(userid) == 'Enchantress': if wcs.GetLevel(userid, en, 'Eyes Of Night'): if random.randint(wcs.GetLevel(userid, en, 'Eyes Of Night'), 3) == 3: es.server.queuecmd('cheatexec %s mat_fullbright 1'%userid) else: es.server.queuecmd('cheatexec %s mat_fullbright 0'%userid) else: es.server.queuecmd('cheatexec %s mat_fullbright 0'%userid) else: es.server.queuecmd('cheatexec %s mat_fullbright 0'%userid)