hexsha
stringlengths
40
40
size
int64
5
2.06M
ext
stringclasses
10 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
248
max_stars_repo_name
stringlengths
5
125
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
248
max_issues_repo_name
stringlengths
5
125
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
248
max_forks_repo_name
stringlengths
5
125
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
5
2.06M
avg_line_length
float64
1
1.02M
max_line_length
int64
3
1.03M
alphanum_fraction
float64
0
1
count_classes
int64
0
1.6M
score_classes
float64
0
1
count_generators
int64
0
651k
score_generators
float64
0
1
count_decorators
int64
0
990k
score_decorators
float64
0
1
count_async_functions
int64
0
235k
score_async_functions
float64
0
1
count_documentation
int64
0
1.04M
score_documentation
float64
0
1
19310709fccc926261a99f530ec7e2d84e44988f
3,142
py
Python
Drop7/test/Disk_Test.py
SanderP99/Drop7
b11c2590d3cc1e311fb34a4635a1f6c075d9cb59
[ "MIT" ]
null
null
null
Drop7/test/Disk_Test.py
SanderP99/Drop7
b11c2590d3cc1e311fb34a4635a1f6c075d9cb59
[ "MIT" ]
null
null
null
Drop7/test/Disk_Test.py
SanderP99/Drop7
b11c2590d3cc1e311fb34a4635a1f6c075d9cb59
[ "MIT" ]
null
null
null
# import Drop7.Board as Board import Drop7.Disk as Disk def test_Is_Proper_Disk__Legal_Case(score, max_score): """Function is_proper_disk: given disk is proper disk.""" max_score.value += 1 try: assert Disk.is_proper_disk(4, Disk.init_disk(Disk.VISIBLE, 4)) assert Disk.is_proper_disk(4, Disk.init_disk(Disk.CRACKED, 1)) score.value += 1 except: pass def test_Is_Proper_Disk__Illegal_State(score, max_score): """Function is_proper_disk: illegal state.""" max_score.value += 1 try: assert not Disk.is_proper_disk(4, Disk.init_disk(("ABC",), 4)) score.value += 1 except: pass def test_Is_Proper_Disk__Illegal_Value(score, max_score): """Function is_proper_disk: illegal value.""" max_score.value += 1 try: assert not Disk.is_proper_disk(4, Disk.init_disk(Disk.VISIBLE, 5)) score.value += 1 except: pass def test_Init_Disk__Single_Case(score,max_score): """Function init_disk: single case.""" max_score.value += 1 try: disk = Disk.init_disk(Disk.VISIBLE,4) assert Disk.get_state(disk) == Disk.VISIBLE assert Disk.get_value(disk) == 4 score.value += 1 except: pass def test_Get_Random_Disk__Single_Case(score,max_score): """Function get_random_disk: single case.""" max_score.value += 1 try: for i in range(1,1000): disk = Disk.get_random_disk(7,{Disk.VISIBLE,Disk.WRAPPED}) assert Disk.get_state(disk) in {Disk.VISIBLE,Disk.WRAPPED} assert 1 <= Disk.get_value(disk) <= 7 score.value += 1 except: pass def test_Set_State(score, max_score): """Function set_state: single case.""" max_score.value += 1 try: disk = Disk.init_disk(Disk.CRACKED,5) Disk.set_state(disk, Disk.VISIBLE) assert Disk.get_state(disk) == Disk.VISIBLE score.value += 1 except: pass def test_Set_Value(score, max_score): """Function set_value: single case.""" max_score.value += 1 try: disk = Disk.init_disk(Disk.CRACKED,5) Disk.set_value(disk, 8) assert Disk.get_value(disk) == 8 score.value += 1 except: pass def test_Get_Disk_Copy(score, max_score): """Function get_disk_copy: single case.""" max_score.value += 3 try: disk = Disk.init_disk(Disk.CRACKED,5) copy = Disk.get_disk_copy(disk) assert Disk.get_state(copy) == Disk.get_state(disk) assert Disk.get_value(copy) == Disk.get_value(disk) # Checking that a new disk has been returned. Disk.set_value(disk,Disk.get_value(disk)+100) assert Disk.get_value(copy) == Disk.get_value(disk)-100 score.value += 3 except: pass disk_test_functions = \ { test_Is_Proper_Disk__Legal_Case, test_Is_Proper_Disk__Illegal_State, test_Is_Proper_Disk__Illegal_Value, test_Init_Disk__Single_Case, test_Get_Random_Disk__Single_Case, test_Set_State, test_Set_Value, test_Get_Disk_Copy }
26.854701
74
0.638765
0
0
0
0
0
0
0
0
426
0.135582
19340df43351011be81d21c8afe59df9e5f9d483
1,821
py
Python
Sensors/MaxSonarTTY.py
paceaux/pi-projects
c9eb1f138868d41f8304c4251382cc4a6d161ba8
[ "MIT" ]
null
null
null
Sensors/MaxSonarTTY.py
paceaux/pi-projects
c9eb1f138868d41f8304c4251382cc4a6d161ba8
[ "MIT" ]
null
null
null
Sensors/MaxSonarTTY.py
paceaux/pi-projects
c9eb1f138868d41f8304c4251382cc4a6d161ba8
[ "MIT" ]
null
null
null
#!/usr/bin/python3 # Filename: maxSonarTTY.py # Reads serial data from Maxbotix ultrasonic rangefinders # Gracefully handles most common serial data glitches # Use as an importable module with "import MaxSonarTTY" # Returns an integer value representing distance to target in millimeters from time import time from serial import Serial class MaxSonarTTY: """Uses the MaxSonarTTY to find a range""" def __init__(self, serialDevice = "/dev/ttyS0", maxWait = 3): self.serialDevice = serialDevice self.maxWait = maxWait print('self.device', self.serialDevice) print('self.maxWait', self.maxWait) def measure(self): print("serialDevice", self.serialDevice) ser = Serial(self.serialDevice, 9600, 8, 'N', 1, timeout=1) timeStart = time() valueCount = 0 print(ser); while time() < timeStart + self.maxWait: if ser.inWaiting(): print("it's waiting") bytesToRead = ser.inWaiting() valueCount += 1 if valueCount < 2: # 1st reading may be partial number; throw it out continue testData = ser.read(bytesToRead) if not testData.startswith(b'R'): # data received did not start with R continue try: sensorData = testData.decode('utf-8').lstrip('R') except UnicodeDecodeError: # data received could not be decoded properly continue try: mm = int(sensorData) except ValueError: # value is not a number continue ser.close() return(mm) ser.close()
33.109091
84
0.556837
1,480
0.81274
0
0
0
0
0
0
561
0.308072
1935874de5ab32170824f8aa54ca87bd5761ec1c
4,697
py
Python
src/estimator.py
NoumbissiValere/covid-19-cure
7b4ace8cb746c6ee5952bfd678303500f5ab58dc
[ "MIT" ]
null
null
null
src/estimator.py
NoumbissiValere/covid-19-cure
7b4ace8cb746c6ee5952bfd678303500f5ab58dc
[ "MIT" ]
null
null
null
src/estimator.py
NoumbissiValere/covid-19-cure
7b4ace8cb746c6ee5952bfd678303500f5ab58dc
[ "MIT" ]
null
null
null
def estimator(data): currentlyInfected = covid19ImpactEstimator(data['reportedCases']) severeCurrentlyInfected = covid19ImpactEstimator(data['reportedCases'], severe=True) infectionsByRequestedTime = getInfectionsByRequestedTime(currentlyInfected, data['periodType'], data['timeToElapse']) severeInfectionsByRequestedTime = getInfectionsByRequestedTime(severeCurrentlyInfected, data['periodType'], data['timeToElapse']) impactSevereCasesByRequestedTime = getPercent(infectionsByRequestedTime, percent=15) severeImpactSevereCasesByRequestedTime = getPercent(severeInfectionsByRequestedTime, percent=15) hospitalBedsByRequestedTime = getHospitalBedsByRequestedTime(impactSevereCasesByRequestedTime, data['totalHospitalBeds']) severeHospitalBedsByRequestedTime = getHospitalBedsByRequestedTime(severeImpactSevereCasesByRequestedTime, data['totalHospitalBeds']) casesForICUByRequestedTime = getPercent(infectionsByRequestedTime, percent=5) severeCasesForICUByRequestedTime = getPercent(severeInfectionsByRequestedTime, percent=5) casesForVentilatorsByRequestedTime = getPercent(infectionsByRequestedTime, percent=2) severeCasesForVentilatorsByRequestedTime = getPercent(severeInfectionsByRequestedTime, percent=2) numDays = getDays(data['periodType'], data['timeToElapse']) dollarsInFlight = getDollars(infectionsByRequestedTime, data['region']['avgDailyIncomeInUSD'], data['region']['avgDailyIncomePopulation'], numDays) severeDollarsFlight = getDollars(severeInfectionsByRequestedTime, data['region']['avgDailyIncomeInUSD'], data['region']['avgDailyIncomePopulation'], numDays) output = { 'data': data, 'impact': { 'currentlyInfected': currentlyInfected, 'infectionsByRequestedTime': infectionsByRequestedTime, 'severeCasesByRequestedTime': int(impactSevereCasesByRequestedTime), 'hospitalBedsByRequestedTime': int(hospitalBedsByRequestedTime), 'casesForICUByRequestedTime': int(casesForICUByRequestedTime), 'casesForVentilatorsByRequestedTime': int(casesForVentilatorsByRequestedTime), 'dollarsInFlight': int(dollarsInFlight) }, 'severeImpact': { 'currentlyInfected': severeCurrentlyInfected, 'infectionsByRequestedTime': severeInfectionsByRequestedTime, 'severeCasesByRequestedTime': int(severeImpactSevereCasesByRequestedTime), 'hospitalBedsByRequestedTime': int(severeHospitalBedsByRequestedTime), 'casesForICUByRequestedTime': int(severeCasesForICUByRequestedTime), 'casesForVentilatorsByRequestedTime': int(severeCasesForVentilatorsByRequestedTime), 'dollarsInFlight': int(severeDollarsFlight) } } return output def covid19ImpactEstimator(reportedCases, severe=False): if severe: return reportedCases * 50 return reportedCases * 10 def getDays(periodType, value): if periodType == 'days': return value elif periodType == 'weeks': return value * 7 else: return value * 30 def getInfectionsByRequestedTime(currentlyInfected, periodType, timeToElapse): numDays = getDays(periodType, timeToElapse) factor = numDays // 3 return currentlyInfected * pow(2, factor) def getPercent(infectionsByRequestedTime, percent): return float((percent / 100) * float(infectionsByRequestedTime)) def getHospitalBedsByRequestedTime(value, totalHospitalBeds): availableBeds = float((35 / 100) * float(totalHospitalBeds)) return float(availableBeds - float(value)) def getDollars(infections, avgUSD, avgPop, numDays): return float((float(infections) * avgPop * avgUSD) / numDays)
51.054348
110
0.604003
0
0
0
0
0
0
0
0
681
0.144986
1935e935a94ea899193f63cf6a01d898e2f578ec
2,577
py
Python
tests/output/TestFile.py
dstore-dbap/LumberMill
b7cbadc209a83386871735b8ad88b61da917a6ab
[ "Apache-2.0" ]
15
2015-12-14T19:07:28.000Z
2022-02-28T13:32:11.000Z
tests/output/TestFile.py
dstore-dbap/LumberMill
b7cbadc209a83386871735b8ad88b61da917a6ab
[ "Apache-2.0" ]
null
null
null
tests/output/TestFile.py
dstore-dbap/LumberMill
b7cbadc209a83386871735b8ad88b61da917a6ab
[ "Apache-2.0" ]
4
2017-02-08T10:49:55.000Z
2019-03-19T18:47:46.000Z
import sys import os import io import gzip import mock import tempfile import lumbermill.utils.DictUtils as DictUtils from tests.ModuleBaseTestCase import ModuleBaseTestCase from lumbermill.output import File class TestFile(ModuleBaseTestCase): def setUp(self): super(TestFile, self).setUp(File.File(mock.Mock())) def getTempFileName(self): temp_file = tempfile.NamedTemporaryFile() temp_file_name = temp_file.name temp_file.close() return temp_file_name def deleteTempFile(self, temp_file_name): try: os.remove(temp_file_name) except: etype, evalue, etb = sys.exc_info() self.logger.error('Could no delete temporary file %s. Excpeption: %s, Error: %s.' % (temp_file_name, etype, evalue)) sys.exit(255) def inflateGzipData(self, data): buffer = io.BytesIO(data) compressor = gzip.GzipFile(mode='rb', fileobj=buffer) try: inflated_data = str(compressor.read(), "utf-8") except: inflated_data = None return inflated_data def test(self): temp_file_name = self.getTempFileName() self.test_object.configure({'file_name': temp_file_name, 'store_interval_in_secs': 1}) self.checkConfiguration() event = DictUtils.getDefaultEventDict({'data': 'One thing is for sure; a sheep is not a creature of the air.'}) self.test_object.receiveEvent(event) self.test_object.shutDown() with open(temp_file_name) as temp_file: for line in temp_file: self.assertEqual(line.rstrip(), event['data']) self.deleteTempFile(temp_file_name) def testGzipCompression(self): temp_file_name = self.getTempFileName() self.test_object.configure({'file_name': temp_file_name, 'store_interval_in_secs': 1, 'compress': 'gzip'}) self.checkConfiguration() event = DictUtils.getDefaultEventDict({'data': 'One thing is for sure; a sheep is not a creature of the air.'}) self.test_object.receiveEvent(event) self.test_object.shutDown() with open("%s.gz" % temp_file_name, "rb") as temp_file: for line in temp_file: defalted_data = self.inflateGzipData(line) self.assertIsNotNone(defalted_data) self.assertEqual(defalted_data.rstrip(), event['data']) self.deleteTempFile("%s.gz" % temp_file_name)
37.347826
128
0.629414
2,365
0.917734
0
0
0
0
0
0
326
0.126504
19368974491b6add6e004f6c293a6ac67a000708
4,517
py
Python
user_scripts/decode_logits.py
DavidHribek/pero-ocr
8d274282813878b3e31dd560563a36b3f02e5c33
[ "BSD-3-Clause" ]
null
null
null
user_scripts/decode_logits.py
DavidHribek/pero-ocr
8d274282813878b3e31dd560563a36b3f02e5c33
[ "BSD-3-Clause" ]
null
null
null
user_scripts/decode_logits.py
DavidHribek/pero-ocr
8d274282813878b3e31dd560563a36b3f02e5c33
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env python3 import argparse import pickle import time import sys from safe_gpu.safe_gpu import GPUOwner from pero_ocr.decoding import confusion_networks from pero_ocr.decoding.decoding_itf import prepare_dense_logits, construct_lm, get_ocr_charset, BLANK_SYMBOL import pero_ocr.decoding.decoders as decoders from pero_ocr.transcription_io import save_transcriptions def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument('-j', '--ocr-json', help='Path to OCR config', required=True) parser.add_argument('-k', '--beam-size', type=int, help='Width of the beam') parser.add_argument('-l', '--lm', help='File with a language model') parser.add_argument('--insertion-bonus', type=float, help='Flat bonus for every letter introduced in transcription') parser.add_argument('--lm-scale', type=float, default=1.0, help='File with a language model') parser.add_argument('-g', '--greedy', action='store_true', help='Decode with a greedy decoder') parser.add_argument('--eval', action='store_true', help='Turn dropouts and batchnorms to eval mode') parser.add_argument('--use-gpu', action='store_true', help='Make the decoder utilize a GPU') parser.add_argument('--report-eta', action='store_true', help='Keep updating stdout with ETA') parser.add_argument('--model-eos', action='store_true', help='Make the decoder model end of sentences') parser.add_argument('-i', '--input', help='Pickled dictionary with names and sparse logits', required=True) parser.add_argument('-b', '--best', help='Where to store 1-best output', required=True) parser.add_argument('-p', '--confidence', help='Where to store posterior probability of the 1-best', required=True) parser.add_argument('-d', '--cn-best', help='Where to store 1-best from confusion network') args = parser.parse_args() return args class Reporter: def __init__(self, stream=sys.stdout, nop=False): self.nop = nop self.last_len = None self.stream = stream def report(self, msg): if self.nop: return self.stream.write('\r') self.stream.write(msg) if self.last_len and len(msg) < self.last_len: self.stream.write(' ' * (self.last_len-len(msg))) self.last_len = len(msg) def clear(self): if self.nop: return self.stream.write('\r\n') def main(args): print(args) ocr_engine_chars = get_ocr_charset(args.ocr_json) if args.greedy: decoder = decoders.GreedyDecoder(ocr_engine_chars + [BLANK_SYMBOL]) else: if args.lm: lm = construct_lm(args.lm) else: lm = None decoder = decoders.CTCPrefixLogRawNumpyDecoder( ocr_engine_chars + [BLANK_SYMBOL], k=args.beam_size, lm=lm, lm_scale=args.lm_scale, use_gpu=args.use_gpu, insertion_bonus=args.insertion_bonus, ) if lm and args.eval: lm.eval() with open(args.input, 'rb') as f: complete_input = pickle.load(f) names = complete_input['names'] logits = complete_input['logits'] decodings = {} confidences = {} if args.cn_best: cn_decodings = {} t_0 = time.time() reporter = Reporter(nop=not args.report_eta) for i, (name, sparse_logits) in enumerate(zip(names, logits)): time_per_line = (time.time() - t_0) / (i+1) nb_lines_ahead = len(names) - (i+1) reporter.report('Processing {} [{}/{}, {:.2f}s/line, ETA {:.2f}s]'.format(name, i+1, len(names), time_per_line, time_per_line*nb_lines_ahead)) dense_logits = prepare_dense_logits(sparse_logits) if args.greedy: boh = decoder(dense_logits) else: boh = decoder(dense_logits, args.model_eos) one_best = boh.best_hyp() decodings[name] = one_best confidences[name] = boh.confidence() if args.cn_best: cn = confusion_networks.produce_cn_from_boh(boh) cn_decodings[name] = confusion_networks.best_cn_path(cn) reporter.clear() save_transcriptions(args.best, decodings) with open(args.confidence, 'w') as f: for name in decodings: f.write('{} {:.3f}\n'.format(name, confidences[name])) if args.cn_best: save_transcriptions(args.cn_best, cn_decodings) if __name__ == "__main__": args = parse_arguments() gpu_owner = GPUOwner() main(args)
34.480916
150
0.651317
530
0.117335
0
0
0
0
0
0
888
0.196591
1936ec832cd585d63cf22975d9e0473abed83035
1,608
py
Python
PiCN/Layers/ICNLayer/ContentStore/ContentStoreMemoryExact.py
NikolaiRutz/PiCN
7775c61caae506a88af2e4ec34349e8bd9098459
[ "BSD-3-Clause" ]
null
null
null
PiCN/Layers/ICNLayer/ContentStore/ContentStoreMemoryExact.py
NikolaiRutz/PiCN
7775c61caae506a88af2e4ec34349e8bd9098459
[ "BSD-3-Clause" ]
5
2020-07-15T09:01:42.000Z
2020-09-28T08:45:21.000Z
PiCN/Layers/ICNLayer/ContentStore/ContentStoreMemoryExact.py
NikolaiRutz/PiCN
7775c61caae506a88af2e4ec34349e8bd9098459
[ "BSD-3-Clause" ]
null
null
null
""" An in-memory content store with exact matching""" import time from PiCN.Packets import Content, Name from PiCN.Layers.ICNLayer.ContentStore import BaseContentStore, ContentStoreEntry class ContentStoreMemoryExact(BaseContentStore): """ A in memory Content Store using exact matching""" def __init__(self, cs_timeout: int = 10): BaseContentStore.__init__(self, cs_timeout=cs_timeout) def find_content_object(self, name: Name) -> ContentStoreEntry: for c in self._container: if c.content.name == name: #and c.content.name_payload == name_payload: return c return None def add_content_object(self, content: Content, static: bool=False): for c in self._container: if content == c.content: return self._container.append(ContentStoreEntry(content, static=static)) def remove_content_object(self, name: Name): rem = self.find_content_object(name) if rem is not None: self._container.remove(rem) def update_timestamp(self, cs_entry: ContentStoreEntry): self._container.remove(cs_entry) cs_entry.timestamp = time.time() self._container.append(cs_entry) def ageing(self): cur_time = time.time() remove = [] for cs_entry in self._container: if cs_entry.static is True: continue if cs_entry.timestamp + self._cs_timeout < cur_time: remove.append(cs_entry) for cs_entry in remove: self.remove_content_object(cs_entry.content.name)
34.212766
83
0.65796
1,416
0.880597
0
0
0
0
0
0
150
0.093284
193ab624d131e849acb875b0bc59e01faf091e1d
279
py
Python
texaslan/slack/pipelines/on_success.py
hsmeans/texaslan.org
a981e7835381e77320e39536a619981ba9d03451
[ "MIT" ]
2
2018-02-06T06:24:03.000Z
2018-03-20T03:32:13.000Z
texaslan/slack/pipelines/on_success.py
hsmeans/texaslan.org
a981e7835381e77320e39536a619981ba9d03451
[ "MIT" ]
32
2017-02-21T20:01:43.000Z
2020-02-08T21:52:16.000Z
texaslan/slack/pipelines/on_success.py
hsmeans/texaslan.org
a981e7835381e77320e39536a619981ba9d03451
[ "MIT" ]
6
2017-03-21T21:16:40.000Z
2020-02-08T20:46:20.000Z
from django_slack_oauth.models import SlackOAuthRequest def register_token(request, api_data): SlackOAuthRequest.objects.create( associated_user=request.user, access_token=api_data.pop('access_token'), extras=api_data ) return request, api_data
27.9
55
0.749104
0
0
0
0
0
0
0
0
14
0.050179
193b0ac325ef43006df164a8a14a3f901439a20c
185
py
Python
main_app/forms.py
reeshabhkumarranjan/SocPay
ba3f3ea0b7b814e1ca40293b14f192b6d40adbbd
[ "MIT" ]
null
null
null
main_app/forms.py
reeshabhkumarranjan/SocPay
ba3f3ea0b7b814e1ca40293b14f192b6d40adbbd
[ "MIT" ]
null
null
null
main_app/forms.py
reeshabhkumarranjan/SocPay
ba3f3ea0b7b814e1ca40293b14f192b6d40adbbd
[ "MIT" ]
null
null
null
from django.forms import ModelForm # class add_money_form(ModelForm): # class Meta: # model = Transaction # fields = ['transaction_user_2', 'transaction_amount']
20.555556
63
0.675676
0
0
0
0
0
0
0
0
143
0.772973
193c6a68a587626a9b404a216a915daaf939afcb
7,187
py
Python
leetcode_python/Design/first-unique-number.py
yennanliu/Python_basics
6a597442d39468295946cefbfb11d08f61424dc3
[ "Unlicense" ]
null
null
null
leetcode_python/Design/first-unique-number.py
yennanliu/Python_basics
6a597442d39468295946cefbfb11d08f61424dc3
[ "Unlicense" ]
null
null
null
leetcode_python/Design/first-unique-number.py
yennanliu/Python_basics
6a597442d39468295946cefbfb11d08f61424dc3
[ "Unlicense" ]
null
null
null
""" 1429. First Unique Number # https://leetcode.ca/all/1429.html You have a queue of integers, you need to retrieve the first unique integer in the queue. Implement the FirstUnique class: FirstUnique(int[] nums) Initializes the object with the numbers in the queue. int showFirstUnique() returns the value of the first unique integer of the queue, and returns -1 if there is no such integer. void add(int value) insert value to the queue. Example 1: Input: ["FirstUnique","showFirstUnique","add","showFirstUnique","add","showFirstUnique","add","showFirstUnique"] [[[2,3,5]],[],[5],[],[2],[],[3],[]] Output: [null,2,null,2,null,3,null,-1] Explanation: FirstUnique firstUnique = new FirstUnique([2,3,5]); firstUnique.showFirstUnique(); // return 2 firstUnique.add(5); // the queue is now [2,3,5,5] firstUnique.showFirstUnique(); // return 2 firstUnique.add(2); // the queue is now [2,3,5,5,2] firstUnique.showFirstUnique(); // return 3 firstUnique.add(3); // the queue is now [2,3,5,5,2,3] firstUnique.showFirstUnique(); // return -1 Example 2: Input: ["FirstUnique","showFirstUnique","add","add","add","add","add","showFirstUnique"] [[[7,7,7,7,7,7]],[],[7],[3],[3],[7],[17],[]] Output: [null,-1,null,null,null,null,null,17] Explanation: FirstUnique firstUnique = new FirstUnique([7,7,7,7,7,7]); firstUnique.showFirstUnique(); // return -1 firstUnique.add(7); // the queue is now [7,7,7,7,7,7,7] firstUnique.add(3); // the queue is now [7,7,7,7,7,7,7,3] firstUnique.add(3); // the queue is now [7,7,7,7,7,7,7,3,3] firstUnique.add(7); // the queue is now [7,7,7,7,7,7,7,3,3,7] firstUnique.add(17); // the queue is now [7,7,7,7,7,7,7,3,3,7,17] firstUnique.showFirstUnique(); // return 17 Example 3: Input: ["FirstUnique","showFirstUnique","add","showFirstUnique"] [[[809]],[],[809],[]] Output: [null,809,null,-1] Explanation: FirstUnique firstUnique = new FirstUnique([809]); firstUnique.showFirstUnique(); // return 809 firstUnique.add(809); // the queue is now [809,809] firstUnique.showFirstUnique(); // return -1 Constraints: 1 <= nums.length <= 10^5 1 <= nums[i] <= 10^8 1 <= value <= 10^8 At most 50000 calls will be made to showFirstUnique and add. """ # V0 # V1 # https://blog.csdn.net/Changxing_J/article/details/109854442 # IDEA : dequeue from collections import Counter, deque class FirstUnique: def __init__(self, nums): self.count = Counter(nums) self.array = deque(nums) self.first = -1 self._find() def showFirstUnique(self): return self.first def add(self, value): self.count[value] += 1 self.array.append(value) if self.first == -1 or value == self.first: self._find() def _find(self): self.first = - while self.array: first = self.array.popleft() if self.count[first] == 1: self.first = first break # V1' # IDEA : dequeue # https://blog.csdn.net/sinat_30403031/article/details/116664368 from collections import Counter, deque, defaultdict from heapq import heappush, heappop class FirstUnique: def __init__(self, nums): self.nums = nums self.dic = [] self.pos = set() self.Counter = defaultdict(int) for index, num in enumerate(self.nums): self.counter[num] += 1 if self.counter[num] == 1: heappush(self.pic, (index, num)) self.pos.add(num) elif num in self.pos and self.counter[num] == 2: self.pos.remove(num) def showFirstUnique(self): while len(self.dic): index, number = heappop(self.dic) if number in self.pos: heappush(self.dic, (index, number)) return number return -1 def add(self, value): self.nums.append(value) self.Counter[value] += 1 if value in self.pos: self.pos.remove(value) elif self.Counter[value] == 1: self.pos.add(value) heappush(self.dic, (len(self.nums)-1, value)) # V1'' # https://github.com/jyj407/leetcode/blob/master/1429.md class FirstUnique: def __init__(self, nums): self.data = [] self.mp = dict() for num in nums : self.data.append(num); self.mp[num] = self.mp.setdefault(num, 0) + 1 def showFirstUnique(self): for num in self.data : if (self.mp[num] == 1) : return num; return -1; def add(self, value): self.data.append(value) self.mp[value] = self.mp.setdefault(value, 0) + 1 # V1''' # https://github.com/jyj407/leetcode/blob/master/1429.md class FirstUnique: def __init__(self, nums): self.allDict = dict() self.unique = list() for num in nums : self.allDict[num] = self.allDict.setdefault(num, 0) + 1 self.updateUniqueSet(num) def updateUniqueSet(self, num) : if (self.allDict[num] == 1) : self.unique.append(num) elif (self.allDict[num] > 1) : if (num in self.unique): self.unique.remove(num) def showFirstUnique(self): if (not self.unique) : return -1 return self.unique[0] def add(self, value): self.allDict[value] = self.allDict.setdefault(value, 0) + 1 self.updateUniqueSet(value) # V1'''' # https://github.com/jyj407/leetcode/blob/master/1429.md class FirstUnique2 : def __init__(self, nums): self.allDict = dict() self.unique = list() for num in nums : self.allDict[num] = self.allDict.setdefault(num, 0) + 1 self.updateUniqueSet(num) def updateUniqueSet(self, num) : if (self.allDict[num] == 1) : self.unique.append(num) elif (self.allDict[num] > 1) : if (num in self.unique): self.unique.remove(num) def showFirstUnique(self): if (not self.unique) : return -1 return self.unique[0] def add(self, value): self.allDict[value] = self.allDict.setdefault(value, 0) + 1 self.updateUniqueSet(value) # V1''''' # https://leetcode.ca/2019-10-29-1429-First-Unique-Number/ # C++ # / OJ: https://leetcode.com/problems/first-unique-number/ # # // Time: # // FirstUnique: O(N) # // showFirstUnique: O(1) # // add: O(1) # // Space: O(N) # class FirstUnique { # list<int> data; # typedef list<int>::iterator iter; # unordered_map<int, iter> m; # unordered_set<int> s; # public: # FirstUnique(vector<int>& nums) { # for (int n : nums) add(n); # } # # int showFirstUnique() { # return data.size() ? data.front() : -1; # } # # void add(int value) { # if (s.count(value)) return; # if (m.count(value)) { # data.erase(m[value]); # s.insert(value); # } else { # data.push_back(value); # m[value] = prev(data.end()); # } # } # }; # V2
27.856589
125
0.579797
3,523
0.490191
0
0
0
0
0
0
3,475
0.483512
193cb661b098c4c5b452e6a65209cb9479f364c3
4,326
py
Python
get_git/github_client.py
alanahanson/get-git
a3b078a64ce8f4bb7103fcd46a0eee80cd35f87c
[ "MIT" ]
null
null
null
get_git/github_client.py
alanahanson/get-git
a3b078a64ce8f4bb7103fcd46a0eee80cd35f87c
[ "MIT" ]
null
null
null
get_git/github_client.py
alanahanson/get-git
a3b078a64ce8f4bb7103fcd46a0eee80cd35f87c
[ "MIT" ]
null
null
null
import os from get_git.utils import make_request GH_URL = 'https://api.github.com/graphql' TOKEN=os.environ.get('GH_API_TOKEN') class GithubClient: def __init__(self, username): self.username = username def get_user(self): query = """ {user(login:"%s") { starredRepositories { totalCount } followers { totalCount } repositories(first:100) { totalDiskUsage totalCount pageInfo { hasNextPage, endCursor } nodes { id name isFork primaryLanguage { name } issues(states:OPEN) { totalCount } commitComments { totalCount } watchers { totalCount } stargazers { totalCount } languages(first:100) { totalCount pageInfo { hasNextPage, endCursor } nodes { name } } repositoryTopics(first:100) { totalCount pageInfo { hasNextPage, endCursor } nodes { topic { name } } } } } } } """ % (self.username) return make_request(GH_URL, 'post', token=TOKEN, data=query) def _get_additional_repos(self, cursor=None): query = """ {user(login:"%s") { repositories(first:100%s) { pageInfo { hasNextPage, endCursor } nodes { id name isFork primaryLanguage { name } issues(states:OPEN) { totalCount } commitComments { totalCount } watchers { totalCount } stargazers { totalCount } repositoryTopics(first:100) { totalCount pageInfo { hasNextPage, endCursor } nodes { topic { name } } } } } } } """ % (self.username, self._add_cursor(cursor)) return make_request(GH_URL, 'post', token=TOKEN, data=query) def _get_additional_topics(self, repo_name, cursor=None): query = """ {repository(owner:"%s", name:"%s") { repositoryTopics(first:100%s) { pageInfo { hasNextPage, endCursor } nodes { topic { name } } } } } """ % (self.username, repo_name, self._add_cursor(cursor)) return make_request(GH_URL, 'post', token=TOKEN, data=query) def _add_cursor(self, cursor): if cursor: return f',after:"{cursor}"' return '' def _get_all_repos(self, repo_data): repos = repo_data['nodes'] while repo_data['pageInfo']['hasNextPage']: cursor = repo_data['pageInfo']['endCursor'] next_page = self._get_additional_repos(cursor=cursor) repos.extend(next_page['data']['user']['repositories']['nodes']) repo_data['pageInfo'] = next_page['data']['user']['repositories']['pageInfo'] return repos def _get_all_topics(self, topic_data): topics = topic_data['nodes'] while topic_data['pageInfo']['hasNextPage']: cursor = topic_data['pageInfo']['endCursor'] next_page = self.get_additional_topics(repo['name'], cursor) topics.extend(next_page['data']['repository']['repositoryTopics']) topic_data['pageInfo'] = next_page['data']['repository']['repositoryTopics']['pageInfo'] return topics def get_data(self): result = self.get_user()['data']['user'] result['repositories']['nodes'] = self._get_all_repos(result['repositories']) for repo in result['repositories']['nodes']: if repo['repositoryTopics']['totalCount']: repo['repositoryTopics']['nodes'] = self._get_all_topics(repo['repositoryTopics']) return result
35.170732
100
0.487286
4,194
0.969487
0
0
0
0
0
0
2,694
0.622746
193eb2395e6afc892c407dab660196002686ac81
15,517
py
Python
Naluno/model.py
dstarrago/Naluno
de2a498b65ac7e10599f797e41c77d0ceae56c3e
[ "MIT" ]
null
null
null
Naluno/model.py
dstarrago/Naluno
de2a498b65ac7e10599f797e41c77d0ceae56c3e
[ "MIT" ]
null
null
null
Naluno/model.py
dstarrago/Naluno
de2a498b65ac7e10599f797e41c77d0ceae56c3e
[ "MIT" ]
null
null
null
from __future__ import division, print_function, unicode_literals from config import * __all__ = ['Map', 'Vertex', 'Edge', 'State'] class State: FREE = 0 CLOSED = 1 MANDATORY = 2 OPTIONAL = 3 class Square: def __init__(self): self._has_card = False @property def has_card(self): return self._has_card @has_card.setter def has_card(self, value): self._has_card = value def copy_to(self, square): square.has_card = self._has_card class Edge: def __init__(self): self._port = [State.FREE, State.FREE, State.FREE] self._num_cards = 0 self._contact_number = 0 @property def num_cards(self): return self._num_cards @num_cards.setter def num_cards(self, value): self._num_cards = value @property def port(self): return self._port @property def contact_number(self): return self._contact_number @contact_number.setter def contact_number(self, value): self._contact_number = value def update(self, edge): self._contact_number = 0 for i in range(3): if self.port[i] != State.FREE: if self.port[i] != State.CLOSED and edge.port[i] != State.CLOSED: self._contact_number += 1 self.port[i] = edge.port[i] self.num_cards += 1 def match(self, edge): self._contact_number = 0 if self.port[1] == State.FREE: return True for i in range(3): if self.port[i] == State.MANDATORY: if edge.port[i] == State.CLOSED: return False elif self.port[i] == State.CLOSED: if edge.port[i] == State.MANDATORY: return False if self.port[i] != State.CLOSED and edge.port[i] != State.CLOSED: self._contact_number += 1 return True @property def dock_count(self): dock_count = 0 for i in range(3): if self.port[i] == State.MANDATORY or self.port[i] == State.OPTIONAL: dock_count += 1 return dock_count @property def mandatory_dock_count(self): dock_count = 0 for i in range(3): if self.port[i] == State.MANDATORY: dock_count += 1 return dock_count def copy_to(self, edge): edge.num_cards = self._num_cards edge.contact_number = self._contact_number for i in range(3): edge.port[i] = self._port[i] class Vertex: def __init__(self): self._state = State.FREE self._contact_number = 0 self._num_cards = 0 @property def state(self): return self._state @state.setter def state(self, value): self._state = value @property def contact_number(self): return self._contact_number @contact_number.setter def contact_number(self, value): self._contact_number = value @property def num_cards(self): return self._num_cards @num_cards.setter def num_cards(self, value): self._num_cards = value def update(self, vertex): self._contact_number = 0 if self._state == State.CLOSED: self._state = vertex.state elif self._state == State.MANDATORY: if vertex.state != State.CLOSED: self._state = State.OPTIONAL self._contact_number = 1 elif self._state == State.OPTIONAL: if vertex.state != State.CLOSED: self._contact_number = 1 elif self._state == State.FREE: self._state = vertex.state self._num_cards += 1 def match(self, vertex): self._contact_number = 0 if self._state == State.FREE: return True if self._state == State.MANDATORY: if vertex.state == State.CLOSED and self._num_cards == 3: return False elif self._state == State.CLOSED: if vertex.state == State.MANDATORY and self._num_cards == 3: return False if self._state != State.CLOSED and vertex.state != State.CLOSED: self._contact_number = 1 return True def copy_to(self, vertex): vertex.state = self._state vertex.num_cards = self._num_cards vertex.contact_number = self._contact_number @property def dock_count(self): if self._state == State.MANDATORY or self._state == State.OPTIONAL: return 1 else: return 0 @property def mandatory_dock_count(self): if self._state == State.MANDATORY: return 1 else: return 0 class Move: def __init__(self, card, row, col): self._card = card self._row = row self._col = col def get_clone(self): return Move(self._card, self._row, self._col) @property def card(self): return self._card @property def row(self): return self._row @property def col(self): return self._col class Map: def __init__(self, matrix=None): self._most_right_move = None self._most_left_move = None self._top_move = None self._bottom_move = None self._contact_count = 0 self._move_history = [] self.vsize = VER_MAP_SIZE * 3 self.hsize = HOR_MAP_SIZE * 3 self._matrix = [] self.init_matrix(matrix) @property def most_right_move(self): return self._most_right_move @most_right_move.setter def most_right_move(self, move): self._most_right_move = move @property def most_left_move(self): return self.most_left_move @most_left_move.setter def most_left_move(self, move): self._most_left_move = move @property def top_move(self): return self._top_move @top_move.setter def top_move(self, move): self._top_move = move @property def bottom_move(self): return self._bottom_move @bottom_move.setter def bottom_move(self, move): self._bottom_move = move @property def contact_count(self): return self._contact_count @contact_count.setter def contact_count(self, value): self._contact_count = value @property def move_history(self): return self._move_history def init_matrix(self, matrix): if matrix is None: for i in range(self.vsize): row = [] for j in range(self.hsize): row.append(None) self._matrix.append(row) tile_row = False tile_col = False for i in range(self.vsize): for j in range(self.hsize): if tile_row: if tile_col: self._matrix[i][j] = Square() else: self._matrix[i][j] = Edge() else: if tile_col: self._matrix[i][j] = Edge() else: self._matrix[i][j] = Vertex() tile_col = not tile_col tile_row = not tile_row tile_col = False else: for i in range(self.vsize): self._matrix[i].extend(matrix[i, :]) def clone(self): m = Map(self._matrix) m.contact_count = self._contact_count m.move_history.extend(self._move_history[:]) m.most_left_move = self._most_left_move m.most_right_move = self._most_right_move m.top_move = self._top_move m.bottom_move = self._bottom_move return m @property def center_col(self): return HOR_MAP_SIZE // 2 @property def center_row(self): return VER_MAP_SIZE // 2 def square_at(self, col, row): return self._matrix[row * 2 + 1][col * 2 + 1] def top_square(self, col, row): return self.square_at(col, row - 1) # NO using GL coord system def bottom_square(self, col, row): return self.square_at(col, row + 1) # NO using GL coord system def left_square(self, col, row): return self.square_at(col - 1, row) def right_square(self, col, row): return self.square_at(col + 1, row) def top_edge(self, col, row): return self._matrix[row * 2][col * 2 + 1] def bottom_edge(self, col, row): return self._matrix[row * 2 + 2][col * 2 + 1] def left_edge(self, col, row): return self._matrix[row * 2 + 1][col * 2] def right_edge(self, col, row): return self._matrix[row * 2 + 1][col * 2 + 2] def top_left_vertex(self, col, row): return self._matrix[row * 2][col * 2] def bottom_left_vertex(self, col, row): return self._matrix[row * 2 + 2][col * 2] def top_right_vertex(self, col, row): return self._matrix[row * 2][col * 2 + 2] def bottom_right_vertex(self, col, row): return self._matrix[row * 2 + 2][col * 2 + 2] @property def most_left_card(self): return self.most_left_move.card @property def most_right_card(self): return self.most_right_move.card @property def top_card(self): return self.top_move.card @property def bottom_card(self): return self.bottom_move.card def dock_count(self, col, row): result = self.top_edge(col, row).dock_count + \ self.bottom_edge(col, row).dock_count + \ self.left_edge(col, row).dock_count + \ self.right_edge(col, row).dock_count + \ self.top_left_vertex(col, row).dock_count + \ self.top_right_vertex(col, row).dock_count + \ self.bottom_left_vertex(col, row).dock_count + \ self.bottom_right_vertex(col, row).dock_count return result def mandatory_dock_count(self, col, row): result = self.top_edge(col, row).mandatory_dock_count + \ self.bottom_edge(col, row).mandatory_dock_count + \ self.left_edge(col, row).mandatory_dock_count + \ self.right_edge(col, row).mandatory_dock_count + \ self.top_left_vertex(col, row).mandatory_dock_count + \ self.top_right_vertex(col, row).mandatory_dock_count + \ self.bottom_left_vertex(col, row).mandatory_dock_count + \ self.bottom_right_vertex(col, row).mandatory_dock_count return result def have_adjacent_card(self, col, row): up = self.top_square(col, row) down = self.bottom_square(col, row) left = self.left_square(col, row) right = self.right_square(col, row) return up.has_card or down.has_card or left.has_card or right.has_card def move_card(self, move): self.put_card(move.col, move.row, move.card) def put_card(self, col, row, card): self.square_at(col, row).has_card = True self.top_left_vertex(col, row).update(card.vertex(card.TOP_LEFT_VERTEX)) self.top_right_vertex(col, row).update(card.vertex(card.TOP_RIGHT_VERTEX)) self.bottom_left_vertex(col, row).update(card.vertex(card.BOTTOM_LEFT_VERTEX)) self.bottom_right_vertex(col, row).update(card.vertex(card.BOTTOM_RIGHT_VERTEX)) self.top_edge(col, row).update(card.vertex(card.TOP_EDGE)) self.bottom_edge(col, row).update(card.vertex(card.BOTTOM_EDGE)) self.left_edge(col, row).update(card.vertex(card.LEFT_EDGE)) self.right_edge(col, row).update(card.vertex(card.RIGHT_EDGE)) self._contact_count = \ self.top_edge(col, row).contact_number + \ self.bottom_edge(col, row).contact_number + \ self.left_edge(col, row).contact_number + \ self.right_edge(col, row).contact_number + \ self.top_left_vertex(col, row).contact_number + \ self.top_right_vertex(col, row).contact_number + \ self.bottom_left_vertex(col, row).contact_number + \ self.bottom_right_vertex(col, row).contact_number move = Move(col, row, card) self._move_history.append(move) self.update_extreme_cards(move) return self._contact_count def match(self, col, row, card): match = \ self.top_left_vertex(col, row).match(card.vertex(card.TOP_LEFT_VERTEX)) and \ self.top_right_vertex(col, row).match(card.vertex(card.TOP_RIGHT_VERTEX)) and \ self.bottom_left_vertex(col, row).match(card.vertex(card.BOTTOM_LEFT_VERTEX)) and \ self.bottom_right_vertex(col, row).match(card.vertex(card.BOTTOM_RIGHT_VERTEX)) and \ self.top_edge(col, row).match(card.vertex(card.TOP_EDGE)) and \ self.bottom_edge(col, row).match(card.vertex(card.BOTTOM_EDGE)) and \ self.left_edge(col, row).match(card.vertex(card.LEFT_EDGE)) and \ self.right_edge(col, row).match(card.vertex(card.RIGHT_EDGE)) if not match: self._contact_count = 0 return False self._contact_count = \ self.top_edge(col, row).contact_number + \ self.bottom_edge(col, row).contact_number + \ self.left_edge(col, row).contact_number + \ self.right_edge(col, row).contact_number + \ self.top_left_vertex(col, row).contact_number + \ self.top_right_vertex(col, row).contact_number + \ self.bottom_left_vertex(col, row).contact_number + \ self.bottom_right_vertex(col, row).contact_number return self._contact_count > 0 def try_move(self, move): return not self.square_at(move.col, move.row).has_card and \ self.have_adjacent_card(move.col, move.row) and \ self.match(move.col, move.row, move.card) def play_card(self, col, row, card): if not self.square_at(col, row).has_card and \ self.have_adjacent_card(col, row) and \ self.match(col, row, card): self.put_card(col, row, card) card.played = True return True def update_extreme_cards(self, move): if len(self._move_history) == 1: self._most_right_move = move self._most_left_move = move self._top_move = move self._bottom_move = move else: if move.col > self._most_right_move.col: self._most_right_move = move if move.col < self._most_left_move.col: self._most_left_move = move if move.row < self._top_move: # NO using GL coord system self._top_move = move if move.row > self._bottom_move: # NO using GL coord system self._bottom_move = move
32.875
98
0.569827
15,340
0.988593
0
0
3,250
0.209448
0
0
134
0.008636
194088485187df0c1ce817432f67940ecca472cb
1,035
py
Python
combo/search/score.py
yanpei18345156216/COMBO_Python3
666a116dfece71e6236291e89ea2ab4d6db0ead9
[ "MIT" ]
139
2016-02-18T02:31:04.000Z
2022-02-18T10:38:06.000Z
combo/search/score.py
yanpei18345156216/COMBO_Python3
666a116dfece71e6236291e89ea2ab4d6db0ead9
[ "MIT" ]
8
2016-04-18T08:10:44.000Z
2020-12-30T08:49:33.000Z
combo/search/score.py
yanpei18345156216/COMBO_Python3
666a116dfece71e6236291e89ea2ab4d6db0ead9
[ "MIT" ]
50
2016-05-21T01:17:23.000Z
2022-02-18T01:27:41.000Z
import numpy as np import scipy.stats def EI(predictor, training, test, fmax=None): fmean = predictor.get_post_fmean(training, test) fcov = predictor.get_post_fcov(training, test) fstd = np.sqrt(fcov) if fmax is None: fmax = np.max(predictor.get_post_fmean(training, training)) temp1 = (fmean - fmax) temp2 = temp1 / fstd score = temp1 * scipy.stats.norm.cdf(temp2) \ + fstd * scipy.stats.norm.pdf(temp2) return score def PI(predictor, training, test, fmax=None): fmean = predictor.get_post_fmean(training, test) fcov = predictor.get_post_fcov(training, test) fstd = np.sqrt(fcov) if fmax is None: fmax = np.max(predictor.get_post_fmean(training, training)) temp = (fmean - fmax)/fstd score = scipy.stats.norm.cdf(temp) return score def TS(predictor, training, test, alpha=1): score = predictor.get_post_samples(training, test, alpha=alpha) try: score.shape[1] score[0, :] except: pass return score
24.069767
67
0.656039
0
0
0
0
0
0
0
0
0
0
19414c412df3d7fe628fab1103ed1b978f8a57d8
1,528
py
Python
dags/calculating_google_ads_network.py
BjMrq/Python-AirflowReportPipeline
261812488d661580cb0f41808d94249cc8e0951b
[ "MIT" ]
2
2019-06-28T20:08:56.000Z
2021-03-30T15:24:10.000Z
dags/calculating_google_ads_network.py
BjMrq/Python-AirflowReportPipeline
261812488d661580cb0f41808d94249cc8e0951b
[ "MIT" ]
null
null
null
dags/calculating_google_ads_network.py
BjMrq/Python-AirflowReportPipeline
261812488d661580cb0f41808d94249cc8e0951b
[ "MIT" ]
null
null
null
import pandas as pd import numpy as np LOCAL_DIR = '/tmp/' def main(**kwargs): # Retrieve acampus from Xcom ti = kwargs["ti"] source = ti.xcom_pull( task_ids="report_init_task") campus_name = source["campus"] # Read data file to create a data frame df = pd.read_csv(LOCAL_DIR + campus_name + '_google_ads_data_cleaned.csv') # Make sure Cost is the right data type df.Cost = df.Cost.astype(int) # Format networks df['AdNetworkType1'] = df['AdNetworkType1'].str.replace( "Display Network", "| Display").str.replace( "Search Network", "| Search").str.replace( "YouTube Search", "| YouTube").str.replace( "YouTube Videos", "| YouTube") # Create a pivo table depending of network type per school pivot = pd.pivot_table( df, values='Cost', index=['school'], columns=['AdNetworkType1'], aggfunc=np.sum, fill_value=0, margins=True).reset_index() # Create network array to loop throught networks = df["AdNetworkType1"].unique() # Format for i in networks: pivot[i] = '| ' + pivot[i].astype(str) + "$" pivot['All'] = '| ' + pivot['All'].astype(str) + "$" pivot = pivot[pivot.school != 'All'] # Drop columns containing no data pivot = pivot.loc[:, (pivot != '| 0$').any(axis=0)] # Save in new file pivot.to_csv(LOCAL_DIR + campus_name + '_google_spent_per_network.csv', header=True, index=False, index_label=False) if __name__ == '__main__': main()
27.781818
78
0.621073
0
0
0
0
0
0
0
0
608
0.397906
1941b9b85d89dbfd9a868d046110eb8fc8e84d5a
1,401
py
Python
src/auditor/org_checker.py
agrc/agol-validator
b17f3fee55bf0b1f7d2ed21ae86b1556072da4d8
[ "MIT" ]
null
null
null
src/auditor/org_checker.py
agrc/agol-validator
b17f3fee55bf0b1f7d2ed21ae86b1556072da4d8
[ "MIT" ]
21
2020-01-29T22:03:54.000Z
2020-07-29T17:55:44.000Z
src/auditor/org_checker.py
agrc/agol-validator
b17f3fee55bf0b1f7d2ed21ae86b1556072da4d8
[ "MIT" ]
null
null
null
""" Holds an OrgChecker object that runs checks at the organization level (instead of at the item level) """ class OrgChecker: """ An OrgChecker runs checks at the org level, as opposed to the item level. For example, checking whether there are any items with the same title. To use, instantiate and then call run_checks(), which will run all checks. """ def __init__(self, item_list): self.item_list = item_list def run_checks(self): """ Run all checks in the OrgChecker. Any new checks should be added to this method. """ results_dict = {} results_dict['check_for_duplicate_titles'] = self.check_for_duplicate_titles() return results_dict def check_for_duplicate_titles(self): """ Report any items in self.item_list that have duplicate titles. Returns: Dictionary of item ids for each duplicate title: {duplicate_title: [itemid, itemid, ...]} """ seen_titles = {} duplicates = {} for item in self.item_list: if item.title in seen_titles: seen_titles[item.title].append(item.itemid) else: seen_titles[item.title] = [item.itemid] for title in seen_titles: if len(seen_titles[title]) > 1: duplicates[title] = seen_titles[title] return duplicates
29.808511
117
0.628837
1,289
0.920057
0
0
0
0
0
0
678
0.48394
1941f729283db4adc38960fd6ecd423a78269f4b
994
py
Python
create_post.py
schlop/blog
74fe7d5ce4e1c00942cb033710720098ac493844
[ "MIT" ]
null
null
null
create_post.py
schlop/blog
74fe7d5ce4e1c00942cb033710720098ac493844
[ "MIT" ]
null
null
null
create_post.py
schlop/blog
74fe7d5ce4e1c00942cb033710720098ac493844
[ "MIT" ]
null
null
null
#!/usr/bin/python3 from datetime import datetime import sys def create_blog_post(title=""): file_date = datetime.now().strftime("%Y-%m-%d") file_name = file_date + "---" + title.replace(" ", "-") + ".md" print(file_name) try: file = open("content/posts/" + file_name, "x") except FileExistsError: print("Post already exists. Delete old post first to create a new one") exit(1) content_date = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z' content_slug = title.lower().replace(" ", "-") content = f"""--- title: {title} date: \"{content_date}\" template: \"post\" draft: false slug: {content_slug} category: \"\" description: \"\" socialImage: \"\" ---""".replace(" ", "") file.write(content) file.close() print("Post sucesfully created!") if __name__ == '__main__': if len(sys.argv): create_blog_post(sys.argv[1]) else: create_blog_post()
26.157895
80
0.573441
0
0
0
0
0
0
0
0
398
0.400402
194306ac920374768433626240e00df6f0b039ac
1,436
py
Python
src/python/procyon/py3.py
orbea/procyon
469d94427d3b6e7cc2ab93606bdf968717a49150
[ "Apache-2.0" ]
null
null
null
src/python/procyon/py3.py
orbea/procyon
469d94427d3b6e7cc2ab93606bdf968717a49150
[ "Apache-2.0" ]
null
null
null
src/python/procyon/py3.py
orbea/procyon
469d94427d3b6e7cc2ab93606bdf968717a49150
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2017 The Procyon Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Defines names that are no longer available in python3. name py2 meaning py3 meaning ---- ----------- ----------- unicode unicode str long long int xrange xrange range iteritems dict.iteritems dict.items iterkeys dict.iterkeys dict.keys itervalues dict.itervalues dict.values """ try: unicode = unicode repr = (lambda r: lambda x: r(x).decode("utf-8"))(repr) except NameError: unicode = str repr = repr try: long = long except NameError: long = int try: xrange = xrange except NameError: xrange = range iteritems = lambda d: getattr(d, "iteritems", d.items)() iterkeys = lambda d: getattr(d, "iterkeys", d.keys)() itervalues = lambda d: getattr(d, "itervalues", d.values)()
29.306122
74
0.664345
0
0
0
0
0
0
0
0
1,029
0.716574
1943cab210caf1760efe3b398e0efc3f17bdc7ab
693
py
Python
interlens/criterions/criterion.py
cctien/bimultialign
d0dad62651c25545fb7539639cb72fc8ea2570aa
[ "MIT" ]
null
null
null
interlens/criterions/criterion.py
cctien/bimultialign
d0dad62651c25545fb7539639cb72fc8ea2570aa
[ "MIT" ]
null
null
null
interlens/criterions/criterion.py
cctien/bimultialign
d0dad62651c25545fb7539639cb72fc8ea2570aa
[ "MIT" ]
null
null
null
from allennlp.common import Registrable import torch class Criterion(torch.nn.Module, Registrable): """ A `Criterion` is a `Module` that ... """ def __init__(self, reduction: str = 'mean', verbose: bool = False,) -> None: super().__init__() self.reduction = reduction if reduction == 'mean': self._average = torch.mean elif reduction == 'sum': self._average = torch.sum else: raise NotImplementedError self._verbose = verbose def _forward_verbose(self) -> None: raise NotImplementedError # Losses = Dict[str, Dict[str, Union[float, Loss]]]
23.896552
51
0.572872
584
0.842713
0
0
0
0
0
0
120
0.17316
1944d33ab633803b83a02f71e2b185489b6751ce
2,180
py
Python
week10_classes/seminar/generator_widgets.py
fortminors/msai-python
1dfe19c132cd59125ef64164cce007845ffb6cf8
[ "MIT" ]
9
2021-03-12T06:59:10.000Z
2022-01-21T20:23:31.000Z
week10_classes/seminar/generator_widgets.py
fortminors/msai-python
1dfe19c132cd59125ef64164cce007845ffb6cf8
[ "MIT" ]
null
null
null
week10_classes/seminar/generator_widgets.py
fortminors/msai-python
1dfe19c132cd59125ef64164cce007845ffb6cf8
[ "MIT" ]
14
2021-03-25T15:23:19.000Z
2022-02-05T14:34:40.000Z
# Form implementation generated from reading ui file 'generator.ui' # # Created by: PyQt6 UI code generator 6.2.2 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from PyQt6 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(153, 200) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setGeometry(QtCore.QRect(20, 150, 113, 32)) self.pushButton.setObjectName("pushButton") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(20, 20, 111, 61)) font = QtGui.QFont() font.setPointSize(20) self.label.setFont(font) self.label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) self.label.setObjectName("label") self.minValue = QtWidgets.QLineEdit(self.centralwidget) self.minValue.setGeometry(QtCore.QRect(20, 90, 113, 21)) self.minValue.setObjectName("minValue") self.maxValue = QtWidgets.QLineEdit(self.centralwidget) self.maxValue.setGeometry(QtCore.QRect(20, 120, 113, 21)) self.maxValue.setObjectName("maxValue") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "Random Number Generator")) self.pushButton.setText(_translate("MainWindow", "Generate")) self.label.setText(_translate("MainWindow", "50")) self.minValue.setText(_translate("MainWindow", "1")) self.minValue.setPlaceholderText(_translate("MainWindow", "min")) self.maxValue.setText(_translate("MainWindow", "100")) self.maxValue.setPlaceholderText(_translate("MainWindow", "max"))
45.416667
86
0.707798
1,868
0.856881
0
0
0
0
0
0
465
0.213303
19455519ed74bb43e4ac991488c150b0c157ddd6
5,247
py
Python
sportradar/NFL.py
scrambldchannel/SportradarAPIs
e42e128313647d51784b6f1f3aa201b07fca0a08
[ "MIT" ]
33
2018-07-05T17:07:06.000Z
2022-02-05T16:32:19.000Z
sportradar/NFL.py
scrambldchannel/SportradarAPIs
e42e128313647d51784b6f1f3aa201b07fca0a08
[ "MIT" ]
6
2018-11-16T15:53:33.000Z
2021-06-26T23:04:33.000Z
sportradar/NFL.py
scrambldchannel/SportradarAPIs
e42e128313647d51784b6f1f3aa201b07fca0a08
[ "MIT" ]
17
2018-08-08T08:10:49.000Z
2021-10-06T00:25:21.000Z
# Sportradar APIs # Copyright 2018 John W. Miller # See LICENSE for details. from sportradar.api import API class NFL(API): def __init__(self, api_key, format_='json', access_level='ot', version=2, timeout=5, sleep_time=1.5): super().__init__(api_key, format_, timeout, sleep_time) self.access_level = access_level self.version = version self.prefix = 'nfl-{level}{version}/'.format(level=self.access_level, version=self.version) def get_daily_change_log(self, year, month, day): """Obtain changes made to previously closed events, team rosters, or player profiles for a given day. """ path = "league/{year:4d}/{month:02d}/{day:02d}/changes".format( year=year, month=month, day=day) return self._make_request(self.prefix + path) def get_game_boxscore(self, game_id): """Obtain the scoring information for each team, including drive and play information for all scoring events. """ path = "games/{game_id}/boxscore".format(game_id=game_id) return self._make_request(self.prefix + path) def get_game_roster(self, game_id): """Obtain the roster information for each teams, as well as player profile da ta. """ path = "games/{game_id}/roster".format(game_id=game_id) return self._make_request(self.prefix + path) def get_game_statistics(self, game_id): """Obtain team and player level game statistics for each team.""" path = "games/{game_id}/statistics".format(game_id=game_id) return self._make_request(self.prefix + path) def get_league_hierarchy(self): """Obtain the complete league hierarchy.""" path = "league/hierarchy".format() return self._make_request(self.prefix + path) def get_play_by_play(self, game_id): """Obtain complete play-by-play narrative.""" path = "games/{game_id}/pbp".format(game_id=game_id) return self._make_request(self.prefix + path) def get_player_participation(self, game_id): """Obtain player participation for a given game.""" path = "plays/{game_id}/participation".format(game_id=game_id) return self._make_request(self.prefix + path) def get_player_profile(self, player_id): """Obtain complete player biographical information.""" path = "players/{player_id}/profile".format(player_id=player_id) return self._make_request(self.prefix + path) def get_schedule(self, year, nfl_season): """Obtain complete schedule information.""" path = "games/{year:4d}/{nfl_season}/schedule".format( year=year, nfl_season=nfl_season) return self._make_request(self.prefix + path) def get_seasonal_statistics(self, year, nfl_season, team_id): """Obtain complete team and player seasonal statistics.""" path = "seasontd/{year:4d}/{nfl_season}/teams/{team_id}/statistics".format( year=year, nfl_season=nfl_season, team_id=team_id) return self._make_request(self.prefix + path) def get_standings(self, year): """Obtain standings information for each team.""" path = "seasontd/{year:4d}/standings".format(year=year) return self._make_request(self.prefix + path) def get_team_profile(self, team_id): """Obtain franchise team information.""" path = "teams/{team_id}/profile".format(team_id=team_id) return self._make_request(self.prefix + path) def get_team_roster(self, team_id): """Obtain the complete roster of players for a given team""" path = "teams/{team_id}/full_roster".format(team_id=team_id) return self._make_request(self.prefix + path) def get_weekly_schedule(self, year, nfl_season, nfl_season_week): """Obtain schedules for the NFL for a given week. Pre-Season (PRE) valid weeks 1-4, Regular Season (REG) weeks 1-17, Post-Season (PST) weeks 1-4. """ path = "games/{year:4d}/{nfl_season}/{nfl_season_week}/schedule".format( year=year, nfl_season=nfl_season, nfl_season_week=nfl_season_week) return self._make_request(self.prefix + path) def get_weekly_injuries(self, year, nfl_season, nfl_season_week): """Obtain injuries for the NFL for a given week. Pre-Season (PRE) valid weeks 1-4, Regular Season (REG) weeks 1-17, Post-Season (PST) weeks 1-4. """ path = "seasontd/{year:4d}/{nfl_season}/{nfl_season_week}/injuries".format( year=year, nfl_season=nfl_season, nfl_season_week=nfl_season_week) return self._make_request(self.prefix + path) def get_weekly_depth_charts(self, year, nfl_season, nfl_season_week): """Obtain depth charts for the NFL for a given week. Pre-Season (PRE) valid weeks 1-4, Regular Season (REG) weeks 1-17, Post-Season (PST) weeks 1-4. """ path = "seasontd/{year:4d}/{nfl_season}/{nfl_season_week}/depth_charts".format( year=year, nfl_season=nfl_season, nfl_season_week=nfl_season_week) return self._make_request(self.prefix + path)
45.232759
90
0.658853
5,134
0.978464
0
0
0
0
0
0
2,076
0.395655
1945a3089e1f6313c2cc75593bf5a6b3e3eaea61
4,767
py
Python
rain/models/posemb_transformer.py
qq1418381215/caat
1422707bef7a2aeca272fa085f410bff07ced760
[ "MIT" ]
14
2021-09-15T02:49:18.000Z
2022-03-15T06:00:54.000Z
rain/models/posemb_transformer.py
qq1418381215/caat
1422707bef7a2aeca272fa085f410bff07ced760
[ "MIT" ]
11
2021-09-17T03:17:07.000Z
2022-02-08T03:12:41.000Z
rain/models/posemb_transformer.py
qq1418381215/caat
1422707bef7a2aeca272fa085f410bff07ced760
[ "MIT" ]
2
2021-11-06T19:22:29.000Z
2022-03-24T11:56:11.000Z
import torch import os from torch import Tensor import torch.nn as nn from fairseq import options, utils, checkpoint_utils from fairseq.dataclass import ChoiceEnum, FairseqDataclass from fairseq.models import ( transformer, FairseqLanguageModel, register_model, register_model_architecture, FairseqEncoder, FairseqIncrementalDecoder, BaseFairseqModel,FairseqEncoderDecoderModel ) from rain.layers.rand_pos import PositionalEmbedding from .speech_transformer import SpeechTransformerModelConfig @register_model("randpos_transformer", dataclass=SpeechTransformerModelConfig) class RandposTransformer(transformer.TransformerModel): @classmethod def build_model(cls, args, task): """Build a new model instance.""" # make sure all arguments are present in older models if getattr(args,"max_text_positions", None) is None: args.max_text_positions= 1024 args.max_source_positions = args.max_text_positions args.max_target_positions = args.max_text_positions src_dict, tgt_dict = task.source_dictionary, task.target_dictionary if args.share_all_embeddings: if src_dict != tgt_dict: raise ValueError("--share-all-embeddings requires a joined dictionary") if args.encoder_embed_dim != args.decoder_embed_dim: raise ValueError( "--share-all-embeddings requires --encoder-embed-dim to match --decoder-embed-dim" ) if args.decoder_embed_path and ( args.decoder_embed_path != args.encoder_embed_path ): raise ValueError( "--share-all-embeddings not compatible with --decoder-embed-path" ) encoder_embed_tokens = cls.build_embedding( args, src_dict, args.encoder_embed_dim, args.encoder_embed_path ) decoder_embed_tokens = encoder_embed_tokens args.share_decoder_input_output_embed = True else: encoder_embed_tokens = cls.build_embedding( args, src_dict, args.encoder_embed_dim, args.encoder_embed_path ) decoder_embed_tokens = cls.build_embedding( args, tgt_dict, args.decoder_embed_dim, args.decoder_embed_path ) encoder = cls.build_encoder(args, src_dict, encoder_embed_tokens) decoder = cls.build_decoder(args, tgt_dict, decoder_embed_tokens) return cls(args, encoder, decoder) @classmethod def build_encoder(cls, args, src_dict, embed_tokens): model = transformer.TransformerEncoder(args, src_dict, embed_tokens) embed_dim= embed_tokens.embedding_dim if model.embed_positions is not None and args.rand_pos_encoder >0: model.embed_positions= PositionalEmbedding( model.max_source_positions, embed_dim, model.padding_idx, rand_max = args.rand_pos_encoder, learned=args.decoder_learned_pos, ) return model @classmethod def build_decoder(cls, args, tgt_dict, embed_tokens): model = transformer.TransformerDecoder( args, tgt_dict, embed_tokens, no_encoder_attn=getattr(args, "no_cross_attention", False), ) if model.embed_positions is not None and args.rand_pos_decoder >0: model.embed_positions= PositionalEmbedding( model.max_target_positions, model.embed_dim, model.padding_idx, rand_max = args.rand_pos_decoder, learned=args.decoder_learned_pos, ) return model @register_model_architecture("randpos_transformer", "randpos_transformer2") def randpos_transformer(args): args.rand_pos_encoder= getattr(args, "rand_pos_encoder", 30) args.rand_pos_decoder= getattr(args, "rand_pos_decoder", 30) transformer.base_architecture(args) @register_model_architecture("randpos_transformer", "randpos_transformer_small") def randpos_transformer_small(args): args.encoder_embed_dim = getattr(args, "encoder_embed_dim", 256) args.encoder_ffn_embed_dim = getattr(args, "encoder_ffn_embed_dim", 256 * 8) args.encoder_attention_heads = getattr(args, "encoder_attention_heads", 4) args.decoder_attention_heads = getattr(args, "decoder_attention_heads", 4) args.decoder_embed_dim = getattr(args, "decoder_embed_dim", 256) args.attention_dropout = getattr(args, "attention_dropout", 0.1) args.activation_dropout = getattr(args, "activation_dropout", 0.1) args.dropout = getattr(args, "dropout", 0.1) randpos_transformer(args)
42.5625
102
0.680092
3,171
0.665198
0
0
4,239
0.889239
0
0
633
0.132788
1946122a44cafe21fe0a3f27b222402b8e3d88b9
6,345
py
Python
ensembl_map/symbol.py
mattdoug604/ensembl_map
5edb8a48943df4b53effe3cd7ddf4d461fdd4bae
[ "MIT" ]
null
null
null
ensembl_map/symbol.py
mattdoug604/ensembl_map
5edb8a48943df4b53effe3cd7ddf4d461fdd4bae
[ "MIT" ]
1
2020-03-24T18:20:15.000Z
2020-03-25T22:56:06.000Z
ensembl_map/symbol.py
mattdoug604/ensembl_map
5edb8a48943df4b53effe3cd7ddf4d461fdd4bae
[ "MIT" ]
null
null
null
from .ensembl import Ensembl from .util import is_ensembl_id ########## ## Exon ## ########## def get_exons(feature, feature_type): exons = [] for exon_id in get_exon_ids(feature, feature_type): exons.append(_query(exon_id, "exon", Ensembl().data.exon_by_id)) return exons def get_exon_ids(feature, feature_type): if is_ensembl_id(feature): exon_ids = _get_exon_ids_by_id(feature, feature_type) else: exon_ids = _get_exon_ids_by_name(feature, feature_type) if exon_ids and not isinstance(exon_ids, list): exon_ids = [exon_ids] return sorted(exon_ids) def _get_exon_ids_by_id(feature, feature_type): if feature_type == "cds" or feature_type == "transcript": return _query(feature, feature_type, Ensembl().data.exon_ids_of_transcript_id) elif feature_type == "exon": return feature elif feature_type == "gene": return _query(feature, feature_type, Ensembl().data.exon_ids_of_gene_id) elif feature_type == "protein": exon_ids = [] for transcript_id in get_transcript_ids(feature, "protein"): exon_ids.extend(_get_exon_ids_by_id(transcript_id, "transcript")) return exon_ids else: raise TypeError(f"Cannot get exon IDs from (ID={feature}, type={feature_type})") def _get_exon_ids_by_name(feature, feature_type): if feature_type == "cds" or feature_type == "transcript": return _query(feature, "transcript", Ensembl().data.exon_ids_of_transcript_name) elif feature_type == "gene": return _query(feature, feature_type, Ensembl().data.exon_ids_of_gene_name) else: raise TypeError(f"Cannot get exon IDs from (name={feature}, type={feature_type})") ########## ## Gene ## ########## def get_genes(feature, feature_type): genes = [] for gene_id in get_gene_ids(feature, feature_type): genes.append(_query(gene_id, "gene", Ensembl().data.gene_by_id)) return genes def get_gene_ids(feature, feature_type): if is_ensembl_id(feature): gene_ids = _get_gene_ids_by_id(feature, feature_type) else: gene_ids = _get_gene_ids_by_name(feature, feature_type) if gene_ids and not isinstance(gene_ids, list): gene_ids = [gene_ids] return sorted(gene_ids) def _get_gene_ids_by_id(feature, feature_type): if feature_type == "cds" or feature_type == "transcript": gene_name = _query(feature, feature_type, Ensembl().data.gene_name_of_transcript_id) return _gene_name_to_id(gene_name) elif feature_type == "exon": gene_name = _query(feature, feature_type, Ensembl().data.gene_name_of_exon_id) return _gene_name_to_id(gene_name) elif feature_type == "gene": return feature elif feature_type == "protein": return _query(feature, feature_type, Ensembl().data.gene_id_of_protein_id) else: raise TypeError(f"Cannot get gene IDs from (ID={feature}, type={feature_type})") def _get_gene_ids_by_name(feature, feature_type): if feature_type == "cds" or feature_type == "transcript": gene_name = _query(feature, "transcript", Ensembl().data.gene_name_of_transcript_name) return _gene_name_to_id(gene_name) elif feature_type == "gene": return _query(feature, feature_type, Ensembl().data.gene_ids_of_gene_name) else: raise TypeError(f"Cannot get gene IDs from (name={feature}, type={feature_type})") def _gene_name_to_id(gene_name): return Ensembl().data.gene_ids_of_gene_name(gene_name) ############# ## Protein ## ############# def get_protein_ids(feature, feature_type): protein_ids = [] for transcript in get_transcripts(feature, feature_type): if transcript.protein_id: protein_ids.append(transcript.protein_id) return sorted(protein_ids) ################# ## Transcripts ## ################# def get_transcripts(feature, feature_type): transcripts = [] for transcript_id in get_transcript_ids(feature, feature_type): transcripts.append(_query(transcript_id, "transcript", Ensembl().data.transcript_by_id)) return transcripts def get_transcript_ids(feature, feature_type): if is_ensembl_id(feature): transcript_ids = _get_transcript_ids_by_id(feature, feature_type) else: transcript_ids = _get_transcript_ids_by_name(feature, feature_type) if transcript_ids and not isinstance(transcript_ids, list): transcript_ids = [transcript_ids] return sorted(transcript_ids) def _get_transcript_ids_with_exon(feature): # NOTE: with `pyensembl==1.8.5` calling `transcript_ids_of_exon_ids` does not # match anything. As a workaround, we can map the exon to its gene then return # all transcripts of that gene that contain the exon. transcript_ids = [] exon = _query(feature, "exon", Ensembl().data.exon_by_id) for transcript in get_transcripts(exon.gene_id, "gene"): if feature in [i.exon_id for i in transcript.exons]: transcript_ids.append(transcript.transcript_id) return transcript_ids def _get_transcript_ids_by_id(feature, feature_type): if feature_type == "cds" or feature_type == "transcript": return feature elif feature_type == "exon": return _get_transcript_ids_with_exon(feature) elif feature_type == "gene": return _query(feature, feature_type, Ensembl().data.transcript_ids_of_gene_id) elif feature_type == "protein": return _query(feature, feature_type, Ensembl().data.transcript_id_of_protein_id) else: raise TypeError(f"Cannot get transcript IDs from (ID={feature}, type={feature_type})") def _get_transcript_ids_by_name(feature, feature_type): if feature_type == "cds" or feature_type == "transcript": return _query(feature, "transcript", Ensembl().data.transcript_ids_of_transcript_name) elif feature_type == "gene": return _query(feature, feature_type, Ensembl().data.transcript_ids_of_gene_name) else: raise TypeError(f"Cannot get transcript IDs from (name={feature}, type={feature_type})") ##################### ## Query functions ## ##################### def _query(feature, feature_type, func): try: return func(feature) except ValueError: raise ValueError(f"No match for {feature_type} '{feature}'")
35.446927
96
0.695035
0
0
0
0
0
0
0
0
1,135
0.178881
194675cce0a60e3494b3def09e1010cda20f0f00
1,113
py
Python
MiGRIDS/InputHandler/readAllTimeSeries.py
mmuellerstoffels/GBSTools
aebd8aa6667a2284aaa16424f9b9d22ca3a2a375
[ "MIT" ]
8
2019-02-18T14:18:55.000Z
2022-03-04T12:34:24.000Z
MiGRIDS/InputHandler/readAllTimeSeries.py
mmuellerstoffels/GBSTools
aebd8aa6667a2284aaa16424f9b9d22ca3a2a375
[ "MIT" ]
3
2018-09-01T00:30:19.000Z
2018-09-01T01:09:50.000Z
MiGRIDS/InputHandler/readAllTimeSeries.py
acep-uaf/GBSTools
aebd8aa6667a2284aaa16424f9b9d22ca3a2a375
[ "MIT" ]
3
2019-06-10T19:49:22.000Z
2021-05-08T08:42:57.000Z
from MiGRIDS.InputHandler.readCsv import readCsv def readAllTimeSeries(inputDict): ''' Cycles through a list of files in the AVEC format and imports them into a single dataframe. :param inputDict: :return: pandas.DataFrame with data from all input files. ''' df = None for i in range(len(inputDict['fileNames'])): print(inputDict['fileNames'][i])# for each data file inputDict['fileName'] = inputDict['fileNames'][i] if i == 0: # read data file into a new dataframe if first iteration df = readCsv(inputDict) else: # otherwise append df2 = readCsv(inputDict) # the new file # get intersection of columns, df2Col = df2.columns dfCol = df.columns dfNewCol = [val for val in dfCol if val in df2Col] # resize dataframes to only contain columns contained in both dataframes df = df[dfNewCol] df2 = df2[dfNewCol] df = df.append(df2) # append df = df.sort_values('DATE') return df
33.727273
95
0.591195
0
0
0
0
0
0
0
0
458
0.4115
1946a0c16887bdd25321c997aa98e68109542c3a
12,725
py
Python
tests/test_dryruns.py
gmcgoldr/pyteal_utils
6dc33d1f18b73ce26163040e37fb145ccd5c1de8
[ "MIT" ]
2
2021-12-16T15:43:46.000Z
2022-01-11T13:24:50.000Z
tests/test_dryruns.py
gmcgoldr/pyteal_utils
6dc33d1f18b73ce26163040e37fb145ccd5c1de8
[ "MIT" ]
null
null
null
tests/test_dryruns.py
gmcgoldr/pyteal_utils
6dc33d1f18b73ce26163040e37fb145ccd5c1de8
[ "MIT" ]
1
2022-01-11T13:25:03.000Z
2022-01-11T13:25:03.000Z
import algosdk as ag import pyteal as tl import pytest from algosdk.future.transaction import OnComplete from algosdk.v2client.algod import AlgodClient from algosdk.v2client.models.application_local_state import ApplicationLocalState from algosdk.v2client.models.application_state_schema import ApplicationStateSchema from algoappdev import apps, dryruns, utils from algoappdev.utils import AlgoAppDevError, idx_to_address, to_key_value def test_build_application_uses_defaults(): app = dryruns.build_application(1) assert app.id == 1 assert app.params.creator is None assert app.params.approval_program is None assert app.params.clear_state_program is None assert app.params.global_state_schema == dryruns.MAX_SCHEMA assert app.params.local_state_schema == dryruns.MAX_SCHEMA def test_build_application_passes_arguments(): app = dryruns.build_application( 1, b"approval", b"clear", ApplicationStateSchema(1, 2), ApplicationStateSchema(2, 3), ["state"], b"creator", ) assert app.id == 1 assert app.params.creator == b"creator" assert app.params.approval_program == b"approval" assert app.params.clear_state_program == b"clear" assert app.params.global_state_schema == ApplicationStateSchema(1, 2) assert app.params.local_state_schema == ApplicationStateSchema(2, 3) def test_build_account_uses_defaults(): account = dryruns.build_account("address") assert account.address == "address" assert account.amount is None assert account.apps_local_state is None assert account.assets is None assert account.status == "Offline" def test_build_account_passes_arguments(): account = dryruns.build_account("address", ["state"], ["asset"], 123, "status") assert account.address == "address" assert account.amount == 123 assert account.apps_local_state == ["state"] assert account.assets == ["asset"] assert account.status == "status" def test_suggested_params_uses_defaults(): params = dryruns.AppCallCtx().suggested_params() assert params.first == 1 assert params.last == 1000 assert params.fee == ag.constants.min_txn_fee assert params.flat_fee assert not params.gh def test_suggested_params_uses_round(): params = dryruns.AppCallCtx().with_round(123).suggested_params() assert params.first == 123 assert params.last == 1122 def test_with_app_program_uses_defaults(): ctx = dryruns.AppCallCtx().with_app_program() assert ctx.apps assert ctx.apps[0].id == 1 assert ctx.apps[0].params.global_state_schema == dryruns.MAX_SCHEMA assert ctx.apps[0].params.local_state_schema == dryruns.MAX_SCHEMA def test_with_app_program_passes_arguments(): ctx = dryruns.AppCallCtx().with_app_program( program=b"code", app_idx=123, state=["state"] ) assert ctx.apps assert ctx.apps[0].id == 123 assert ctx.apps[0].params.approval_program == b"code" assert ctx.apps[0].params.global_state == ["state"] def test_with_account_opted_in_uses_defaults(): ctx = ( dryruns.AppCallCtx() .with_app_program() .with_app_program() .with_account_opted_in() ) assert ctx.accounts # starts addresses at 1 assert ctx.accounts[0].address == idx_to_address(1) # automatically opted into last account assert ctx.accounts[0].apps_local_state == [ApplicationLocalState(2)] def test_with_account_opted_in_passes_arguments(): ctx = dryruns.AppCallCtx().with_account_opted_in( 123, idx_to_address(234), ["state"] ) assert ctx.accounts assert ctx.accounts[0].address == idx_to_address(234) assert ctx.accounts[0].apps_local_state == [ ApplicationLocalState(123, key_value=["state"]) ] def test_with_txn_call_uses_defaults(): ctx = ( dryruns.AppCallCtx().with_app_program().with_account_opted_in().with_txn_call() ) assert ctx.txns assert ctx.txns[0].sender == ctx.accounts[0].address assert ctx.txns[0].index == ctx.apps[0].id assert ctx.txns[0].on_complete == OnComplete.NoOpOC assert ctx.txns[0].accounts == [ctx.accounts[0].address] assert ctx.txns[0].foreign_apps == [ctx.apps[0].id] assert ctx.txns[0].foreign_assets == None def test_with_txn_call_passes_arguments(): ctx = ( dryruns.AppCallCtx() .with_app_program() .with_account_opted_in() .with_txn_call(OnComplete.OptInOC, sender=idx_to_address(123), app_idx=123) ) assert ctx.txns assert ctx.txns[0].sender == idx_to_address(123) assert ctx.txns[0].index == 123 assert ctx.txns[0].on_complete == OnComplete.OptInOC assert ctx.txns[0].accounts == [ctx.accounts[0].address] assert ctx.txns[0].foreign_apps == [ctx.apps[0].id] assert ctx.txns[0].foreign_assets == None def test_check_err_raises_error(): result = {"error": "message"} with pytest.raises(AlgoAppDevError, match="message"): dryruns.check_err(result) def test_get_messages_returns_message_for_transaction(): result = {"txns": [None, {"app-call-messages": ["a", "b"]}]} assert dryruns.get_messages(result, 1) == ["a", "b"] def test_context_with_nothing_does_nothing(algod_client: AlgodClient): result = algod_client.dryrun(dryruns.AppCallCtx().build_request()) dryruns.check_err(result) def test_context_txn_with_no_app_does_not_run(algod_client: AlgodClient): result = algod_client.dryrun(dryruns.AppCallCtx().with_txn_call().build_request()) assert len(result.get("txns", [])) == 1 assert result["txns"][0]["disassembly"] is None def test_context_txn_calls_program(algod_client: AlgodClient): logic = tl.Return(tl.Int(1)) result = algod_client.dryrun( dryruns.AppCallCtx() .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) .with_txn_call() .build_request() ) dryruns.check_err(result) assert dryruns.get_messages(result) == ["ApprovalProgram", "PASS"] def test_context_txn_accesses_args(algod_client: AlgodClient): logic = tl.Return(tl.Txn.application_args[0] == tl.Bytes("abc")) result = algod_client.dryrun( dryruns.AppCallCtx() .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) .with_txn_call(args=[b"abc"]) .build_request() ) dryruns.check_err(result) assert dryruns.get_messages(result) == ["ApprovalProgram", "PASS"] def test_context_txn_accesses_program(algod_client: AlgodClient): logic = tl.Return(tl.App.globalGet(tl.Bytes("abc")) == tl.Int(123)) result = algod_client.dryrun( dryruns.AppCallCtx() .with_app_program( apps.compile_source(algod_client, apps.compile_expr(logic)), state=[to_key_value(b"abc", 123)], ) .with_txn_call() .build_request() ) dryruns.check_err(result) assert dryruns.get_messages(result) == ["ApprovalProgram", "PASS"] @pytest.mark.skip(reason="FIXME: algod is doesn't see the foreign app") def test_context_txn_accesses_multiple_programs(algod_client: AlgodClient): value = tl.App.globalGetEx(tl.Txn.applications[1], tl.Bytes("abc")) logic = tl.Return(tl.Seq(value, value.value() == tl.Int(123))) result = algod_client.dryrun( dryruns.AppCallCtx() # this app can't be called because it has no program .with_app( dryruns.build_application(app_idx=1, state=[to_key_value(b"abc", 123)]) ) # this is the app to call which will look for state in the other app .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) # calls the last app .with_txn_call().build_request() ) dryruns.check_err(result) assert dryruns.get_messages(result) == ["ApprovalProgram", "PASS"] def test_context_txn_accesses_multiple_txns(algod_client: AlgodClient): logic = tl.Cond( [tl.Txn.on_completion() == tl.OnComplete.OptIn, tl.Return(tl.Int(1))], [ tl.Txn.on_completion() == tl.OnComplete.NoOp, tl.Return(tl.Gtxn[0].on_completion() == tl.OnComplete.OptIn), ], ) result = algod_client.dryrun( dryruns.AppCallCtx() .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) .with_account(dryruns.Account(utils.idx_to_address(1))) # this will opt-in the last account .with_txn_call(dryruns.OnComplete.OptInOC) # this will do a generic no op call .with_txn_call() .build_request() ) dryruns.check_err(result) # both transactions pass assert dryruns.get_messages(result, 0) == ["ApprovalProgram", "PASS"] assert dryruns.get_messages(result, 1) == ["ApprovalProgram", "PASS"] def test_context_txn_accesses_last_timestamp(algod_client: AlgodClient): logic = tl.Return(tl.Global.latest_timestamp() == tl.Int(123)) result = algod_client.dryrun( dryruns.AppCallCtx() .with_latest_timestamp(123) .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) .with_txn_call() .build_request() ) dryruns.check_err(result) assert dryruns.get_messages(result) == ["ApprovalProgram", "PASS"] def test_context_txn_accesses_round(algod_client: AlgodClient): logic = tl.Return(tl.Global.round() == tl.Int(123)) result = algod_client.dryrun( dryruns.AppCallCtx() .with_round(123) .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) .with_txn_call() .build_request() ) dryruns.check_err(result) assert dryruns.get_messages(result) == ["ApprovalProgram", "PASS"] def test_context_txn_accesses_account(algod_client: AlgodClient): logic = tl.Return(tl.App.localGet(tl.Txn.sender(), tl.Bytes("abc")) == tl.Int(123)) result = algod_client.dryrun( dryruns.AppCallCtx() .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) # automatically opts into last app .with_account_opted_in(local_state=[to_key_value(b"abc", 123)]) # automatically sets sender to last account .with_txn_call() .build_request() ) dryruns.check_err(result) assert dryruns.get_messages(result) == ["ApprovalProgram", "PASS"] def test_context_txn_accesses_multiple_accounts(algod_client: AlgodClient): sender_address = idx_to_address(1) state_address = idx_to_address(2) logic = tl.Return( tl.And( # an additional account must be supplied with this local state tl.App.localGet(tl.Txn.accounts[1], tl.Bytes("abc")) == tl.Int(123), # it must differ from the sender tl.Txn.sender() != tl.Addr(state_address), ) ) result = algod_client.dryrun( dryruns.AppCallCtx() .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) .with_account_opted_in( local_state=[to_key_value(b"abc", 123)], address=state_address ) .with_txn_call(sender=sender_address) .build_request() ) dryruns.check_err(result) assert dryruns.get_messages(result) == ["ApprovalProgram", "PASS"] def test_get_trace_returns_trace(algod_client: AlgodClient): logic = tl.Return(tl.Int(1)) result = algod_client.dryrun( dryruns.AppCallCtx() .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) .with_txn_call() .build_request() ) assert dryruns.get_trace(result)[-1].source == "return" assert dryruns.get_trace(result)[-1].stack == [1] def test_get_global_deltas_returns_deltas(algod_client: AlgodClient): logic = tl.Seq(tl.App.globalPut(tl.Bytes("abc"), tl.Int(123)), tl.Return(tl.Int(1))) result = algod_client.dryrun( dryruns.AppCallCtx() .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) .with_txn_call() .build_request() ) assert dryruns.get_global_deltas(result) == [dryruns.KeyDelta(b"abc", 123)] def test_get_global_deltas_returns_deltas(algod_client: AlgodClient): logic = tl.Seq( tl.App.localPut(tl.Txn.sender(), tl.Bytes("abc"), tl.Int(123)), tl.Return(tl.Int(1)), ) result = algod_client.dryrun( dryruns.AppCallCtx() .with_app_program(apps.compile_source(algod_client, apps.compile_expr(logic))) .with_account_opted_in() .with_txn_call() .build_request() ) assert dryruns.get_local_deltas(result) == { idx_to_address(1): [dryruns.KeyDelta(b"abc", 123)] }
36.048159
88
0.691473
0
0
0
0
864
0.067898
0
0
1,110
0.08723
19476d50e68179e3181c58bfc67d757bccf5c292
6,191
py
Python
aatrn.py
kmkurn/uxtspwsd
ea4da18cec023d0dc487ee061861e6715edc2e85
[ "MIT" ]
null
null
null
aatrn.py
kmkurn/uxtspwsd
ea4da18cec023d0dc487ee061861e6715edc2e85
[ "MIT" ]
null
null
null
aatrn.py
kmkurn/uxtspwsd
ea4da18cec023d0dc487ee061861e6715edc2e85
[ "MIT" ]
null
null
null
# Copyright (c) 2021 Kemal Kurniawan from typing import Optional import math from einops import rearrange from torch import BoolTensor, Tensor from crf import DepTreeCRF, LinearCRF def compute_aatrn_loss( scores: Tensor, aa_mask: BoolTensor, mask: Optional[BoolTensor] = None, projective: bool = False, multiroot: bool = True, ) -> Tensor: assert aa_mask.shape == scores.shape masked_scores = scores.masked_fill(~aa_mask, -1e9) crf = DepTreeCRF(masked_scores, mask, projective, multiroot) crf_z = DepTreeCRF(scores, mask, projective, multiroot) return -crf.log_partitions().sum() + crf_z.log_partitions().sum() def compute_ambiguous_arcs_mask( scores: Tensor, threshold: float = 0.95, projective: bool = False, multiroot: bool = True, is_log_marginals: bool = False, ) -> BoolTensor: """If is_log_marginals then scores are assumed to be the log marginals.""" assert scores.dim() == 4 assert 0 <= threshold <= 1 if is_log_marginals: return _compute_ambiguous_arcs_mask_from_log_marginals( scores, threshold, projective, multiroot ) return _compute_ambiguous_arcs_mask(scores, threshold, projective, multiroot) def compute_ambiguous_tag_pairs_mask( scores: Tensor, threshold: float = 0.95, is_log_marginals: bool = False ) -> BoolTensor: if is_log_marginals: return _compute_ambiguous_tag_pairs_mask_from_log_marginals(scores, threshold) return _compute_ambiguous_tag_pairs_mask(scores, threshold) def _compute_ambiguous_arcs_mask( scores, threshold, projective, multiroot, include_max_tree=True ): _, slen, _, n_types = scores.shape crf = DepTreeCRF(scores, projective=projective, multiroot=multiroot) marginals = crf.marginals() # select high-prob arcs until their cumulative probability exceeds threshold marginals = rearrange(marginals, "bsz hlen dlen ntypes -> bsz dlen (hlen ntypes)") marginals, orig_indices = marginals.sort(dim=2, descending=True) arc_mask = marginals.cumsum(dim=2) < threshold # mark the arc that makes the cum sum exceeds threshold last_idx = arc_mask.long().sum(dim=2, keepdim=True).clamp(max=slen * n_types - 1) arc_mask = arc_mask.scatter(2, last_idx, True) # restore the arc_mask order and shape _, restore_indices = orig_indices.sort(dim=2) arc_mask = arc_mask.gather(2, restore_indices) if include_max_tree: # ensure maximum scoring tree is selected # each shape: (bsz, slen) best_heads, best_types = crf.argmax() best_idx = best_heads * n_types + best_types arc_mask = arc_mask.scatter(2, best_idx.unsqueeze(2), True) arc_mask = rearrange(arc_mask, "bsz dlen (hlen ntypes) -> bsz hlen dlen ntypes", hlen=slen) return arc_mask def _compute_ambiguous_arcs_mask_from_log_marginals( log_marginals, threshold, projective, multiroot ): _, slen, _, n_types = log_marginals.shape # select high-prob arcs until their cumulative probability exceeds threshold log_marginals = rearrange(log_marginals, "bsz hlen dlen ntypes -> bsz dlen (hlen ntypes)") log_marginals, orig_indices = log_marginals.sort(dim=2, descending=True) arc_mask = _logcumsumexp(log_marginals, dim=2) < math.log(threshold) # mark the arc that makes the cum sum exceeds threshold last_idx = arc_mask.long().sum(dim=2, keepdim=True).clamp(max=slen * n_types - 1) arc_mask = arc_mask.scatter(2, last_idx, True) # restore the arc_mask order and shape _, restore_indices = orig_indices.sort(dim=2) arc_mask = arc_mask.gather(2, restore_indices) arc_mask = rearrange(arc_mask, "bsz dlen (hlen ntypes) -> bsz hlen dlen ntypes", hlen=slen) return arc_mask def _compute_ambiguous_tag_pairs_mask( scores: Tensor, threshold: float = 0.95, include_max_tags: bool = True ) -> BoolTensor: bsz, slen, n_next_tags, n_tags = scores.shape crf = LinearCRF(scores) margs = crf.marginals() # select high prob tag pairs until their cumulative probability exceeds threshold margs = rearrange(margs, "bsz slen nntags ntags -> bsz slen (nntags ntags)") margs, orig_indices = margs.sort(dim=2, descending=True) tp_mask = margs.cumsum(dim=2) < threshold # select the tag pairs that make the cum sum exceeds threshold last_idx = tp_mask.long().sum(dim=2, keepdim=True).clamp(max=n_next_tags * n_tags - 1) tp_mask = tp_mask.scatter(2, last_idx, True) # restore the order and shape _, restore_indices = orig_indices.sort(dim=2) tp_mask = tp_mask.gather(2, restore_indices) if include_max_tags: best_tags = crf.argmax() assert best_tags.shape == (bsz, slen + 1) best_idx = best_tags[:, 1:] * n_tags + best_tags[:, :-1] assert best_idx.shape == (bsz, slen) tp_mask = tp_mask.scatter(2, best_idx.unsqueeze(2), True) tp_mask = rearrange( tp_mask, "bsz slen (nntags ntags) -> bsz slen nntags ntags", nntags=n_next_tags ) return tp_mask # type: ignore def _compute_ambiguous_tag_pairs_mask_from_log_marginals( log_marginals: Tensor, threshold: float = 0.95 ) -> BoolTensor: _, _, n_next_tags, n_tags = log_marginals.shape # select high prob tag pairs until their cumulative probability exceeds threshold log_margs = rearrange(log_marginals, "bsz slen nntags ntags -> bsz slen (nntags ntags)") log_margs, orig_indices = log_margs.sort(dim=2, descending=True) tp_mask = _logcumsumexp(log_margs, dim=2) < math.log(threshold) # select the tag pairs that make the cum sum exceeds threshold last_idx = tp_mask.long().sum(dim=2, keepdim=True).clamp(max=n_next_tags * n_tags - 1) tp_mask = tp_mask.scatter(2, last_idx, True) # restore the order and shape _, restore_indices = orig_indices.sort(dim=2) tp_mask = tp_mask.gather(2, restore_indices) tp_mask = rearrange( tp_mask, "bsz slen (nntags ntags) -> bsz slen nntags ntags", nntags=n_next_tags ) return tp_mask # type: ignore def _logcumsumexp(x: Tensor, dim: int = -1) -> Tensor: max = x.max(dim, keepdim=True)[0] return (x - max).exp().cumsum(dim).log() + max
37.295181
95
0.709255
0
0
0
0
0
0
0
0
1,278
0.206429
1947c38029e5b214e95d735bbab912cedc55ad7e
5,151
py
Python
wildlifelicensing/apps/returns/models.py
jawaidm/wildlifelicensing
87e8e9ab163e0d7bbb0c7a654a13ce8a4d8fcf82
[ "Apache-2.0" ]
null
null
null
wildlifelicensing/apps/returns/models.py
jawaidm/wildlifelicensing
87e8e9ab163e0d7bbb0c7a654a13ce8a4d8fcf82
[ "Apache-2.0" ]
11
2019-03-19T02:03:11.000Z
2019-05-31T07:20:59.000Z
wildlifelicensing/apps/returns/models.py
jawaidm/wildlifelicensing
87e8e9ab163e0d7bbb0c7a654a13ce8a4d8fcf82
[ "Apache-2.0" ]
2
2020-08-10T10:17:10.000Z
2021-10-31T23:20:53.000Z
from __future__ import unicode_literals from django.db import models from django.contrib.postgres.fields.jsonb import JSONField from django.core.exceptions import ValidationError import datapackage import jsontableschema from ledger.accounts.models import RevisionedMixin, EmailUser from wildlifelicensing.apps.main.models import WildlifeLicenceType, WildlifeLicence, CommunicationsLogEntry class ReturnType(models.Model): licence_type = models.OneToOneField(WildlifeLicenceType) # data_descriptor should follow the Tabular Data Package format described at: # http://data.okfn.org/doc/tabular-data-package # also in: # http://dataprotocols.org/data-packages/ # The schema inside the 'resources' must follow the JSON Table Schema defined at: # http://dataprotocols.org/json-table-schema/ data_descriptor = JSONField() month_frequency = models.IntegerField(choices=WildlifeLicence.MONTH_FREQUENCY_CHOICES, default=WildlifeLicence.DEFAULT_FREQUENCY) def clean(self): """ Validate the data descriptor """ # Validate the data package validator = datapackage.DataPackage(self.data_descriptor) try: validator.validate() except Exception: raise ValidationError('Data package errors: {}'.format([str(e[0]) for e in validator.iter_errors()])) # Check that there is at least one resources defined (not required by the standard) if len(self.resources) == 0: raise ValidationError('You must define at least one resource') # Validate the schema for all resources for resource in self.resources: if 'schema' not in resource: raise ValidationError("Resource without a 'schema'.") else: schema = resource.get('schema') try: jsontableschema.validate(schema) except Exception: raise ValidationError( 'Schema errors for resource "{}": {}'.format( resource.get('name'), [str(e[0]) for e in jsontableschema.validator.iter_errors(schema)])) @property def resources(self): return self.data_descriptor.get('resources', []) def get_resource_by_name(self, name): for resource in self.resources: if resource.get('name') == name: return resource return None def get_resources_names(self): return [r.get('name') for r in self.resources] def get_schema_by_name(self, name): resource = self.get_resource_by_name(name) return resource.get('schema', {}) if resource else None class Return(RevisionedMixin): STATUS_CHOICES = [ ('current', 'Current'), ('future', 'Future'), ('draft', 'Draft'), ('submitted', 'Submitted'), ('amendment_required', 'Amendment Required'), ('amended', 'Amended'), ('accepted', 'Accepted'), ('declined', 'Declined') ] DEFAULT_STATUS = STATUS_CHOICES[1][0] CUSTOMER_EDITABLE_STATE = ['current', 'draft', 'amendment_required'] return_type = models.ForeignKey(ReturnType) licence = models.ForeignKey(WildlifeLicence) status = models.CharField(max_length=20, choices=STATUS_CHOICES, default=DEFAULT_STATUS) lodgement_number = models.CharField(max_length=9, blank=True, default='') lodgement_date = models.DateField(blank=True, null=True) due_date = models.DateField(null=False, blank=False) proxy_customer = models.ForeignKey(EmailUser, blank=True, null=True) nil_return = models.BooleanField(default=False) comments = models.TextField(blank=True, null=True) @property def reference(self): return '{}'.format(self.lodgement_number) @property def can_user_edit(self): """ :return: True if the return is in one of the editable status. """ return self.status in self.CUSTOMER_EDITABLE_STATE @property def pending_amendments_qs(self): return ReturnAmendmentRequest.objects.filter(ret=self, status='requested') class ReturnAmendmentRequest(models.Model): STATUS_CHOICES = (('requested', 'Requested'), ('amended', 'Amended')) ret = models.ForeignKey(Return) status = models.CharField('Status', max_length=30, choices=STATUS_CHOICES, default=STATUS_CHOICES[0][0]) reason = models.TextField(blank=False) officer = models.ForeignKey(EmailUser, null=True) class ReturnTable(RevisionedMixin): ret = models.ForeignKey(Return) name = models.CharField(max_length=50) class ReturnRow(RevisionedMixin): return_table = models.ForeignKey(ReturnTable) data = JSONField(blank=True, null=True) class ReturnLogEntry(CommunicationsLogEntry): ret = models.ForeignKey(Return) def save(self, **kwargs): # save the application reference if the reference not provided if not self.reference: self.reference = self.ret.reference super(ReturnLogEntry, self).save(**kwargs)
34.57047
113
0.664143
4,739
0.920016
0
0
495
0.096098
0
0
1,109
0.215298
194979bac6f323e9a28bd3fab05ed2877e60ddea
605
py
Python
CE_to_AE_enemy_converter.py
Plouni/mari0_se_ce_to_ae_level_converter
9aa0d0ebffac4df1b5d541ff003bd9abeb187a0a
[ "MIT" ]
1
2022-02-03T23:07:20.000Z
2022-02-03T23:07:20.000Z
CE_to_AE_enemy_converter.py
Plouni/mari0_se_ce_to_ae_level_converter
9aa0d0ebffac4df1b5d541ff003bd9abeb187a0a
[ "MIT" ]
null
null
null
CE_to_AE_enemy_converter.py
Plouni/mari0_se_ce_to_ae_level_converter
9aa0d0ebffac4df1b5d541ff003bd9abeb187a0a
[ "MIT" ]
null
null
null
import os import json import logging cwd = os.getcwd() list_enemy = [file for file in os.listdir(cwd) if '.json' in file[-5:]] for enemy in list_enemy: try: with open(cwd + '\\' + enemy, 'r') as f: enemy_txt = f.read() enemy_txt = enemy_txt.replace('offsetx','offsetX').replace('offsety','offsetY').replace('quadcenterx','quadcenterX').replace('quadcentery','quadcenterY').replace('quadcount','quadCount') with open(cwd + '\\' + enemy, 'w+') as f: f.write(enemy_txt) except: print("Error for enemy: ", enemy_txt)
26.304348
194
0.591736
0
0
0
0
0
0
0
0
151
0.249587
1949bf476b27ab37588853e2472ecb87a7d25778
5,485
py
Python
tests/python/tensor_graph/test/test_internal/correctness/grad-op-test/te-cat-case2.py
QinHan-Erin/AMOS
634bf48edf4015e4a69a8c32d49b96bce2b5f16f
[ "Apache-2.0" ]
22
2022-03-18T07:29:31.000Z
2022-03-23T14:54:32.000Z
tests/python/tensor_graph/test/test_internal/correctness/grad-op-test/te-cat-case2.py
QinHan-Erin/AMOS
634bf48edf4015e4a69a8c32d49b96bce2b5f16f
[ "Apache-2.0" ]
null
null
null
tests/python/tensor_graph/test/test_internal/correctness/grad-op-test/te-cat-case2.py
QinHan-Erin/AMOS
634bf48edf4015e4a69a8c32d49b96bce2b5f16f
[ "Apache-2.0" ]
2
2022-03-18T08:26:34.000Z
2022-03-20T06:02:48.000Z
from tvm import testing from tvm from tvm import topi import tvm import numpy as np import torch dim0 = 3 dim1 = 4 dim2 = 1 shape_size1 = [dim0, dim1, dim2] shape_size2 = [dim0, dim1, dim2 * 8] dtype = "float32" cap0 = tvm.te.placeholder(shape_size1, dtype=dtype, name="cap0") cap1 = tvm.te.placeholder(shape_size1, dtype=dtype, name="cap1") cap2 = tvm.te.placeholder(shape_size1, dtype=dtype, name="cap2") cap3 = tvm.te.placeholder(shape_size1, dtype=dtype, name="cap3") cap4 = tvm.te.placeholder(shape_size1, dtype=dtype, name="cap4") cap5 = tvm.te.placeholder(shape_size1, dtype=dtype, name="cap5") cap6 = tvm.te.placeholder(shape_size1, dtype=dtype, name="cap6") cap7 = tvm.te.placeholder(shape_size1, dtype=dtype, name="cap7") cap_list = [cap0, cap1, cap2, cap3, cap4, cap5, cap6, cap7] C = tvm.te.compute(shape_size2, lambda i, j, k: # tvm.tir.Select( tvm.te.if_then_else( k == 0, cap0[i, j, k], tvm.te.if_then_else(k == 1, cap1[i, j, k-1], tvm.te.if_then_else(k == 2, cap2[i, j, k-2], tvm.te.if_then_else(k == 3, cap3[i, j, k-3], tvm.te.if_then_else(k == 4, cap4[i, j, k-4], tvm.te.if_then_else(k == 5, cap5[i, j, k-5], tvm.te.if_then_else(k == 6, cap6[i, j, k-6], cap7[i, j, k-7]))))))), name="concat") dC = tvm.te.placeholder(C.shape, dtype=dtype, name="dC") dcap0, dcap1, dcap2, dcap3, dcap4, dcap5, dcap6, dcap7 = tvm.tg.gradient(C, cap_list, dC) dcap_list = [dcap0, dcap1, dcap2, dcap3, dcap4, dcap5, dcap6, dcap7] s = tvm.te.create_schedule([C.op, dcap0.op, dcap1.op, dcap2.op, dcap3.op, dcap4.op, dcap5.op, dcap6.op, dcap7.op]) print(tvm.lower(s, cap_list + [C, dC] + dcap_list, simple_mode=True)) func = tvm.build(s, cap_list + [C, dC] + dcap_list, target="llvm") cap0_np = np.random.uniform(-10, 10, shape_size1).astype("float32") cap1_np = np.random.uniform(-10, 10, shape_size1).astype("float32") cap2_np = np.random.uniform(-10, 10, shape_size1).astype("float32") cap3_np = np.random.uniform(-10, 10, shape_size1).astype("float32") cap4_np = np.random.uniform(-10, 10, shape_size1).astype("float32") cap5_np = np.random.uniform(-10, 10, shape_size1).astype("float32") cap6_np = np.random.uniform(-10, 10, shape_size1).astype("float32") cap7_np = np.random.uniform(-10, 10, shape_size1).astype("float32") dC_np = np.ones(shape_size2).astype("float32") dcap0_np = np.zeros(shape_size1).astype("float32") dcap1_np = np.zeros(shape_size1).astype("float32") dcap2_np = np.zeros(shape_size1).astype("float32") dcap3_np = np.zeros(shape_size1).astype("float32") dcap4_np = np.zeros(shape_size1).astype("float32") dcap5_np = np.zeros(shape_size1).astype("float32") dcap6_np = np.zeros(shape_size1).astype("float32") dcap7_np = np.zeros(shape_size1).astype("float32") ctx = tvm.context("llvm", 0) cap0_tvm = tvm.nd.array(cap0_np, ctx) cap1_tvm = tvm.nd.array(cap1_np, ctx) cap2_tvm = tvm.nd.array(cap2_np, ctx) cap3_tvm = tvm.nd.array(cap3_np, ctx) cap4_tvm = tvm.nd.array(cap4_np, ctx) cap5_tvm = tvm.nd.array(cap5_np, ctx) cap6_tvm = tvm.nd.array(cap6_np, ctx) cap7_tvm = tvm.nd.array(cap7_np, ctx) C_np = np.zeros(shape_size2, dtype="float32") C_tvm = tvm.nd.array(C_np, ctx) dC_tvm = tvm.nd.array(dC_np, ctx) dcap0_tvm = tvm.nd.array(dcap0_np, ctx) dcap1_tvm = tvm.nd.array(dcap1_np, ctx) dcap2_tvm = tvm.nd.array(dcap2_np, ctx) dcap3_tvm = tvm.nd.array(dcap3_np, ctx) dcap4_tvm = tvm.nd.array(dcap4_np, ctx) dcap5_tvm = tvm.nd.array(dcap5_np, ctx) dcap6_tvm = tvm.nd.array(dcap6_np, ctx) dcap7_tvm = tvm.nd.array(dcap7_np, ctx) func(cap0_tvm, cap1_tvm, cap2_tvm, cap3_tvm, cap4_tvm, cap5_tvm, cap6_tvm, cap7_tvm, C_tvm, dC_tvm, dcap0_tvm, dcap1_tvm, dcap2_tvm, dcap3_tvm, dcap4_tvm, dcap5_tvm, dcap6_tvm, dcap7_tvm) print("dcap0_tvm", dcap0_tvm) # =======> # compare the results with pytorch cap0_torch = torch.tensor(cap0_np, requires_grad=True) cap1_torch = torch.tensor(cap1_np, requires_grad=True) cap2_torch = torch.tensor(cap2_np, requires_grad=True) cap3_torch = torch.tensor(cap3_np, requires_grad=True) cap4_torch = torch.tensor(cap4_np, requires_grad=True) cap5_torch = torch.tensor(cap5_np, requires_grad=True) cap6_torch = torch.tensor(cap6_np, requires_grad=True) cap7_torch = torch.tensor(cap7_np, requires_grad=True) C_torch = torch.cat([cap0_torch, cap1_torch, cap2_torch, cap3_torch, cap4_torch, cap5_torch, cap6_torch, cap7_torch], dim=2) loss = C_torch.sum() loss.backward() print("Pytorch gradient:\n cap0:", cap0_torch.grad.numpy(), "\ncap1:", cap1_torch.grad.numpy()) testing.assert_allclose(dcap0_tvm.asnumpy(), cap0_torch.grad.numpy(), atol=1e-30, rtol=1e-30) testing.assert_allclose(dcap1_tvm.asnumpy(), cap1_torch.grad.numpy(), atol=1e-30, rtol=1e-30) testing.assert_allclose(dcap2_tvm.asnumpy(), cap2_torch.grad.numpy(), atol=1e-30, rtol=1e-30) testing.assert_allclose(dcap3_tvm.asnumpy(), cap3_torch.grad.numpy(), atol=1e-30, rtol=1e-30) testing.assert_allclose(dcap4_tvm.asnumpy(), cap4_torch.grad.numpy(), atol=1e-30, rtol=1e-30) testing.assert_allclose(dcap5_tvm.asnumpy(), cap5_torch.grad.numpy(), atol=1e-30, rtol=1e-30) testing.assert_allclose(dcap6_tvm.asnumpy(), cap6_torch.grad.numpy(), atol=1e-30, rtol=1e-30) testing.assert_allclose(dcap7_tvm.asnumpy(), cap7_torch.grad.numpy(), atol=1e-30, rtol=1e-30) print("Compare with PyTorch success!")
43.531746
95
0.699909
0
0
0
0
0
0
0
0
382
0.069644
194c38c24bff2dd1b26d3bd458a2d3f23f28316b
121
py
Python
controle_de_estoque/app.py
rodrigo-labs/controle_estoque
890acefef2c3dace68723d086a0d40f27ff20476
[ "MIT" ]
6
2020-09-20T21:38:47.000Z
2021-11-15T10:45:02.000Z
controle_de_estoque/app.py
rodrigo-labs/controle_estoque
890acefef2c3dace68723d086a0d40f27ff20476
[ "MIT" ]
null
null
null
controle_de_estoque/app.py
rodrigo-labs/controle_estoque
890acefef2c3dace68723d086a0d40f27ff20476
[ "MIT" ]
6
2019-06-27T18:15:51.000Z
2022-02-17T19:31:59.000Z
from controle_de_estoque.controllers import controllers if __name__ == "__main__": controllers.principal_controle()
24.2
55
0.809917
0
0
0
0
0
0
0
0
10
0.082645
194c851ed5bb33eaa2cf355799844f072e6955b4
2,334
py
Python
pagewalker/pagewalker/analyzer/devtools/devtools_protocol.py
rafal-qa/page-walker
8940a819d436d46f729c9307effc5118d692cad0
[ "MIT" ]
16
2018-07-08T19:20:15.000Z
2021-01-08T22:08:49.000Z
pagewalker/pagewalker/analyzer/devtools/devtools_protocol.py
rafal-qa/page-walker
8940a819d436d46f729c9307effc5118d692cad0
[ "MIT" ]
null
null
null
pagewalker/pagewalker/analyzer/devtools/devtools_protocol.py
rafal-qa/page-walker
8940a819d436d46f729c9307effc5118d692cad0
[ "MIT" ]
5
2018-10-26T13:08:10.000Z
2020-06-20T21:03:17.000Z
from .connector import websocket_connector, http_connector class DevtoolsProtocol(object): def __init__(self): self._http = http_connector.HttpConnector() self.tab_socket = None self.tab_target_id = None @property def browser_data(self): return self._http.browser_data def open_tab(self): new_tab = self._http.open_new_tab() self.tab_socket = websocket_connector.WebsocketConnector(new_tab.socket_url) self.tab_target_id = new_tab.target_id def close_tab(self): self._assert_tab_exists() self.tab_socket.close_connection() self._http.close_tab(self.tab_target_id) self._delete_tab_data() def _delete_tab_data(self): self.tab_socket = None self.tab_target_id = None def send_command(self, method, params=None): self._assert_tab_exists() if not params: params = {} return self.tab_socket.send(method, params) def send_command_return(self, method, params): self._assert_tab_exists() return self.tab_socket.send_return(method, params) def read_until_events(self, events): self._assert_tab_exists() return self.tab_socket.read_until_events(events) def read_until_timeout(self, timeout): self._assert_tab_exists() return self.tab_socket.read_until_timeout(timeout) def _assert_tab_exists(self): if not self.tab_socket or not self.tab_target_id: raise RuntimeError("Operation not supported, browser tab does not exists") def get_cookies_for_url(self, url): cookies_data = [] result = self.send_command("Network.getCookies", {"urls": [url]}) if not result or not result["cookies"]: return cookies_data for cookie in result["cookies"]: cookies_data.append({ "name": cookie["name"], "value": cookie["value"], "domain": cookie["domain"], "path": cookie["path"] }) return cookies_data def send_browser_close(self): socket_url = self._http.browser_socket_url browser_socket = websocket_connector.WebsocketConnector(socket_url) browser_socket.send("Browser.close", {}) browser_socket.close_connection()
33.342857
86
0.653385
2,272
0.973436
0
0
76
0.032562
0
0
167
0.071551
194c8b5cc1cd58612c803208f1241b2813f11d98
9,523
py
Python
pysnmp/CISCO-IETF-PW-FR-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/CISCO-IETF-PW-FR-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/CISCO-IETF-PW-FR-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module CISCO-IETF-PW-FR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IETF-PW-FR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:43:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion") DlciNumber, = mibBuilder.importSymbols("CISCO-FRAME-RELAY-MIB", "DlciNumber") CpwVcIndexType, = mibBuilder.importSymbols("CISCO-IETF-PW-TC-MIB", "CpwVcIndexType") ciscoExperiment, = mibBuilder.importSymbols("CISCO-SMI", "ciscoExperiment") InterfaceIndexOrZero, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndexOrZero") NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup") MibIdentifier, Counter32, ObjectIdentity, Integer32, TimeTicks, IpAddress, NotificationType, ModuleIdentity, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Gauge32, Unsigned32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "Counter32", "ObjectIdentity", "Integer32", "TimeTicks", "IpAddress", "NotificationType", "ModuleIdentity", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Gauge32", "Unsigned32", "iso") RowStatus, TextualConvention, StorageType, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TextualConvention", "StorageType", "DisplayString") cpwVcFrMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 10, 112)) cpwVcFrMIB.setRevisions(('2003-12-16 00:00',)) if mibBuilder.loadTexts: cpwVcFrMIB.setLastUpdated('200312160000Z') if mibBuilder.loadTexts: cpwVcFrMIB.setOrganization('Cisco Systems, Inc.') cpwVcFrNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 112, 0)) cpwVcFrObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 112, 1)) cpwVcFrConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 112, 2)) cpwVcFrTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 1), ) if mibBuilder.loadTexts: cpwVcFrTable.setStatus('current') cpwVcFrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 1, 1), ).setIndexNames((0, "CISCO-IETF-PW-FR-MIB", "cpwVcFrPwVcIndex")) if mibBuilder.loadTexts: cpwVcFrEntry.setStatus('current') cpwVcFrPwVcIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 1, 1, 1), CpwVcIndexType()) if mibBuilder.loadTexts: cpwVcFrPwVcIndex.setStatus('current') cpwVcFrIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 1, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cpwVcFrIfIndex.setStatus('current') cpwVcFrDlci = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 1, 1, 3), DlciNumber()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cpwVcFrDlci.setStatus('current') cpwVcFrAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cpwVcFrAdminStatus.setStatus('current') cpwVcFrOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2), ("unknown", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cpwVcFrOperStatus.setStatus('current') cpwVcFrPw2FrOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2), ("unknown", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cpwVcFrPw2FrOperStatus.setStatus('current') cpwVcFrRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 1, 1, 7), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cpwVcFrRowStatus.setStatus('current') cpwVcFrStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 1, 1, 8), StorageType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cpwVcFrStorageType.setStatus('current') cpwVcFrPMTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 2), ) if mibBuilder.loadTexts: cpwVcFrPMTable.setStatus('current') cpwVcFrPMEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 2, 1), ).setIndexNames((0, "CISCO-IETF-PW-FR-MIB", "cpwVcFrPMPwVcIndex")) if mibBuilder.loadTexts: cpwVcFrPMEntry.setStatus('current') cpwVcFrPMPwVcIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 2, 1, 1), CpwVcIndexType()) if mibBuilder.loadTexts: cpwVcFrPMPwVcIndex.setStatus('current') cpwVcFrPMIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 2, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cpwVcFrPMIfIndex.setStatus('current') cpwVcFrPMAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cpwVcFrPMAdminStatus.setStatus('current') cpwVcFrPMOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2), ("unknown", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cpwVcFrPMOperStatus.setStatus('current') cpwVcFrPMPw2FrOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2), ("unknown", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cpwVcFrPMPw2FrOperStatus.setStatus('current') cpwVcFrPMRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 2, 1, 6), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cpwVcFrPMRowStatus.setStatus('current') cpwVcFrPMStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 112, 1, 2, 1, 7), StorageType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cpwVcFrPMStorageType.setStatus('current') cpwVcFrCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 112, 2, 1)) cpwVcFrGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 112, 2, 2)) cpwVcFrFullCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 112, 2, 1, 1)).setObjects(("CISCO-IETF-PW-FR-MIB", "cpwVcFrGroup"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrPMGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpwVcFrFullCompliance = cpwVcFrFullCompliance.setStatus('current') cpwVcFrReadOnlyCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 112, 2, 1, 2)).setObjects(("CISCO-IETF-PW-FR-MIB", "cpwVcFrGroup"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrPMGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpwVcFrReadOnlyCompliance = cpwVcFrReadOnlyCompliance.setStatus('current') cpwVcFrGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 112, 2, 2, 1)).setObjects(("CISCO-IETF-PW-FR-MIB", "cpwVcFrIfIndex"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrDlci"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrAdminStatus"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrOperStatus"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrPw2FrOperStatus"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrRowStatus"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrStorageType")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpwVcFrGroup = cpwVcFrGroup.setStatus('current') cpwVcFrPMGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 112, 2, 2, 2)).setObjects(("CISCO-IETF-PW-FR-MIB", "cpwVcFrPMIfIndex"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrPMAdminStatus"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrPMOperStatus"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrPMPw2FrOperStatus"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrPMRowStatus"), ("CISCO-IETF-PW-FR-MIB", "cpwVcFrPMStorageType")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpwVcFrPMGroup = cpwVcFrPMGroup.setStatus('current') mibBuilder.exportSymbols("CISCO-IETF-PW-FR-MIB", cpwVcFrPMStorageType=cpwVcFrPMStorageType, cpwVcFrPMPwVcIndex=cpwVcFrPMPwVcIndex, cpwVcFrGroups=cpwVcFrGroups, cpwVcFrConformance=cpwVcFrConformance, cpwVcFrOperStatus=cpwVcFrOperStatus, cpwVcFrPMAdminStatus=cpwVcFrPMAdminStatus, cpwVcFrIfIndex=cpwVcFrIfIndex, cpwVcFrTable=cpwVcFrTable, cpwVcFrAdminStatus=cpwVcFrAdminStatus, cpwVcFrPMEntry=cpwVcFrPMEntry, cpwVcFrPMRowStatus=cpwVcFrPMRowStatus, cpwVcFrPwVcIndex=cpwVcFrPwVcIndex, cpwVcFrPMPw2FrOperStatus=cpwVcFrPMPw2FrOperStatus, cpwVcFrRowStatus=cpwVcFrRowStatus, cpwVcFrEntry=cpwVcFrEntry, cpwVcFrMIB=cpwVcFrMIB, cpwVcFrObjects=cpwVcFrObjects, cpwVcFrGroup=cpwVcFrGroup, cpwVcFrFullCompliance=cpwVcFrFullCompliance, cpwVcFrCompliances=cpwVcFrCompliances, cpwVcFrReadOnlyCompliance=cpwVcFrReadOnlyCompliance, cpwVcFrPw2FrOperStatus=cpwVcFrPw2FrOperStatus, cpwVcFrPMTable=cpwVcFrPMTable, cpwVcFrPMOperStatus=cpwVcFrPMOperStatus, cpwVcFrDlci=cpwVcFrDlci, cpwVcFrPMGroup=cpwVcFrPMGroup, cpwVcFrNotifications=cpwVcFrNotifications, PYSNMP_MODULE_ID=cpwVcFrMIB, cpwVcFrStorageType=cpwVcFrStorageType, cpwVcFrPMIfIndex=cpwVcFrPMIfIndex)
119.0375
1,132
0.748609
0
0
0
0
0
0
0
0
2,393
0.251286
195261959efe1d29efc067b8292d053eeea3aa60
1,639
py
Python
Chapter05/non-model-view_code.py
trappn/Mastering-GUI-Programming-with-Python
14392c06dd3b9cf655420d09853bce6bfe8fe16d
[ "MIT" ]
138
2018-12-06T15:48:07.000Z
2022-03-28T12:23:12.000Z
Chapter05/non-model-view_code.py
thema27/Mastering-GUI-Programming-with-Python
66f33ff6c07b7e22a396a982a5502bd93c20d785
[ "MIT" ]
16
2019-11-21T08:17:42.000Z
2020-08-19T06:56:48.000Z
Chapter05/non-model-view_code.py
thema27/Mastering-GUI-Programming-with-Python
66f33ff6c07b7e22a396a982a5502bd93c20d785
[ "MIT" ]
116
2018-12-08T18:13:02.000Z
2022-03-22T14:30:57.000Z
import sys from os import path from PyQt5 import QtWidgets as qtw from PyQt5 import QtGui as qtg from PyQt5 import QtCore as qtc class MainWindow(qtw.QMainWindow): def __init__(self): """MainWindow constructor. This widget will be our main window. We'll define all the UI components in here. """ super().__init__() # Main UI code goes here form = qtw.QWidget() self.setCentralWidget(form) form.setLayout(qtw.QVBoxLayout()) self.filename = qtw.QLineEdit() self.filecontent = qtw.QTextEdit() self.savebutton = qtw.QPushButton( 'Save', clicked=self.save ) form.layout().addWidget(self.filename) form.layout().addWidget(self.filecontent) form.layout().addWidget(self.savebutton) # End main UI code self.show() def save(self): filename = self.filename.text() error = '' if not filename: error = 'Filename empty' elif path.exists(filename): error = f'Will not overwrite {filename}' else: try: with open(filename, 'w') as fh: fh.write(self.filecontent.toPlainText()) except Exception as e: error = f'Cannot write file: {e}' if error: qtw.QMessageBox.critical(None, 'Error', error) if __name__ == '__main__': app = qtw.QApplication(sys.argv) # it's required to save a reference to MainWindow. # if it goes out of scope, it will be destroyed. mw = MainWindow() sys.exit(app.exec())
27.779661
60
0.583282
1,286
0.784625
0
0
0
0
0
0
377
0.230018
195268ef4f0f6c79ac3ca7cf1356d6b54616df26
31
py
Python
src/__init__.py
abdelsamea/DeTraC
2c94d55908285fc9cbb24086da63078ee917525a
[ "MIT" ]
1
2020-09-17T14:17:50.000Z
2020-09-17T14:17:50.000Z
src/__init__.py
arkkhanu/DeTraC_COVId19
ab03719b49a1a048f74f08600a6670f6757bbe60
[ "MIT" ]
null
null
null
src/__init__.py
arkkhanu/DeTraC_COVId19
ab03719b49a1a048f74f08600a6670f6757bbe60
[ "MIT" ]
1
2021-04-14T08:52:36.000Z
2021-04-14T08:52:36.000Z
import tools import frameworks
10.333333
17
0.870968
0
0
0
0
0
0
0
0
0
0
19536799d88c875ad08a6f5696624ad8dc96acf2
442,707
py
Python
data/chars.py
Shadybloom/dnd-mass-combat-simulation
169bc6cfb967f871290014b342e926b1f71cde81
[ "MIT" ]
3
2020-05-27T08:36:00.000Z
2021-11-22T09:04:08.000Z
data/chars.py
Shadybloom/dnd-mass-combat-simulation
169bc6cfb967f871290014b342e926b1f71cde81
[ "MIT" ]
null
null
null
data/chars.py
Shadybloom/dnd-mass-combat-simulation
169bc6cfb967f871290014b342e926b1f71cde81
[ "MIT" ]
1
2021-11-21T03:57:33.000Z
2021-11-21T03:57:33.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- # Загружаем комплекты снаряжения (soldiers_pack) from data.items import * #---- # Лишённые индивидуальности заготовки солдат. Используются в squad_generation metadict_chars = {} #---- # Сельское ополчение (крестьяне и городская беднота): metadict_chars['Commoner 1 lvl (recruit)'] = { # Отсеиваются из состава отряда на этапе генерации. # Отражают отбор в отряд лучших солдат: # 100 рекрутов на 100 должностей = 100 раных солдат, 30 из которых негодные. # 200 рекрутов на 100 должностей = 100 сильных и ловких солдат. # 500 рекрутов на 100 должностей = 100 бойцов уровня ветеранов. 'level':1, 'recruit_selection':True, 'char_class':'Commoner', 'behavior':'Warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':{}, 'equipment_backpack':{}, 'equipment_weapon':{}, } metadict_chars['Commoner 1 lvl (militia javeliner)'] = { # Пельтасты, левисы. Ополченцы с метательными копьями. # https://ru.wikipedia.org/wiki/Левисы # https://ru.wikipedia.org/wiki/Рорарии # Таких оборванцев можно набрать по 600 на 6000 сельского населения (регион 6x6 миль). 'level':1, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Leather Armor':1, 'Shield':1, 'Dagger':1, 'Javelin':6, }, } metadict_chars['Commoner 2 lvl (militia javeliner-veteran)'] = { # Авторитетный горожанин, или вожак сельского ополчения. # Чтобы получить 2 lvl ему нужно 300 xp (12 побед в бою) # Броня -- усиленный бронзовыми бляхами линоторакс (его делали из кожи, а не изо льна). 'level':2, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Mace':1, 'Javelin':6, }, } metadict_chars['Warrior 3 lvl (militia javeliner-corporal)'] = { # Обычно это старики-ветераны из профессиональной армии. 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ #'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Javelin':6, }, } metadict_chars['Warrior 4 lvl (militia javeliner-sergeant)'] = { # Офицеры-отставники. 'level':4, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Javelin':6, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Commoner 1 lvl (militia slinger)'] = { # Акцензы. Пращу используют вместе со щитом. # https://ru.wikipedia.org/wiki/Акцензы # Снаряды тяжёлые, весят по 1 фунту (450 грамм) (глиняные "жёлуди" или галька) 'level':1, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Leather Armor':1, 'Shield':1, 'Dagger':1, 'Sling real':1, 'Sling Bullet':10, }, } metadict_chars['Commoner 2 lvl (militia slinger-veteran)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Dagger':1, 'Sling real':1, 'Sling Bullet':10, }, } metadict_chars['Warrior 3 lvl (militia slinger-corporal)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ #'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Sling real':1, 'Sling Bullet':10, }, } metadict_chars['Warrior 4 lvl (militia slinger-sergeant)'] = { 'level':4, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Sling real':1, 'Sling Bullet':10, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Commoner 1 lvl (militia bowman)'] = { # Лучник с коротким луком. Охотник. # Примитивный лук (1d4 урона) и охотничьи стрелы с кремниевыми наконечниками. 'level':1, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Leather Armor':1, 'Dagger':1, 'Hunting Bow':1, 'Hunting Arrow':40, }, } metadict_chars['Commoner 2 lvl (militia bowman-veteran)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Dagger':1, 'Hunting Bow':1, 'Hunting Arrow':40, }, } metadict_chars['Warrior 3 lvl (militia bowman-corporal)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ #'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 4 lvl (militia bowman-sergeant)'] = { # Лучший стрелок. Командует бойцами, направляя град стрел. # Азимут такой-то, угол стрельбы такой-то. Всё на личном примере. 'level':4, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Commoner 1 lvl (militia spearman)'] = { # Типичный гастат ранней республики, ибо легион значит "ополчение". # https://ru.wikipedia.org/wiki/Гастаты 'level':1, 'char_class':'Commoner', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Leather Armor':1, 'Heavy Shield':1, 'Spear':1, 'Pilum':2, }, } metadict_chars['Commoner 2 lvl (militia spearman-veteran)'] = { # Принцип ранней республики. 'level':2, 'char_class':'Commoner', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Heavy Shield':1, 'Spear':1, 'Pilum':2, }, } metadict_chars['Warrior 3 lvl (militia spearman-corporal)'] = { 'level':3, 'close_order_AI':True, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ #'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':4, }, } metadict_chars['Warrior 4 lvl (militia spearman-sergeant)'] = { 'level':4, 'close_order_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':4, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } metadict_chars['Commoner 1 lvl (militia swordsman)'] = { # Кельты, галлы. 'level':1, 'char_class':'Commoner', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Hide Armor':1, 'Shield':1, 'Shortsword':1, 'Javelin':2, #'Potion of Heroism':1, #'Potion of Bravery':1, #'Potion of Rage':1, }, } metadict_chars['Commoner 2 lvl (militia swordsman-veteran)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Hide Armor':1, 'Heavy Shield':1, 'Shortsword':1, #'Javelin':2, }, } metadict_chars['Warrior 3 lvl (militia swordsman-corporal)'] = { 'level':3, 'close_order_AI':True, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ #'Fighting_Style_Dueling':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':2, 'Scale Mail':1, 'Heavy Shield':1, 'Longsword':1, #'Javelin':6, }, } metadict_chars['Warrior 4 lvl (militia swordsman-sergeant)'] = { 'level':4, 'close_order_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Fighting_Style_Dueling':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':3, 'Half Plate':1, 'Heavy Shield':1, 'Longsword':1, 'Javelin':6, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Commoner 1 lvl (militia crossbowman)'] = { # Арбалетчики Гастрафеты. 'level':1, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Padded Armor':1, 'Dagger':1, 'Crossbow, Light':1, 'Crossbow Bolt':40, }, } metadict_chars['Commoner 2 lvl (militia crossbowman-veteran)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Dagger':1, 'Crossbow, Light':1, 'Crossbow Bolt':40, }, } metadict_chars['Warrior 3 lvl (militia crossbowman-corporal)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ #'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Crossbow, Light':1, 'Crossbow Bolt':40, }, } metadict_chars['Warrior 4 lvl (militia crossbowman-sergeant)'] = { # Лучший стрелок. Командует бойцами, направляя град стрел. # Азимут такой-то, угол стрельбы такой-то. Всё на личном примере. 'level':4, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Crossbow, Light':1, 'Crossbow Bolt':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Commoner 1 lvl (militia heavy crossbowman)'] = { # Арбалетчики. "Скорпионы" 'level':1, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Padded Armor':1, 'Dagger':1, 'Crossbow, Heavy':1, 'Crossbow Bolt':40, }, } metadict_chars['Commoner 2 lvl (militia heavy crossbowman-veteran)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Dagger':1, 'Crossbow, Heavy':1, 'Crossbow Bolt':40, }, } metadict_chars['Warrior 3 lvl (militia heavy crossbowman-corporal)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ #'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Crossbow, Heavy':1, 'Crossbow Bolt':40, }, } metadict_chars['Warrior 4 lvl (militia heavy crossbowman-sergeant)'] = { # Лучший стрелок. Командует бойцами, направляя град стрел. # Азимут такой-то, угол стрельбы такой-то. Всё на личном примере. 'level':4, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Crossbow, Heavy':1, 'Crossbow Bolt':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } #---- # Городское ополчение (отборные и неплохо вооружённые гоплиты) # TODO: подправь, теперь второй параметр для большинства бойцов, это ловкость. # Среднее арифметическое от суммы параметров -- 63 (средние параметры -- 10.5) # Распределение силы (главный параметр, на 10 000 выборке): # 18 -- 2.5% # 16+ -- 22.5% # 14+ -- 40% # 12+ -- 28.7% # 10+ -- 5.8% # <10 -- 0.5% # Распределение телосложения (второй параметр, на 10 000 выборке): # 16+ -- 2.5% # 14+ -- 22% # 12+ -- 47% # 10+ -- 25.7% # <10 -- 2.8% # Распределение ловкости (третий параметр, на 10 000 выборке): # 14+ -- 5% # 12+ -- 35% # 10+ -- 45% # <10 -- 15% # Ловкость и средня броня: # Только 5% профи могут реализовать +2 AC от ловкости к средней броне. # Впрочем, 35% с +1 AC тоже стоит учесть. Scale Mail -- лучшее решение. # Сила и переносимый вес (на 10 000 выборке): # Сила x 5 = лёгкая нагрузка (50 фунтов, или 25 кг при силе 10) # Сила x 10 = перегрузка (100 фунтов, или 50 кг, но при -10 футов к скорости) # 95% бойцов (STR 12+) могут нести по 60 фунтов. # 85% крестьян (STR 8+) могут нести по 40 фунтов. # Кстати, последнее число -- уставная норма для армий 19 века. metadict_chars['Warrior 1 lvl (achean hoplite)'] = { # Городское ополчение. Гоплиты. # Таких не больше 1000 на 10 000 городского и 30 000 сельского населения. # Копьё -- ~3 метра. Большой щит -- гоплон (апис) # Броня -- "линоторакс" с щитком на груди, шлем. 'level':1, 'char_class':'Warrior', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Javelin':5, }, } metadict_chars['Warrior 2 lvl (achean hoplite-veteran)'] = { # "Прослуживший" 10 лет гоплит. Такие нередко уходят в наёмники. # Чтобы получить 2 lvl ему нужно 300 xp (12 побед в бою) # Броня -- чешуйчатая (бронзовые пластины на кожаной основе) 'level':2, 'char_class':'Warrior', 'behavior':'elite_warrior', 'hit_dice':'1d8', 'class_features':{ # Изначально ветераны не обладают боевым стилем. Этому их обучают герои-бойцы. #'Fighting_Style_Protection':True, 'Fighting_Style_Dueling':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Scale Mail':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, }, } metadict_chars['Warrior 3 lvl (achean hoplite-corporal)'] = { # Состоятельный горожанин и авторитетный командир. # Чтобы получит 3 lvl нужно 300+900=1200 exp (24-48 побед в бою) # Броня -- бронзовый панцирь, поножи, шлем. 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ #'Fighting_Style_Protection':True, 'Fighting_Style_Dueling':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, }, } metadict_chars['Warrior 4 lvl (achean hoplite-sergeant)'] = { # Командир 30 бойцов. # Чтобы получит 4 lvl нужно 300+900+2700 xp (78-156 побед в бою) 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Fighting_Style_Protection':True, 'Fighting_Style_Dueling':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (achean hoplite-lieutenant)'] = { # Сотник гоплитов # Бронзовый панцирь с рельефом, поножи с набедренниками, закрытый шлем. # Чтобы получить 5 lvl нужно 300+900+2700+6500 xp (208-416 побед в бою) 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Fighting_Style_Protection':True, 'Fighting_Style_Dueling':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Городское ополчение (сариссофоры) metadict_chars['Warrior 1 lvl (city pikeman)'] = { # Сила пикионеров -- плотный строй, но это не реализовать. # В мире, где летают огнешары, плотное построение фаланги слишком опасно. # https://ru.wikipedia.org/wiki/Сариссофор 'level':1, 'char_class':'Warrior-heavy', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Ring Mail':1, 'Shortsword':1, 'Shield':1, 'Pike':1, }, } metadict_chars['Warrior 2 lvl (city pikeman-veteran)'] = { 'level':2, 'char_class':'Warrior-heavy', 'behavior':'elite_warrior', 'hit_dice':'1d8', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Chain Mail':1, 'Shortsword':1, 'Shield':1, 'Pike':1, }, } metadict_chars['Warrior 3 lvl (city pikeman-corporal)'] = { 'level':3, 'char_class':'Warrior-heavy', 'behavior':'elite_warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Chain Mail':1, 'Shortsword':1, 'Shield':1, 'Pike':1, }, } metadict_chars['Warrior 4 lvl (city pikeman-sergeant)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Half Plate':1, 'Shortsword':1, 'Shield':1, 'Pike':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (city pikeman-lieutenant)'] = { 'level':5, #'close_order_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Shortsword':1, 'Shield':1, 'Pike':1, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Лучники-специалисты. metadict_chars['Warrior 1 lvl (sqythian bowman)'] = { # Персы, скифы, сарматы. Отличные композитные луки, а вместо защиты стёганки. 'level':1, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Padded Armor':1, 'Dagger':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 2 lvl (sqythian bowman-veteran)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Scale Mail':1, 'Dagger':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 3 lvl (sqythian bowman-corporal)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Dagger':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 4 lvl (sqythian bowman-sergeant)'] = { # Лучший стрелок. Командует сотней бойцов, направляя град стрел. # Азимут такой-то, угол стрельбы такой-то. Всё на личном примере. 'level':4, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (sqythian bowman-lieutenant)'] = { 'level':5, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } #---- # Лучники-универсалы. metadict_chars['Warrior 1 lvl (persian bowman)'] = { # Кроме луков вооружены акинаками и щитами. 'level':1, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 2 lvl (persian bowman-veteran)'] = { # Ветераны после 10 лет службы. Мастерски стреляют. Умело сражаются и в ближнем бою. 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Scale Mail':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 3 lvl (persian bowman-corporal)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 4 lvl (persian bowman-sergeant)'] = { # Лучший стрелок. Командует 30 бойцами, направляя град стрел. # Азимут такой-то, угол стрельбы такой-то. Всё на личном примере. 'level':4, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (persian bowman-lieutenant)'] = { # Командир сотни наёмных лучников. 'level':5, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } #---- # Стрелки с мушкетами, мушкетёры. metadict_chars['Warrior 1 lvl (musketeer line-infantry)'] = { # Вооружены алебардой, шпагой/саблей и мушкетом. # Кожаный жилет, перчатки, сапоги. 'level':1, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Leather Armor':1, 'Halberd':1, 'Shortsword':1, 'Muskete, big':1, 'Muskete Bullet, big':14, #'Muskete Bullet, birdshot':14, 'Smoke Grenade':1, }, } metadict_chars['Warrior 2 lvl (musketeer line-infantry-veteran)'] = { 'level':2, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Breastplate, 17 century':1, 'Halberd':1, 'Rapier':1, 'Muskete, big':1, 'Muskete Bullet, big':14, #'Muskete Bullet, birdshot':14, 'Smoke Grenade':1, }, } metadict_chars['Warrior 3 lvl (musketeer line-infantry-corporal)'] = { 'level':3, 'firearm_AI':True, 'sneak_AI':True, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Shielding':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Rapier':1, 'Muskete, Lorenzony':1, 'Muskete Bullet':60, 'Smoke Grenade':2, }, } metadict_chars['Warrior 4 lvl (musketeer line-infantry-sergeant)'] = { 'level':4, 'firearm_AI':True, 'sneak_AI':True, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Rapier':1, 'Muskete, Lorenzony':1, 'Muskete Bullet':60, 'Smoke Grenade':2, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (musketeer line-infantry-lieutenant)'] = { # Капитан роты мушкетёров. 'level':5, 'firearm_AI':True, 'sneak_AI':True, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Heroism':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Rapier':1, 'Muskete, Lorenzony':1, 'Muskete Bullet':60, 'Smoke Grenade':2, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } #---- # Метатели гранат, гренадёры. # https://en.wikipedia.org/wiki/Grenadier metadict_chars['Warrior 1 lvl (grenadier line-infantry)'] = { # Вооружены палашом, щитом, алебардой и сумкой гранат. 'level':1, 'char_class':'Warrior-heavy', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, }, } metadict_chars['Warrior 2 lvl (grenadier line-infantry-veteran)'] = { 'level':2, 'char_class':'Warrior-heavy', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Blind_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, }, } metadict_chars['Warrior 3 lvl (grenadier line-infantry-corporal)'] = { 'level':3, 'carefull_AI':True, 'grenadier_AI':True, 'sneak_AI':True, 'char_class':'Warrior-heavy', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Blind_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, }, } metadict_chars['Warrior 4 lvl (grenadier line-infantry-sergeant)'] = { 'level':4, 'carefull_AI':True, 'grenadier_AI':True, 'sneak_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Blind_Fighting':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Potion of Rage':1, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (grenadier line-infantry-lieutenant)'] = { # Капитан роты гренадеров. 'level':5, 'carefull_AI':True, 'grenadier_AI':True, 'sneak_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Blind_Fighting':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Potion of Rage':1, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Infusion of Heroism':1, 'Rune of Absorbtion':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } #---- # Вспомогательные войска (абордажники) metadict_chars['Warrior 2 lvl (grenadier line-infantry-veteran) (assault)'] = { 'base_unit':'Warrior 2 lvl (grenadier line-infantry-veteran)', 'char_class':'Warrior-heavy', 'equipment_weapon':{ 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, 'Hand Mortar':1, '2lb Bomb':3, }, } metadict_chars['Warrior 3 lvl (grenadier line-infantry-corporal) (assault)'] = { 'base_unit':'Warrior 3 lvl (grenadier line-infantry-corporal)', 'char_class':'Warrior-heavy', 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, 'Hand Mortar':1, '2lb Bomb':3, }, } metadict_chars['Warrior 4 lvl (grenadier line-infantry-sergeant) (assault)'] = { 'base_unit':'Warrior 4 lvl (grenadier line-infantry-sergeant)', 'char_class':'Warrior-officer', 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, 'Hand Mortar':1, '2lb Bomb':3, }, } metadict_chars['Warrior 5 lvl (grenadier line-infantry-lieutenant) (assault)'] = { 'base_unit':'Warrior 5 lvl (grenadier line-infantry-lieutenant)', 'char_class':'Warrior-officer', 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Message':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, 'Hand Mortar':1, '2lb Bomb':3, }, } #---- # Вспомогательные войска (сапёры, штурмовики) metadict_chars['Warrior 4 lvl (grenadier line-infantry-sergeant) (stormtrooper)'] = { 'base_unit':'Warrior 4 lvl (grenadier line-infantry-sergeant)', 'grenadier_AI':False, 'char_class':'Warrior-heavy', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Magic_Initiate':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mold_Earth'), ('cantrip', 'Mage_Hand'), ('ritual', 'Floating_Disk'), ], }, 'equipment_weapon':{ 'Infusion of Longstrider':1, 'Rune of Absorbtion':1, 'Plate Armor, 17 century':1, 'Sabre':1, 'Heavy Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, '10lb Bomb, mine':1, 'Smoke Grenade':1, }, 'mount_combat':False, 'mount_type':'Tensers Floating Disk', 'equipment_mount':{ '10lb Bomb, mine':50, }, } metadict_chars['Warrior 5 lvl (grenadier line-infantry-lieutenant) (stormtrooper)'] = { 'base_unit':'Warrior 5 lvl (grenadier line-infantry-lieutenant)', 'grenadier_AI':False, 'char_class':'Warrior-heavy', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Magic_Initiate':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mold_Earth'), ('cantrip', 'Mage_Hand'), ('ritual', 'Floating_Disk'), ], }, 'equipment_weapon':{ 'Infusion of Longstrider':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Plate Armor, 17 century':1, 'Sabre':1, 'Heavy Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, '10lb Bomb, mine':1, 'Smoke Grenade':1, }, 'mount_combat':False, 'mount_type':'Tensers Floating Disk', 'equipment_mount':{ '10lb Bomb, mine':50, }, } #---- # Вспомогательные войска (бомбардиры с ручными мортирками) metadict_chars['Warrior 1 lvl (bombardier line-infantry)'] = { # Вооружены алебардой и ручной мортиркой. 'level':1, 'char_class':'Warrior-heavy', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Halberd':1, 'Pistol':1, 'Muskete Bullet':30, 'Hand Mortar':1, '2lb Bomb':10, 'Smoke Grenade':1, }, } metadict_chars['Warrior 2 lvl (bombardier line-infantry-veteran)'] = { 'level':2, 'char_class':'Warrior-heavy', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Blind_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Shielding':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Pistol':1, 'Muskete Bullet':30, 'Hand Mortar':1, '2lb Bomb':10, 'Smoke Grenade':1, }, } metadict_chars['Warrior 3 lvl (bombardier line-infantry-corporal)'] = { 'level':3, 'firearm_AI':True, 'grenadier_AI':True, 'defence_AI':True, 'sneak_AI':True, 'char_class':'Warrior-heavy', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Blind_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Shielding':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Mortar':1, '2lb Bomb':10, 'Smoke Grenade':1, }, } metadict_chars['Warrior 4 lvl (bombardier line-infantry-sergeant)'] = { 'level':4, 'firearm_AI':True, 'grenadier_AI':True, 'defence_AI':True, 'sneak_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Blind_Fighting':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Mortar':1, '2lb Bomb':10, 'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (bombardier line-infantry-lieutenant)'] = { # Капитан роты гренадеров. 'level':5, 'firearm_AI':True, 'grenadier_AI':True, 'defence_AI':True, 'sneak_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Blind_Fighting':True, 'Feat_Firearms_Expert':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Mortar':1, '2lb Bomb':10, 'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (bombardier line-infantry-lieutenant) (bomba-san)'] = { # Дикая боевая оптимизация. Латы и щит, максимум AC, станковый гранатомёт на летучем диске. 'base_unit':'Warrior 5 lvl (bombardier line-infantry-lieutenant)', 'class_features':{ 'Extra_Attack':True, 'Fighting_Style_Blind_Fighting':True, 'Feat_Magic_Initiate':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mold_Earth'), ('cantrip', 'Sword_Burst'), ('ritual', 'Floating_Disk'), ], }, 'equipment_weapon':{ 'Infusion of Longstrider':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Plate Armor, 17 century':1, 'Shield':1, 'Sabre':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'King Bomba-san':1, '2lb Fire-Bomb':10, 'Smoke Grenade':1, }, 'mount_combat':False, 'mount_type':'Tensers Floating Disk', 'equipment_mount':{ '2lb Fire-Bomb':250, }, } metadict_chars['Warrior 5 lvl (bombardier line-infantry-lieutenant) (shaitan-tube)'] = { 'base_unit':'Warrior 5 lvl (bombardier line-infantry-lieutenant)', 'class_features':{ 'Extra_Attack':True, 'Fighting_Style_Blind_Fighting':True, 'Feat_Magic_Initiate':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mold_Earth'), ('cantrip', 'Sword_Burst'), ('ritual', 'Floating_Disk'), ], }, 'equipment_weapon':{ 'Infusion of Longstrider':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Plate Armor, 17 century':1, 'Shield':1, 'Sabre':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Akbar Shaitan-tube':1, '20lb Fire-Rocket':1, 'Smoke Grenade':1, }, 'mount_combat':False, 'mount_type':'Tensers Floating Disk', 'equipment_mount':{ '20lb Fire-Rocket':25, }, } #---- # Вспомогательные войска (артиллеристы с орудиями) metadict_chars['Warrior 1 lvl (cannoneer artillery)'] = { # Вооружены алебардами и пистолетами. Обслуживают орудия. 'level':1, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Leather Armor':1, 'Shortsword':1, 'Pistol':1, 'Muskete Bullet':30, 'Smoke Grenade':1, }, } metadict_chars['Warrior 2 lvl (cannoneer artillery-veteran)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Leather Armor':1, 'Shortsword':1, 'Pistol':1, 'Muskete Bullet':30, 'Smoke Grenade':1, }, } metadict_chars['Warrior 3 lvl (cannoneer artillery-corporal)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Armor':1, 'Shortsword':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Smoke Grenade':1, }, } metadict_chars['Warrior 4 lvl (cannoneer artillery-sergeant)'] = { 'level':4, 'volley_AI':True, 'firearm_AI':True, 'defence_AI':True, 'sneak_AI':True, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Armor':1, 'Shortsword':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 4 lvl (cannoneer artillery-sergeant) (2lb Falconet)'] = { 'base_unit':'Warrior 4 lvl (cannoneer artillery-sergeant)', 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Armor':1, '2lb Falconet':1, '2lb Ball':100, }, 'mount_combat':True, 'mount_type':'2lb Cannon, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 4 lvl (cannoneer artillery-sergeant) (6lb Cannon)'] = { 'base_unit':'Warrior 4 lvl (cannoneer artillery-sergeant)', 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Armor':1, '6lb Cannon':1, '6lb Bomb':100, #'6lb Ball':100, }, 'mount_combat':True, 'mount_type':'6lb Cannon, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 4 lvl (cannoneer artillery-sergeant) (12lb Cannon, naval)'] = { 'base_unit':'Warrior 4 lvl (cannoneer artillery-sergeant)', 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Armor':1, '12lb Cannon, naval':1, '12lb Bar':100, '12lb Ball':100, }, 'mount_combat':True, 'mount_type':'12lb Cannon, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 4 lvl (cannoneer artillery-sergeant) (24lb Cannon, naval)'] = { 'base_unit':'Warrior 4 lvl (cannoneer artillery-sergeant)', 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Armor':1, '24lb Cannon, naval':1, '24lb Bar':100, '24lb Ball':100, }, 'mount_combat':True, 'mount_type':'24lb Cannon, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 4 lvl (cannoneer artillery-sergeant) (24lb Cannon, naval)'] = { 'base_unit':'Warrior 4 lvl (cannoneer artillery-sergeant)', 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Armor':1, '24lb Cannon, naval':1, '24lb Bar':100, '24lb Ball':100, }, 'mount_combat':True, 'mount_type':'24lb Cannon, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 4 lvl (cannoneer artillery-sergeant) (12lb Mortar)'] = { 'base_unit':'Warrior 4 lvl (cannoneer artillery-sergeant)', 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Armor':1, '12lb Mortar':1, '12lb Bomb':100, }, 'mount_combat':True, 'mount_type':'12lb Mortar, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (cannoneer artillery-lieutenant)'] = { # Командир артиллерийской батареи. 'level':5, 'volley_AI':True, 'firearm_AI':True, 'defence_AI':True, 'sneak_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Shielding':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, 'Shortsword':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } #---- # Вспомогательные войска, артиллеристы. metadict_chars['Warrior 2 lvl (cannoneer-veteran)'] = { # Расчёты орудий. 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Breastplate, 17 century':1, 'Shield':1, 'Shortsword':1, '6lb Cannon':1, '6lb Bomb':100, #'6lb Ball':100, }, 'mount_combat':True, 'mount_type':'6-lb Cannon', 'equipment_mount':{ }, } metadict_chars['Warrior 3 lvl (cannoneer-corporal) (6-lb Cannon)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Breastplate, 17 century':1, 'Shield':1, 'Shortsword':1, '6lb Cannon':1, '6lb Bomb':100, #'6lb Ball':100, }, 'mount_combat':True, 'mount_type':'6-lb Cannon', 'equipment_mount':{ }, } metadict_chars['Warrior 4 lvl (cannoneer-sergeant)'] = { 'level':4, 'volley_AI':True, 'firearm_AI':True, 'sneak_AI':True, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Breastplate, 17 century':1, 'Shield':1, 'Shortsword':1, }, } #---- # Вспомогательные войска, лекари. metadict_chars['Warrior 4 lvl (healer-sergeant)'] = { # Санитар 'level':4, 'char_class':'Warrior-healer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Healer':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Potion of Heroism':1, #'Potion of Antidote':1, 'Rune of Armor':1, 'Rune of Absorbtion':1, 'Shield':1, 'Sabre':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Smoke Grenade':1, 'Healer Kit':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (healer-lieutenant)'] = { 'level':5, 'char_class':'Warrior-healer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Healer':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Potion of Heroism':1, #'Potion of Antidote':1, 'Rune of Armor':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Shield':1, 'Sabre':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Smoke Grenade':1, 'Healer Kit':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Стрелки с фузилями, фузилёры. # https://en.wikipedia.org/wiki/Fusilier metadict_chars['Warrior 1 lvl (fusilier line-infantry)'] = { # Вооружены штыком и мушкетом. Основная линейная пехота. 'level':1, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'archer', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Leather Armor':1, 'Bayonet':1, 'Muskete':1, 'Muskete Bullet':30, #'Smoke Grenade':1, }, } metadict_chars['Warrior 2 lvl (fusilier line-infantry-veteran)'] = { # Егеря. Вооружены нарезными штуцерами. 'level':2, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Leather Armor':1, 'Bayonet':1, 'Rifle':1, 'Pistol':1, 'Muskete Bullet':30, 'Smoke Grenade':1, }, } metadict_chars['Warrior 3 lvl (fusilier line-infantry-corporal)'] = { 'level':3, 'firearm_AI':True, 'carefull_AI':True, 'sneak_AI':True, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Armor':1, 'Clothes, Fine':1, 'Rapier':1, 'Rifle, rapid':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':60, 'Smoke Grenade':1, }, } metadict_chars['Warrior 4 lvl (fusilier line-infantry-sergeant)'] = { 'level':4, 'firearm_AI':True, 'carefull_AI':True, 'sneak_AI':True, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Shielding':1, 'Rune of Armor':1, 'Clothes, Fine':1, 'Rapier':1, 'Rifle, rapid':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':50, 'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (fusilier line-infantry-lieutenant)'] = { # Капитан роты фузилеров. 'level':5, 'firearm_AI':True, 'carefull_AI':True, 'sneak_AI':True, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Clothes, Fine':1, 'Rapier':1, 'Rifle, rapid':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':50, 'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (fusilier line-infantry-lieutenant) (Schwartz Mark)'] = { # Капитан роты фузилеров. Вооружён штуцером Шварц Марка. 'base_unit':'Warrior 5 lvl (fusilier line-infantry-lieutenant)', 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Clothes, Fine':1, 'Rapier':1, 'Rifle, Schwartz Mark':1, 'Muskete Bullet':50, 'Smoke Grenade':1, }, } #---- # Вспомогательные войска (снайпера) metadict_chars['Warrior 4 lvl (fusilier line-infantry-sergeant) (sniper)'] = { # Снайпер 'hunter_AI':True, 'base_unit':'Warrior 4 lvl (fusilier line-infantry-sergeant)', 'char_class':'Warrior-bowman', 'equipment_weapon':{ 'Infusion of Longstrider':1, 'Infusion of Climbing':1, 'Studded Leather':1, 'Dagger':1, 'Longbow':1, 'Arrow':60, #'Rifle, Schwartz Mark':1, #'Muskete Bullet':60, 'Smoke Grenade':2, }, } metadict_chars['Warrior 5 lvl (fusilier line-infantry-lieutenant) (sniper)'] = { # Командир команды снайперов 'hunter_AI':True, 'base_unit':'Warrior 5 lvl (fusilier line-infantry-lieutenant)', 'char_class':'Warrior-bowman', 'equipment_weapon':{ 'Infusion of Longstrider':1, 'Infusion of Climbing':1, 'Rune of Message':1, 'Studded Leather':1, 'Dagger':1, 'Longbow':1, 'Arrow':60, #'Rifle, Schwartz Mark':1, #'Muskete Bullet':60, 'Smoke Grenade':2, }, } #---- # Вспомогательные войска, пращники. metadict_chars['Warrior 1 lvl (balear slinger)'] = { 'level':1, 'char_class':'Warrior-bowman', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Hide Armor':1, 'Heavy Shield':1, 'Mace':1, 'Sling real':1, 'Sling Bullet':10, }, } metadict_chars['Warrior 2 lvl (balear slinger-veteran)'] = { 'level':2, 'char_class':'Warrior-bowman', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Protection':True, }, 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Hide Armor':1, 'Heavy Shield':1, 'Mace':1, 'Sling real':1, 'Sling Bullet':10, }, } metadict_chars['Warrior 3 lvl (balear slinger-corporal)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Protection':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Mace':1, 'Sling real':1, 'Sling Bullet':10, }, } metadict_chars['Warrior 4 lvl (balear slinger-sergeant)'] = { 'level':4, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Heavy Shield':1, 'Mace':1, 'Sling real':1, 'Sling Bullet':10, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (balear slinger-lieutenant)'] = { 'level':5, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, 'Feat_Sharpshooter':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Mace':1, 'Sling real':1, 'Sling Bullet':10, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Вспомогательные войска, лучники. metadict_chars['Warrior 1 lvl (cilician infantry)'] = { # Так-то стрелки, но склонны к ближнему бою. Пираты. 'level':1, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 2 lvl (cilician infantry-veteran)'] = { # Используют парное оружие. Своеобразные ребята. 'level':2, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Two_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Scale Mail':1, 'Shield':1, 'Rapier':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 3 lvl (cilician infantry-corporal)'] = { 'level':3, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Two_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Rapier':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 4 lvl (cilician infantry-sergeant)'] = { 'level':4, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Two_Weapon_Fighting':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Rapier':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (cilician infantry-lieutenant)'] = { 'level':5, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Two_Weapon_Fighting':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shield':1, 'Rapier':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } #---- # Вспомогательные войска, кавалерия. metadict_chars['Warrior 1 lvl (cavalry archer)'] = { # Лёгкая кавалерия кочевников 'level':1, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Padded Armor':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Light Warhorse', 'equipment_mount':{ }, } metadict_chars['Warrior 2 lvl (cavalry archer-veteran)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Light Warhorse', 'equipment_mount':{ }, } metadict_chars['Warrior 3 lvl (cavalry archer-corporal)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ }, } metadict_chars['Warrior 4 lvl (cavalry archer-sergeant)'] = { 'level':4, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ }, } metadict_chars['Warrior 5 lvl (cavalry archer-lieutenant)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ }, } #---- # Фракийцы. metadict_chars['Warrior 1 lvl (thracian infantry)'] = { # Штурмовики # Щиты используют против лучников, но не в ближнем бою. 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Hide Armor':1, 'Shield':1, 'Shortsword':1, 'Glaive':1, 'Javelin':6, }, } metadict_chars['Warrior 2 lvl (thracian infantry-veteran)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Hide Armor':1, 'Shield':1, 'Shortsword':1, 'Glaive':1, 'Javelin':6, }, } metadict_chars['Warrior 3 lvl (thracian infantry-corporal)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Glaive':1, 'Javelin':6, }, } metadict_chars['Warrior 4 lvl (thracian infantry-sergeant)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Regeneration':1, 'Half Plate':1, 'Shield':1, 'Shortsword':1, 'Glaive':1, 'Javelin':6, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } metadict_chars['Warrior 5 lvl (thracian infantry-lieutenant)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Regeneration':1, 'Infusion of Heroism':1, 'Half Plate':1, 'Shield':1, 'Shortsword':1, 'Glaive':1, 'Javelin':6, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Кельты, галлы. metadict_chars['Warrior 1 lvl (celtian infantry)'] = { 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'class_features':{ # Вообще, Reckless_Attack -- геройская способность 2 lvl, но кельты слабоваты. 'Reckless_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Hide Armor':1, 'Heavy Shield':1, 'Longsword':1, 'Javelin':6, }, } metadict_chars['Warrior 2 lvl (celtian infantry-veteran)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Dueling':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Hide Armor':1, 'Heavy Shield':1, 'Longsword':1, 'Javelin':6, }, } metadict_chars['Warrior 3 lvl (celtian infantry-corporal)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Dueling':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':2, 'Scale Mail':1, 'Heavy Shield':1, 'Longsword':1, 'Javelin':6, }, } metadict_chars['Warrior 4 lvl (celtian infantry-sergeant)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Dueling':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':3, 'Half Plate':1, 'Heavy Shield':1, 'Longsword':1, 'Javelin':6, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (celtian infantry-lieutenant)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Dueling':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':3, 'Half Plate':1, 'Heavy Shield':1, 'Longsword':1, 'Javelin':6, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Шекелеш, шерданы: metadict_chars['Warrior 1 lvl (shekelesh infantry)'] = { # Ламинарные медные доспехи. 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Ring Mail':1, 'Shield':1, 'Spear':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 2 lvl (shekelesh infantry-veteran)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Scale Mail':1, 'Shield':1, 'Longsword':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 3 lvl (shekelesh infantry-corporal)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Longsword':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 4 lvl (shekelesh infantry-sergeant)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Longsword':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (shekelesh infantry-lieutenant)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Shield':1, 'Longsword':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Легион, ромеи metadict_chars['Warrior 1 lvl (legionary infantry-siege)'] = { # С двуручной киркой, чтобы разбивать укрепления. Чисто для тестов. 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Greataxe':1, }, } metadict_chars['Warrior 2 lvl (legionary infantry-siege-veteran)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Scale Mail':1, 'Greataxe':1, }, } metadict_chars['Warrior 3 lvl (legionary infantry-siege-corporal)'] = { # Десятник (декан, урагос) 'level':3, 'seeker_AI':True, 'fearless_AI':True, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Greataxe':1, }, } #---- # Легион, ромеи (осадное вооружение) metadict_chars['Warrior 1 lvl (legionary infantry)'] = { # Исторически носили по 2 пилума, но шесть весомее (вот только пехота столько не унесёт). 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':6, }, } metadict_chars['Warrior 2 lvl (legionary infantry-veteran)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Protection':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Scale Mail':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':4, }, } metadict_chars['Warrior 3 lvl (legionary infantry-corporal)'] = { # Десятник (декан, урагос) 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Protection':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':4, }, } metadict_chars['Warrior 4 lvl (legionary infantry-sergeant)'] = { # Командир 30 легионеров, старший сержант (опцион, тессерарий) 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':4, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (legionary infantry-lieutenant)'] = { # Командир сотни легионеров, центурион (кентурион). 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':4, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Тяжёлая пехота наёмников: metadict_chars['Warrior 1 lvl (mercenary heavy-infantry)'] = { # Щиты используют против лучников, но не в ближнем бою. 'level':1, 'char_class':'Warrior-heavy', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Ring Mail':1, 'Shield':1, 'Glaive':1, }, } metadict_chars['Warrior 2 lvl (mercenary heavy-infantry-veteran)'] = { 'level':2, 'char_class':'Warrior-heavy', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Ring Mail':1, 'Shield':1, 'Glaive':1, }, } metadict_chars['Warrior 3 lvl (mercenary heavy-infantry-corporal)'] = { 'level':3, 'char_class':'Warrior-heavy', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Chain Mail':1, 'Shield':1, 'Glaive':1, }, } metadict_chars['Warrior 4 lvl (mercenary heavy-infantry-sergeant)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Chain Mail':1, 'Shield':1, 'Glaive':1, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } metadict_chars['Warrior 5 lvl (mercenary heavy-infantry-lieutenant)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Splint Armor':1, 'Shield':1, 'Glaive':1, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Вспомогательные войска, инженеры. metadict_chars['Warrior 2 lvl (siege engineer-apprentice) (trebuchet-light)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Chain Shirt':1, 'Shield':1, 'Shortsword':1, 'Trebuchet, Light':1, 'Sling Bullets (x25)':100, #'Boulder (25 lb)':100, #'Boulder (10 lb)':100, }, 'mount_combat':True, 'mount_type':'Onager', 'equipment_mount':{ }, } metadict_chars['Warrior 2 lvl (siege engineer-apprentice) (trebuchet-heavy)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Chain Shirt':1, 'Shield':1, 'Shortsword':1, 'Trebuchet, Heavy':1, 'Boulder (200 lb)':100, }, 'mount_combat':True, 'mount_type':'Onager', 'equipment_mount':{ }, } metadict_chars['Warrior 2 lvl (siege engineer-apprentice) (ballista-siege)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Chain Shirt':1, 'Shield':1, 'Shortsword':1, 'Ballista, Heavy':1, 'Boulder (50 lb)':100, }, 'mount_combat':True, 'mount_type':'Onager', 'equipment_mount':{ }, } metadict_chars['Warrior 2 lvl (siege engineer-apprentice) (ballista-medium)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Chain Shirt':1, 'Shield':1, 'Shortsword':1, 'Ballista, Medium':1, #'Ballista Bolt (1 lb)':100, 'Ballista Bolt (5 lb)':100, #'Ballista Bolt (25 lb)':100, #'Alchemist\'s Fire (10/25 lb)':100, }, 'mount_combat':True, 'mount_type':'Onager', 'equipment_mount':{ }, } metadict_chars['Warrior 2 lvl (siege engineer-apprentice) (onager-siege)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Chain Shirt':1, 'Shield':1, 'Shortsword':1, 'Onager':1, 'Boulder (50 lb)':100, }, 'mount_combat':True, 'mount_type':'Onager', 'equipment_mount':{ }, } metadict_chars['Warrior 2 lvl (siege engineer-apprentice) (onager-fire)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Chain Shirt':1, 'Shield':1, 'Shortsword':1, 'Onager':1, 'Alchemist\'s Fire (25/50 lb)':10, }, 'mount_combat':True, 'mount_type':'Onager', 'equipment_mount':{ }, } metadict_chars['Warrior 4 lvl (siege engineer-master)'] = { # Командует онаграми, сам не стреляет. 'level':4, 'volley_AI':True, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, }, } #---- # Герои metadict_chars['Fighter 1 lvl (legionary sentinel-battler)'] = { # Бойцы в тяжёлых доспехах. 'level':1, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ # Feat_Heavy_Armor_Master увеличивает силу на 1. 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Fighting_Style_Protection':True, 'Second_Wind':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Chain Mail':1, 'Heavy Shield':1, 'Long Spear':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Fighter 2 lvl (legionary sentinel-shieldman)'] = { 'level':2, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Fighting_Style_Protection':True, 'Second_Wind':True, 'Action_Surge':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Chain Mail':1, 'Heavy Shield':1, 'Long Spear':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Fighter 3 lvl (legionary sentinel-mystic)'] = { 'level':3, 'char_class':'Eldritch_Knight', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Fighting_Style_Protection':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Eldritch_Knight':True, 'Weapon_Bond':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Sword_Burst'), ('cantrip', 'Frostbite'), ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Fog_Cloud'), ], }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':3, 'Splint Armor':1, 'Heavy Shield':1, 'Longsword':1, }, } metadict_chars['Fighter 4 lvl (legionary sentinel-sergeant)'] = { 'level':4, 'no_grappler_AI':True, 'char_class':'Eldritch_Knight', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, 'intelligence':+2, }, 'Fighting_Style_Defence':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Eldritch_Knight':True, 'Weapon_Bond':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Sword_Burst'), ('cantrip', 'Frostbite'), ('1_lvl', 'Shield'), ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Fog_Cloud'), ], }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':3, 'Splint Armor':1, 'Heavy Shield':1, 'Longsword +1':1, }, } metadict_chars['Fighter 5 lvl (legionary sentinel-lieutenant)'] = { 'level':5, 'no_grappler_AI':True, 'char_class':'Eldritch_Knight', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, 'intelligence':+2, }, 'Fighting_Style_Defence':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Eldritch_Knight':True, 'Weapon_Bond':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Sword_Burst'), ('cantrip', 'Frostbite'), ('1_lvl', 'Shield'), ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Fog_Cloud'), ], 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':3, 'Splint Armor':1, 'Heavy Shield':1, 'Longsword +1':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Бойцы с двуручниками. metadict_chars['Fighter 1 lvl (legionary slayer-rookie)'] = { 'level':1, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Great_Weapon_Master':True, 'Fighting_Style_Great_Weapon_Fighting':True, 'Second_Wind':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Scale Mail':1, 'Shield':1, 'Greatsword':1, 'Javelin':6, }, } metadict_chars['Fighter 2 lvl (legionary slayer-flanker)'] = { 'level':2, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Great_Weapon_Master':True, 'Fighting_Style_Great_Weapon_Fighting':True, 'Second_Wind':True, 'Action_Surge':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Chain Mail':1, 'Shield':1, 'Greatsword':1, }, } metadict_chars['Fighter 3 lvl (legionary slayer-champion)'] = { # TODO: В общем и целом бойцы-чемпионы уступают варварам. Самураев испытай. # Пока что мастер боевых искусств. 'level':3, 'char_class':'Battlemaster', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Great_Weapon_Master':True, 'Fighting_Style_Great_Weapon_Fighting':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Battlemaster':True, 'Combat_Superiority':True, 'Student_of_War':True, 'Parry':True, 'Menacing_Attack':True, 'Precision_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Chain Mail':1, 'Shield':1, 'Greatsword':1, }, } metadict_chars['Fighter 4 lvl (legionary slayer-sergeant)'] = { 'level':4, 'no_grappler_AI':True, 'char_class':'Battlemaster', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Great_Weapon_Master':True, 'Fighting_Style_Great_Weapon_Fighting':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Battlemaster':True, 'Combat_Superiority':True, 'Student_of_War':True, 'Parry':True, 'Menacing_Attack':True, 'Precision_Attack':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Splint Armor':1, 'Shield':1, 'Greatsword':1, }, } metadict_chars['Fighter 5 lvl (legionary slayer-lieutenant)'] = { # Samurai 'level':5, 'no_grappler_AI':True, 'char_class':'Battlemaster', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Great_Weapon_Master':True, 'Fighting_Style_Great_Weapon_Fighting':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Battlemaster':True, 'Combat_Superiority':True, 'Student_of_War':True, 'Parry':True, 'Menacing_Attack':True, 'Precision_Attack':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Regeneration':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Splint Armor':1, 'Shield':1, 'Greatsword +1':1, }, } #---- # Всадники легиона. metadict_chars['Fighter 1 lvl (legionary horseman)'] = { # Профессиональная конница на боевых конях. 'level':1, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Fighting_Style_Dueling':True, 'Second_Wind':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Scale Mail':1, 'Shield':1, 'Lance':1, 'Longsword':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Light Warhorse', 'equipment_mount':{ }, } metadict_chars['Fighter 2 lvl (legionary horseman-veteran)'] = { # Катафракты. 'level':2, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Fighting_Style_Dueling':True, 'Second_Wind':True, 'Action_Surge':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Chain Mail':1, 'Shield':1, 'Lance':1, 'Longsword':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ }, } metadict_chars['Fighter 3 lvl (legionary horseman-corporal)'] = { 'level':3, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Fighting_Style_Dueling':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Champion':True, 'Champion_Improved_Critical':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Chain Mail':1, 'Shield':1, 'Lance':1, 'Longsword':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Horse Scale Mail':1, }, } metadict_chars['Fighter 4 lvl (legionary horseman-sergeant)'] = { 'level':4, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Fighting_Style_Dueling':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Champion':True, 'Champion_Improved_Critical':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Splint Armor':1, 'Shield':1, 'Lance':1, 'Longsword':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Horse Scale Mail':1, }, } metadict_chars['Fighter 5 lvl (legionary horseman-lieutenant)'] = { 'level':5, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Fighting_Style_Dueling':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Champion':True, 'Champion_Improved_Critical':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Splint Armor':1, 'Shield':1, 'Lance':1, 'Longsword +1':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Horse Scale Mail':1, }, } #---- # Монахи: metadict_chars['Monk 1 lvl (city windsong-apprentice)'] = { 'level':1, 'char_class':'Monk', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Defensive_Duelist':True, 'Unarmored_Defense':True, 'Martial_Arts':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Shortsword':1, #'Bolas':6, }, } metadict_chars['Monk 2 lvl (city windsong-gatekeeper)'] = { 'level':2, 'char_class':'Monk', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Defensive_Duelist':True, 'Unarmored_Defense':True, 'Martial_Arts':True, 'Flurry_of_Blows':True, 'Patient_Defense':True, 'Step_of_the_Wind':True, 'Unarmored_Movement':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Shortsword':1, #'Bolas':6, }, } metadict_chars['Monk 3 lvl (city windsong-lorekeeper)'] = { # Путь открытой ладони 'level':3, 'char_class':'Monk', 'hit_dice':'1d8', 'behavior':'commander', 'grappler_AI':True, 'class_features':{ 'Feat_Defensive_Duelist':True, 'Unarmored_Defense':True, 'Martial_Arts':True, 'Flurry_of_Blows':True, 'Patient_Defense':True, 'Step_of_the_Wind':True, 'Unarmored_Movement':True, 'Deflect_Missiles':True, 'Open_Hand_Technique':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, 'Shortsword':1, #'Bolas':6, }, } metadict_chars['Monk 4 lvl (city windsong-oathkeeper)'] = { 'level':4, 'char_class':'Monk', 'hit_dice':'1d8', 'behavior':'commander', 'grappler_AI':True, 'class_features':{ 'Feat_Defensive_Duelist':True, 'Unarmored_Defense':True, 'Martial_Arts':True, 'Flurry_of_Blows':True, 'Patient_Defense':True, 'Step_of_the_Wind':True, 'Unarmored_Movement':True, 'Deflect_Missiles':True, 'Open_Hand_Technique':True, 'Ability_Score_Improvement':{ 'dexterity':+2, }, 'Slow_Fall':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Shortsword':1, #'Bolas':6, }, } metadict_chars['Monk 5 lvl (city windsong-warmonger)'] = { 'level':5, 'char_class':'Monk', 'hit_dice':'1d8', 'behavior':'commander', 'grappler_AI':True, 'class_features':{ # TODO: # Тактика такова: # - Атаковать с Flurry_of_Blows и Stunning_Strike (который обнуляет спасброски) # - Второй атакой схватить (автоматический успех) и тащить в строй своих. 'Feat_Defensive_Duelist':True, 'Unarmored_Defense':True, 'Martial_Arts':True, 'Flurry_of_Blows':True, 'Patient_Defense':True, 'Step_of_the_Wind':True, 'Stunning_Strike':True, 'Unarmored_Movement':True, 'Deflect_Missiles':True, 'Open_Hand_Technique':True, 'Ability_Score_Improvement':{ 'dexterity':+2, }, 'Slow_Fall':True, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Shortsword +1':1, #'Bolas':6, }, } #---- # Варвары: metadict_chars['Barbarian 1 lvl (thracian slayer-dogface)'] = { # Фракийцы с ромфаями. 'level':1, 'char_class':'Barbarian', 'hit_dice':'1d12', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Great_Weapon_Master':True, 'Unarmored_Defense':True, 'Rage':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Scale Mail':1, 'Heavy Shield':1, 'Greatsword':1, 'Javelin':6, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Barbarian 2 lvl (thracian slayer-slasher)'] = { 'level':2, 'char_class':'Barbarian', 'hit_dice':'1d12', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Great_Weapon_Master':True, 'Unarmored_Defense':True, 'Rage':True, 'Reckless_Attack':True, 'Danger_Sense':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':2, 'Scale Mail':1, 'Heavy Shield':1, 'Greatsword':1, 'Javelin':6, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Barbarian 3 lvl (thracian slayer-juggernaught)'] = { 'level':3, 'char_class':'Barbarian', 'hit_dice':'1d12', 'behavior':'commander', 'class_features':{ 'Feat_Great_Weapon_Master':True, 'Unarmored_Defense':True, 'Rage':True, 'Reckless_Attack':True, 'Danger_Sense':True, 'Primal_Path_Berserker':True, 'Berserker_Frenzy':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':3, 'Scale Mail':1, 'Heavy Shield':1, 'Greatsword':1, 'Javelin':6, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Barbarian 4 lvl (thracian slayer-thane)'] = { 'level':4, 'no_grappler_AI':True, 'char_class':'Barbarian', 'hit_dice':'1d12', 'behavior':'commander', 'class_features':{ 'Feat_Great_Weapon_Master':True, 'Unarmored_Defense':True, 'Rage':True, 'Reckless_Attack':True, 'Danger_Sense':True, 'Primal_Path_Berserker':True, 'Berserker_Frenzy':True, 'Ability_Score_Improvement':{ 'strength':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Regeneration':1, 'Infusion of Heroism':1, 'Rune of Absorbtion':1, 'Half Plate':1, 'Heavy Shield':1, 'Greatsword':1, 'Javelin':6, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Barbarian 5 lvl (thracian slayer-lord)'] = { 'level':5, 'no_grappler_AI':True, 'char_class':'Barbarian', 'hit_dice':'1d12', 'behavior':'commander', 'class_features':{ 'Feat_Great_Weapon_Master':True, 'Unarmored_Defense':True, 'Rage':True, 'Reckless_Attack':True, 'Danger_Sense':True, 'Primal_Path_Berserker':True, 'Berserker_Frenzy':True, 'Ability_Score_Improvement':{ 'strength':+2, }, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Regeneration':1, 'Infusion of Heroism':1, 'Rune of Absorbtion':1, 'Half Plate':1, 'Heavy Shield':1, 'Greatsword +1':1, 'Javelin':6, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Варлоки, колдуны: metadict_chars['Warlock 1 lvl (otherworld seeker-follower)'] = { 'level':1, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ #'Feat_Elemental_Adept':'fire', 'Feat_Spellsniper':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Thunderclap'), #('cantrip', 'Prestidigitation'), #('1_lvl', 'Charm_Person'), #('1_lvl', 'Arms_of_Hadar'), #('1_lvl', 'Cause_Fear'), #('1_lvl', 'Armor_of_Agathys'), ('1_lvl', 'Burning_Hands'), ('1_lvl', 'Hex'), # 2d6 урона, 5x5 клеток вокруг себя: #('1_lvl', 'Arms_of_Hadar'), #('1_lvl', 'Expeditious_Retreat'), #('1_lvl', 'Hellish_Rebuke'), #('1_lvl', 'Witch_Bolt'), ], 'Dark_One\'s_Blessing':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Warlock 2 lvl (otherworld seeker-adept)'] = { 'level':2, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ #'Feat_Elemental_Adept':'fire', 'Feat_Spellsniper':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Thunderclap'), #('1_lvl', 'Charm_Person'), #('1_lvl', 'Protection_from_Evil_and_Good'), ('1_lvl', 'Burning_Hands'), ('1_lvl', 'Armor_of_Agathys'), ('1_lvl', 'Hex'), ], 'Dark_One\'s_Blessing':True, 'Eldritch_Invocations':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Eldritch_Spear':True, #'Invocation_Mask_of_Many_Faces':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Warlock 3 lvl (otherworld seeker-emissary)'] = { 'level':3, 'fireball_AI':True, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Feat_Elemental_Adept':'fire', 'Feat_Spellsniper':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Thunderclap'), ('cantrip', 'Prestidigitation'), ('cantrip', 'Minor_Illusion'), ('cantrip', 'Message'), #('2_lvl', 'Charm_Person'), ('2_lvl', 'Armor_of_Agathys'), ('2_lvl', 'Protection_from_Evil_and_Good'), ('2_lvl', 'Invisibility'), ('2_lvl', 'Shatter'), #('2_lvl', 'Cause_Fear'), #('2_lvl', 'Invisibility'), #('2_lvl', 'Darkness'), # Ловля птиц, 300 футов: #('2_lvl', 'Earthbind'), #('2_lvl', 'Hold_Person'), #('2_lvl', 'Mind_Spike'), ], 'Dark_One\'s_Blessing':True, 'Eldritch_Invocations':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Eldritch_Spear':True, 'Pact_Boon':True, 'Pact_of_the_Tome':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Warlock 4 lvl (otherworld seeker-envoy)'] = { 'level':4, 'fireball_AI':True, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Feat_Elemental_Adept':'fire', 'Feat_Spellsniper':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Thunderclap'), ('cantrip', 'Minor_Illusion'), ('cantrip', 'Prestidigitation'), ('cantrip', 'Message'), ('cantrip', 'Mage_Hand'), #('2_lvl', 'Charm_Person'), ('2_lvl', 'Armor_of_Agathys'), ('2_lvl', 'Protection_from_Evil_and_Good'), ('2_lvl', 'Invisibility'), ('2_lvl', 'Shatter'), ('2_lvl', 'Suggestion'), ], 'Dark_One\'s_Blessing':True, 'Eldritch_Invocations':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Eldritch_Spear':True, 'Pact_Boon':True, 'Pact_of_the_Tome':True, 'Ability_Score_Improvement':{ 'charisma':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Warlock 5 lvl (otherworld seeker-ascendant)'] = { 'level':5, 'fireball_AI':True, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Feat_Elemental_Adept':'fire', 'Feat_Spellsniper':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Thunderclap'), ('cantrip', 'Minor_Illusion'), ('cantrip', 'Prestidigitation'), ('cantrip', 'Message'), ('cantrip', 'Mage_Hand'), ('ritual', 'Detect_Magic'), ('ritual', 'Identify'), #('3_lvl', 'Charm_Person'), #('3_lvl', 'Armor_of_Agathys'), ('3_lvl', 'Protection_from_Evil_and_Good'), ('3_lvl', 'Invisibility'), ('3_lvl', 'Suggestion'), ('3_lvl', 'Counterspell'), ('3_lvl', 'Fireball'), #('3_lvl', 'Fear'), #('3_lvl', 'Dispel_Magic'), ], 'Dark_One\'s_Blessing':True, 'Eldritch_Invocations':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Eldritch_Spear':True, 'Invocation_Book_of_Ancient_Secrets':True, 'Pact_Boon':True, 'Pact_of_the_Tome':True, 'Ability_Score_Improvement':{ 'charisma':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Волшебники-кошки: # Snooty metadict_chars['Wizard 2 lvl (city cat-weaver)'] = { 'level':2, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'archer', 'class_features':{ 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Fire_Bolt'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), #('1_lvl', 'Sleep'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), ], 'Arcane_Ward':True, }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Wizard 5 lvl (city cat-seer)'] = { 'level':5, 'fireball_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Fire_Bolt'), ('cantrip', 'Message'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('ritual', 'Gentle_Repose'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Blur'), ('2_lvl', 'Flaming_Sphere'), ('2_lvl', 'Shatter'), ('3_lvl', 'Counterspell'), ('3_lvl', 'Fear'), #('3_lvl', 'Fireball'), ], 'Arcane_Ward':True, 'Ability_Score_Improvement':{ 'intelligence':+2, }, }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Волшебники: metadict_chars['Wizard 1 lvl (otherworld mage-disciple)'] = { # В книге 1 lvl волшебника -- 6 заклинаний (далее +2 за уровень) # Число подготовленных заклинаний: уровень_мага + мод_интеллекта 'level':1, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'archer', 'class_features':{ 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ # Mold_Earth -- траншейная машина, 33 кубометра/минута, 900 метров траншеи/час. #('cantrip', 'Create_Bonfire'), #('cantrip', 'Shape_Water'), #('cantrip', 'Mold_Earth'), ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Fire_Bolt'), # Доступно 3-4 подготовленных заклинания (кроме ритуалов): #('ritual', 'Comprehend_Languages'), #('ritual', 'Illusory_Script'), #('ritual', 'Floating_Disk'), #('ritual', 'Find_Familiar'), #('ritual', 'Alarm'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Charm_Person'), #('1_lvl', 'Cause_Fear'), #('1_lvl', 'Disguise_Self'), #('1_lvl', 'Mage_Armor'), #('1_lvl', 'Absorb_Elements'), ], }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Wizard 2 lvl (otherworld mage-weaver)'] = { # Abjurer 'level':2, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'archer', 'class_features':{ 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Fire_Bolt'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), ], 'Arcane_Ward':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Wizard 3 lvl (otherworld mage-annalist)'] = { 'level':3, 'fireball_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Fire_Bolt'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('ritual', 'Gentle_Repose'), #('ritual', 'Magic_Mouth'), #('ritual', 'Skywrite'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Magic_Missile'), #('2_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Blur'), ('2_lvl', 'Shatter'), #('2_lvl', 'Melfs_Acid_Arrow'), #('2_lvl', 'Continual_Flame'), #('2_lvl', 'Magic_Weapon'), #('2_lvl', 'Alter_Self'), #('2_lvl', 'Levitate'), #('2_lvl', 'Blur'), #('2_lvl', 'Mirror_Image'), #('2_lvl', 'Invisibility'), #('2_lvl', 'See_Invisibility'), #('2_lvl', 'Pyrotechnics'), #('2_lvl', 'Darkvision'), #('2_lvl', 'Darkness'), #('2_lvl', 'Knock'), # Хорошая защита от лучников (10 футов радиус, 21 тайл): #('2_lvl', 'Warding_Wind'), # Термобарический боеприпас от мира заклинаний (10 футов, 21 тайл): # https://www.reddit.com/r/dndnext/comments/bv14et/shatter_really_underrated_spell/ #('2_lvl', 'Shatter'), # Чудовища-уничтожители (9 тайлов контроля, минута концентрации): #('2_lvl', 'Flaming_Sphere'), #('2_lvl', 'Dust_Devil'), # Пример бесполезного заклинания (требует броска атаки в отличии от Magic_Missile): #('2_lvl', 'Scorching_Ray'), ], 'Arcane_Ward':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Wizard 4 lvl (otherworld mage-savant)'] = { 'level':4, 'fireball_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Fire_Bolt'), ('cantrip', 'Message'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('ritual', 'Gentle_Repose'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Magic_Missile'), #('2_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Blur'), ('2_lvl', 'Flaming_Sphere'), ('2_lvl', 'Shatter'), ], 'Arcane_Ward':True, 'Ability_Score_Improvement':{ 'intelligence':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Wizard 5 lvl (otherworld mage-seer)'] = { 'level':5, 'fireball_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Fire_Bolt'), ('cantrip', 'Message'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('ritual', 'Gentle_Repose'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Magic_Missile'), #('2_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Blur'), ('2_lvl', 'Flaming_Sphere'), ('2_lvl', 'Shatter'), ('3_lvl', 'Counterspell'), ('3_lvl', 'Fireball'), #('3_lvl', 'Blink'), #('3_lvl', 'Sending'), #('3_lvl', 'Remove_Curse'), #('3_lvl', 'Nondetection'), #('3_lvl', 'Magic_Circle'), #('3_lvl', 'Dispel_Magic'), #('3_lvl', 'Clairvoyance'), #('3_lvl', 'Major_Image'), #('3_lvl', 'Fly'), #('3_lvl', 'Slow'), # Sending не зависит от языка отправителя и получателя, срабатывает всегда: #('3_lvl', 'Sending'), #('3_lvl', 'Glyph_of_Warding'), # Clairvoyance можно кастовать раз за разом, всё дальше исследуя опасные места: #('3_lvl', 'Clairvoyance'), ], 'Arcane_Ward':True, 'Ability_Score_Improvement':{ 'intelligence':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Барды: metadict_chars['Bard 1 lvl (otherworld singer-follower)'] = { 'level':1, 'char_class':'Bard', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Feat_Inspiring_Leader':True, 'Bardic_Inspiration':True, 'Spellcasting':True, 'Spells':[ # TODO: сделай Faerie_Fire ('cantrip', 'Prestidigitation'), ('cantrip', 'Vicious_Mockery'), #('ritual', 'Comprehend_Languages'), #('ritual', 'Illusory_Script'), #('ritual', 'Unseen_Servant'), #('ritual', 'Detect_Magic'), #('ritual', 'Identify'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Sleep'), # Faerie_Fire впечатляет, 2x2 квадрат, минута действия, преимущество на атаки. ('1_lvl', 'Faerie_Fire'), # Bane тоже божественный, три цели, -1d4 к броскам атаки и спасброскам. #('1_lvl', 'Bane'), # Героизм добавляет мод_харизмы бонусными хитпоинтами каждый ход. #('1_lvl', 'Heroism'), #('1_lvl', 'Disguise_Self'), #('1_lvl', 'Animal_Friendship'), ], }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Bard 2 lvl (otherworld singer-stranger)'] = { # TODO: Jack_of_All_Trades позволяет добавлять 1/2 бонуса мастерства к модификаторам характеристик. 'level':2, 'char_class':'Bard', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Feat_Inspiring_Leader':True, 'Bardic_Inspiration':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Vicious_Mockery'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Sleep'), ('1_lvl', 'Faerie_Fire'), ], 'Jack_of_All_Trades':True, 'Song_of_Rest':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Bard 3 lvl (otherworld singer-explorer)'] = { 'level':3, 'char_class':'Bard', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Inspiring_Leader':True, 'Bardic_Inspiration':True, 'Spellcasting':True, 'Spells':[ # TODO: пили "Боевое вдохновение" # Позволяет добавлять кость вдохновения к урону или AC. ('cantrip', 'Prestidigitation'), ('cantrip', 'Vicious_Mockery'), ('ritual', 'Unseen_Servant'), #('ritual', 'Magic_Mouth'), #('ritual', 'Animal_Messenger'), #('ritual', 'Locate_Animals_or_Plants'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Sleep'), ('2_lvl', 'Shatter'), ('2_lvl', 'Lesser_Restoration'), #('2_lvl', 'Hold_Person'), #('2_lvl', 'Invisibility'), #('2_lvl', 'Enhance_Ability'), # Радиус 20 футов, защита от страха для своих, успокоение врагов: #('2_lvl', 'Calm_Emotions'), # Чудовищно эффективное заклинание, поджаривает врага в броне: #('2_lvl', 'Heat_Metal'), ], 'Jack_of_All_Trades':True, 'Song_of_Rest':True, 'College_of_Valor':True, 'Expertise':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Half Plate':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Bard 4 lvl (otherworld singer-pathfinder)'] = { 'level':4, 'char_class':'Bard', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Inspiring_Leader':True, 'Bardic_Inspiration':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Vicious_Mockery'), ('cantrip', 'Message'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Sleep'), ('2_lvl', 'Shatter'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Calm_Emotions'), ], 'Jack_of_All_Trades':True, 'Song_of_Rest':True, 'College_of_Valor':True, 'Expertise':True, 'Ability_Score_Improvement':{ 'charisma':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Bard 5 lvl (otherworld singer-leader)'] = { 'level':5, 'fireball_AI':True, 'char_class':'Bard', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Inspiring_Leader':True, 'Bardic_Inspiration':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Vicious_Mockery'), ('cantrip', 'Message'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Healing_Word'), ('2_lvl', 'Shatter'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Calm_Emotions'), ('3_lvl', 'Sending'), ('3_lvl', 'Clairvoyance'), #('3_lvl', 'Tongues'), #('3_lvl', 'Nondetection'), #('3_lvl', 'Clairvoyance'), #('3_lvl', 'Dispel_Magic'), #('3_lvl', 'Glyph_of_Warding'), #('3_lvl', 'Speak_with_Dead'), #('3_lvl', 'Speak_with_Plants'), # Hypnotic_Pattern, 6x6 клеток, минута действия, останавливает врагов. #('3_lvl', 'Hypnotic_Pattern'), # Plant_Growth, 8 часов каста, радиус 1/2 мили, 269 гектаров, удвоение урожайности на год. # За год один маг может улучшить 96 840 гектаров земли, 100 000 тонн пшеницы при сам-12. # Каждый маг с этим заклинанием может дать еду лишним 50-150 тыс. населения. #('3_lvl', 'Plant_Growth'), ], 'Jack_of_All_Trades':True, 'Song_of_Rest':True, 'College_of_Valor':True, 'Expertise':True, 'Ability_Score_Improvement':{ 'charisma':+2, }, 'Font_of_Inspiration':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Shield':1, 'Shortsword':1, 'Shortbow +1':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Жрецы -- домен войны: metadict_chars['Cleric 1 lvl (war cleric)'] = { 'level':1, 'char_class':'Cleric', 'abilityes_choice':['wisdom','strength','constitution','dexterity'], 'hit_dice':'1d8', #'seeker_AI':True, #'killer_AI':True, 'behavior':'commander', 'class_features':{ 'Feat_Inspiring_Leader':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mend'), ('cantrip', 'Sacred_Flame'), ('cantrip', 'Spare_the_Dying'), #('cantrip', 'Word_of_Radiance'), ('ritual', 'Detect_Poison_and_Disease'), ('ritual', 'Purify_Food_and_Drink'), #('ritual', 'Detect_Magic'), #('1_lvl', 'Healing_Word'), ('1_lvl', 'Bless'), #('1_lvl', 'Cure_Wounds'), ('1_lvl', 'Healing_Word'), #('1_lvl', 'Guiding_Bolt'), #('1_lvl', 'Shield_of_Faith'), ], 'War_Domain':True, 'War_Priest':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Splint Armor':1, 'Shield':1, 'Mace':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Жрецы -- домен жизни: metadict_chars['Cleric 1 lvl (city maatcarian-acolyte)'] = { # Список заклинания, это уровень жреца, плюс модификатор мудрости. 'level':1, 'char_class':'Cleric', 'abilityes_choice':['wisdom','dexterity','constitution','charisma'], 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ # Homebrew: жрецы с Unarmored_Defense вместо брони: 'Unarmored_Defense':True, 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Thaumaturgy'), ('cantrip', 'Spare_the_Dying'), ('cantrip', 'Sacred_Flame'), ('ritual', 'Detect_Poison_and_Disease'), ('ritual', 'Purify_Food_and_Drink'), #('ritual', 'Detect_Magic'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Bless'), #('1_lvl', 'Cure_Wounds'), #('1_lvl', 'Sanctuary'), #('1_lvl', 'Shield_of_Faith'), #('ritual', 'Ceremony'), ], 'Life_Domain':True, 'Disciple_of_Life':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Healer Kit':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 2 lvl (city maatcarian-celebrant)'] = { 'level':2, 'char_class':'Cleric', 'abilityes_choice':['wisdom','dexterity','constitution','charisma'], 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Unarmored_Defense':True, 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Thaumaturgy'), ('cantrip', 'Spare_the_Dying'), ('cantrip', 'Sacred_Flame'), ('ritual', 'Detect_Poison_and_Disease'), ('ritual', 'Purify_Food_and_Drink'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Sanctuary'), ('1_lvl', 'Bless'), ], 'Life_Domain':True, 'Disciple_of_Life':True, 'Channel_Turn_Undead':True, 'Channel_Preserve_Life':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Healer Kit':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 3 lvl (city maatcarian-augur)'] = { 'level':3, 'fireball_AI':True, 'char_class':'Cleric', 'abilityes_choice':['wisdom','dexterity','constitution','charisma'], 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Unarmored_Defense':True, 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Thaumaturgy'), ('cantrip', 'Spare_the_Dying'), ('cantrip', 'Sacred_Flame'), ('ritual', 'Augury'), #('ritual', 'Silence'), ('1_lvl', 'Healing_Word'), ('2_lvl', 'Healing_Word'), ('1_lvl', 'Sanctuary'), ('2_lvl', 'Gentle_Repose'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Continual_Flame'), #('2_lvl', 'Protection_from_Poison'), #('2_lvl', 'Prayer_of_Healing'), #('2_lvl', 'Spiritual_Weapon'), #('2_lvl', 'Zone_of_Truth'), #('2_lvl', 'Warding_Bond'), #('2_lvl', 'Find_Traps'), ], 'Life_Domain':True, 'Disciple_of_Life':True, 'Channel_Turn_Undead':True, 'Channel_Preserve_Life':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 4 lvl (city maatcarian-arbiter)'] = { 'level':4, 'fireball_AI':True, 'char_class':'Cleric', 'abilityes_choice':['wisdom','dexterity','constitution','charisma'], 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Unarmored_Defense':True, 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Thaumaturgy'), ('cantrip', 'Spare_the_Dying'), ('cantrip', 'Sacred_Flame'), ('cantrip', 'Guidance'), ('ritual', 'Augury'), ('1_lvl', 'Healing_Word'), ('2_lvl', 'Healing_Word'), ('1_lvl', 'Sanctuary'), ('2_lvl', 'Gentle_Repose'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Continual_Flame'), ('2_lvl', 'Zone_of_Truth'), ('2_lvl', 'Find_Traps'), ], 'Life_Domain':True, 'Disciple_of_Life':True, 'Channel_Turn_Undead':True, 'Channel_Preserve_Life':True, 'Ability_Score_Improvement':{ 'wisdom':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Healer Kit':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 5 lvl (city maatcarian-reviver)'] = { 'level':5, 'fireball_AI':True, 'char_class':'Cleric', 'abilityes_choice':['wisdom','dexterity','constitution','charisma'], 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Unarmored_Defense':True, 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Thaumaturgy'), ('cantrip', 'Spare_the_Dying'), ('cantrip', 'Sacred_Flame'), ('cantrip', 'Guidance'), ('ritual', 'Augury'), #('ritual', 'Water_Walk'), #('ritual', 'Meld_into_Stone'), ('1_lvl', 'Healing_Word'), ('2_lvl', 'Healing_Word'), ('3_lvl', 'Healing_Word'), ('1_lvl', 'Sanctuary'), ('2_lvl', 'Gentle_Repose'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Zone_of_Truth'), ('3_lvl', 'Beacon_of_Hope'), ('3_lvl', 'Revivify'), ('3_lvl', 'Sending'), #('3_lvl', 'Remove_Curse'), #('3_lvl', 'Daylight'), #('3_lvl', 'Clairvoyance'), #('3_lvl', 'Mass_Healing_Word'), #('3_lvl', 'Glyph_of_Warding'), #('3_lvl', 'Spirit_Guardians'), #('3_lvl', 'Speak_with_Dead'), #('3_lvl', 'Tongues'), #('3_lvl', 'Sending'), #('3_lvl', 'Dispel_Magic'), ], 'Life_Domain':True, 'Disciple_of_Life':True, 'Channel_Turn_Undead':True, 'Channel_Preserve_Life':True, 'Channel_Destroy_Undead':True, 'Ability_Score_Improvement':{ 'wisdom':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Healer Kit':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Жрецы -- домен света: metadict_chars['Cleric 1 lvl (city luminary-acolyte)'] = { # Список заклинания, это уровень жреца, плюс модификатор мудрости. 'level':1, 'char_class':'Cleric', 'abilityes_choice':['wisdom','strength','constitution','dexterity'], 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Resistance'), ('cantrip', 'Spare_the_Dying'), ('cantrip', 'Word_of_Radiance'), ('cantrip', 'Light'), ('ritual', 'Purify_Food_and_Drink'), #('ritual', 'Detect_Magic'), #('ritual', 'Ceremony'), ('1_lvl', 'Faerie_Fire'), ('1_lvl', 'Burning_Hands'), #('1_lvl', 'Cure_Wounds'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Shield_of_Faith'), ('1_lvl', 'Bless'), #('1_lvl', 'Cure_Wounds'), #('1_lvl', 'Sanctuary'), ], 'Light_Domain':True, 'Warding_Flare':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 2 lvl (city luminary-celebrant)'] = { 'level':2, 'char_class':'Cleric', 'abilityes_choice':['wisdom','strength','constitution','dexterity'], 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('channel', 'Radiance_of_the_Dawn'), ('cantrip', 'Resistance'), ('cantrip', 'Spare_the_Dying'), ('cantrip', 'Word_of_Radiance'), ('cantrip', 'Light'), ('ritual', 'Ceremony'), ('ritual', 'Purify_Food_and_Drink'), ('1_lvl', 'Faerie_Fire'), ('1_lvl', 'Burning_Hands'), #('1_lvl', 'Cure_Wounds'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Shield_of_Faith'), ('1_lvl', 'Bless'), ], 'Light_Domain':True, 'Warding_Flare':True, 'Channel_Turn_Undead':True, 'Channel_Radiance_of_the_Dawn':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 3 lvl (city luminary-augur)'] = { 'level':3, 'fireball_AI':True, 'char_class':'Cleric', 'abilityes_choice':['wisdom','strength','constitution','dexterity'], 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('channel', 'Radiance_of_the_Dawn'), ('cantrip', 'Resistance'), ('cantrip', 'Spare_the_Dying'), ('cantrip', 'Word_of_Radiance'), ('cantrip', 'Light'), ('ritual', 'Augury'), #('ritual', 'Silence'), ('1_lvl', 'Faerie_Fire'), ('1_lvl', 'Burning_Hands'), #('2_lvl', 'Scorching_Ray'), #('2_lvl', 'Flaming_Sphere'), ('1_lvl', 'Healing_Word'), ('2_lvl', 'Healing_Word'), ('1_lvl', 'Shield_of_Faith'), ('2_lvl', 'Gentle_Repose'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Continual_Flame'), #('2_lvl', 'Protection_from_Poison'), #('2_lvl', 'Prayer_of_Healing'), #('2_lvl', 'Spiritual_Weapon'), #('2_lvl', 'Zone_of_Truth'), #('2_lvl', 'Warding_Bond'), #('2_lvl', 'Find_Traps'), ], 'Light_Domain':True, 'Warding_Flare':True, 'Channel_Turn_Undead':True, 'Channel_Radiance_of_the_Dawn':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 4 lvl (city luminary-arbiter)'] = { 'level':4, 'fireball_AI':True, 'char_class':'Cleric', 'abilityes_choice':['wisdom','strength','constitution','dexterity'], 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('channel', 'Radiance_of_the_Dawn'), ('cantrip', 'Resistance'), ('cantrip', 'Spare_the_Dying'), ('cantrip', 'Word_of_Radiance'), ('cantrip', 'Thaumaturgy'), ('ritual', 'Augury'), ('1_lvl', 'Faerie_Fire'), ('1_lvl', 'Burning_Hands'), #('2_lvl', 'Scorching_Ray'), #('2_lvl', 'Flaming_Sphere'), ('1_lvl', 'Healing_Word'), ('2_lvl', 'Healing_Word'), ('1_lvl', 'Shield_of_Faith'), ('2_lvl', 'Gentle_Repose'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Continual_Flame'), ('2_lvl', 'Zone_of_Truth'), ('2_lvl', 'Find_Traps'), ], 'Light_Domain':True, 'Warding_Flare':True, 'Channel_Turn_Undead':True, 'Channel_Radiance_of_the_Dawn':True, 'Ability_Score_Improvement':{ 'wisdom':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 5 lvl (city luminary-reviver)'] = { 'level':5, 'fireball_AI':True, 'char_class':'Cleric', 'abilityes_choice':['wisdom','strength','constitution','dexterity'], 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('channel', 'Radiance_of_the_Dawn'), ('cantrip', 'Guidance'), ('cantrip', 'Word_of_Radiance'), ('cantrip', 'Spare_the_Dying'), ('cantrip', 'Thaumaturgy'), ('ritual', 'Augury'), #('ritual', 'Water_Walk'), #('ritual', 'Meld_into_Stone'), ('1_lvl', 'Faerie_Fire'), ('1_lvl', 'Burning_Hands'), #('2_lvl', 'Scorching_Ray'), #('2_lvl', 'Flaming_Sphere'), #('3_lvl', 'Daylight'), ('3_lvl', 'Fireball'), ('1_lvl', 'Healing_Word'), ('2_lvl', 'Healing_Word'), ('1_lvl', 'Shield_of_Faith'), ('2_lvl', 'Gentle_Repose'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Zone_of_Truth'), ('3_lvl', 'Beacon_of_Hope'), ('3_lvl', 'Revivify'), ('3_lvl', 'Sending'), #('3_lvl', 'Remove_Curse'), #('3_lvl', 'Daylight'), #('3_lvl', 'Clairvoyance'), #('3_lvl', 'Mass_Healing_Word'), #('3_lvl', 'Glyph_of_Warding'), #('3_lvl', 'Spirit_Guardians'), #('3_lvl', 'Speak_with_Dead'), #('3_lvl', 'Tongues'), #('3_lvl', 'Sending'), #('3_lvl', 'Dispel_Magic'), ], 'Light_Domain':True, 'Warding_Flare':True, 'Channel_Turn_Undead':True, 'Channel_Destroy_Undead':True, 'Channel_Radiance_of_the_Dawn':True, 'Ability_Score_Improvement':{ 'wisdom':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword +1':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Воры-котики: metadict_chars['Rogue 1 lvl (city cat-nyamo)'] = { 'level':1, 'char_class':'Rogue', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Alert':True, 'Expertise':True, 'Sneak_Attack':True, 'Thieves\' Cant':True, }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':{}, 'equipment_backpack':{}, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Crossbow, Light':1, 'Crossbow Bolt':40, 'Dagger':1, }, } metadict_chars['Rogue 2 lvl (city cat-meow)'] = { 'level':2, 'char_class':'Rogue', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Alert':True, 'Expertise':True, 'Sneak_Attack':True, 'Thieves\' Cant':True, 'Cunning_Action':True, 'Cunning_Action_Defence':True, }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':{}, 'equipment_backpack':{}, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, }, } metadict_chars['Rogue 3 lvl (city cat-dodger)'] = { # Это кошки. Волшебные, но кошки. Им неудобно бегать с оружием и в броне. # TODO: с другой стороны, есть же волшебная лапка, то есть Mage_Hand. 'level':3, 'char_class':'Arcane_Tricker', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'grappler_AI':True, 'class_features':{ 'Feat_Alert':True, 'Expertise':True, 'Sneak_Attack':True, 'Thieves\' Cant':True, 'Cunning_Action':True, 'Cunning_Action_Defence':True, 'Roguish_Archetype_Arcane_Tricker':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mage_Hand'), ('cantrip', 'Minor_Illusion'), ('cantrip', 'Message'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Silent_Image'), #('1_lvl', 'Magic_Missile'), ('1_lvl', 'Sleep'), ], 'Mage_Hand_Legerdemain':True, }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':{}, 'equipment_backpack':{}, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, }, } metadict_chars['Rogue 4 lvl (city cat-runner)'] = { 'level':4, 'char_class':'Arcane_Tricker', 'hit_dice':'1d8', 'behavior':'commander', 'grappler_AI':True, 'class_features':{ 'Feat_Alert':True, 'Expertise':True, 'Sneak_Attack':True, 'Thieves\' Cant':True, 'Cunning_Action':True, 'Cunning_Action_Defence':True, 'Roguish_Archetype_Arcane_Tricker':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mage_Hand'), ('cantrip', 'Minor_Illusion'), ('cantrip', 'Message'), ('ritual', 'Illusory_Script'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Silent_Image'), #('1_lvl', 'Magic_Missile'), ('1_lvl', 'Sleep'), ], 'Mage_Hand_Legerdemain':True, 'Ability_Score_Improvement':{ 'dexterity':+2, }, }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':{}, 'equipment_backpack':{}, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Infusion of Claws':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, }, } metadict_chars['Rogue 5 lvl (city cat-mastermind)'] = { 'level':5, #'fireball_AI':True, 'grappler_AI':True, #'no_grappler_AI':True, 'char_class':'Arcane_Tricker', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Alert':True, 'Expertise':True, 'Sneak_Attack':True, 'Thieves\' Cant':True, 'Cunning_Action':True, 'Cunning_Action_Defence':True, 'Roguish_Archetype_Arcane_Tricker':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mage_Hand'), ('cantrip', 'Minor_Illusion'), ('cantrip', 'Message'), ('ritual', 'Illusory_Script'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Silent_Image'), #('1_lvl', 'Magic_Missile'), ('1_lvl', 'Shield'), ], 'Mage_Hand_Legerdemain':True, 'Uncanny_Dodge':True, 'Ability_Score_Improvement':{ 'dexterity':+2, }, }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':{}, 'equipment_backpack':{}, 'equipment_weapon':{ 'Infusion of Claws':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, }, } #---- # Воры: metadict_chars['Rogue 1 lvl (mercenary phantom-blackeye)'] = { # TODO: Дай им чокобо вместо скучных лошадок. 'level':1, 'char_class':'Rogue', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Feat_Sharpshooter':True, 'Expertise':True, 'Sneak_Attack':True, 'Thieves\' Cant':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Rogue 2 lvl (mercenary phantom-hawkeye)'] = { 'level':2, 'char_class':'Rogue', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Feat_Sharpshooter':True, 'Expertise':True, 'Sneak_Attack':True, 'Thieves\' Cant':True, 'Cunning_Action':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Rogue 3 lvl (mercenary phantom-deadeye)'] = { 'level':3, 'char_class':'Rogue', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Sharpshooter':True, 'Expertise':True, 'Sneak_Attack':True, 'Thieves\' Cant':True, 'Cunning_Action':True, 'Roguish_Archetype_Assasin':True, 'Assassinate':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Rogue 4 lvl (mercenary phantom-sergeant)'] = { 'level':4, 'char_class':'Rogue', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Sharpshooter':True, 'Expertise':True, 'Sneak_Attack':True, 'Thieves\' Cant':True, 'Cunning_Action':True, 'Roguish_Archetype_Assasin':True, 'Assassinate':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Longbow +1':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Rogue 5 lvl (mercenary phantom-lieutenant)'] = { 'level':5, 'fireball_AI':True, 'char_class':'Rogue', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Sharpshooter':True, 'Expertise':True, 'Sneak_Attack':True, 'Thieves\' Cant':True, 'Cunning_Action':True, 'Roguish_Archetype_Assasin':True, 'Assassinate':True, 'Uncanny_Dodge':True, 'Ability_Score_Improvement':{ 'dexterity':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shield':1, 'Shortsword':1, 'Longbow +1':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Рейнджеры: metadict_chars['Ranger 1 lvl (otherworld wanderer-scout)'] = { 'level':1, 'char_class':'Ranger', 'hit_dice':'1d10', 'behavior':'archer', 'class_features':{ 'Feat_Sharpshooter':True, 'Favored_Enemy':['humans'], 'Natural_Explorer':['forest'], }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Ranger 2 lvl (otherworld wanderer-marksman)'] = { 'level':2, 'char_class':'Ranger', 'hit_dice':'1d10', 'behavior':'archer', 'class_features':{ 'Feat_Sharpshooter':True, 'Favored_Enemy':['humans'], 'Natural_Explorer':['forest'], 'Spellcasting':True, 'Spells':[ #('ritual', 'Speak_with_Animals'), #('ritual', 'Detect_Poison_and_Disease'), #('ritual', 'Alarm'), ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Hail_of_Thorns'), #('1_lvl', 'Fog_Cloud'), #('1_lvl', 'Hunter\'s Mark'), #('1_lvl', 'Ensnaring_Strike'), #('1_lvl', 'Animal_Friendship'), #('1_lvl', 'Cure_Wounds'), #('1_lvl', 'Goodberry'), ], 'Fighting_Style_Archery':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Ranger 3 lvl (otherworld wanderer-hunter)'] = { 'level':3, 'char_class':'Ranger', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Sharpshooter':True, 'Favored_Enemy':['humans'], 'Natural_Explorer':['forest'], 'Spellcasting':True, 'Spells':[ ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Hail_of_Thorns'), ('1_lvl', 'Fog_Cloud'), ], 'Fighting_Style_Archery':True, 'Primeval_Awareness':True, 'Ranger_Archetype_Hunter':True, 'Hunter_Horde_Breaker':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Ranger 4 lvl (otherworld wanderer-sergeant)'] = { 'level':4, 'char_class':'Ranger', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Sharpshooter':True, 'Favored_Enemy':['humans'], 'Natural_Explorer':['forest'], 'Spellcasting':True, 'Spells':[ ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Hail_of_Thorns'), ('1_lvl', 'Fog_Cloud'), ], 'Fighting_Style_Archery':True, 'Primeval_Awareness':True, 'Ranger_Archetype_Hunter':True, 'Hunter_Horde_Breaker':True, 'Feat_Mounted_Combatant':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shield':1, 'Shortsword':1, 'Longbow +1':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Ranger 5 lvl (otherworld wanderer-lieutenant)'] = { 'level':5, 'char_class':'Ranger', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Sharpshooter':True, 'Favored_Enemy':['humans'], 'Natural_Explorer':['forest'], 'Spellcasting':True, 'Spells':[ ('ritual', 'Alarm'), #('ritual', 'Silence'), #('ritual', 'Beast_Sense'), #('ritual', 'Animal_Messenger'), #('ritual', 'Locate_Animals_or_Plants'), ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Hail_of_Thorns'), ('2_lvl', 'Healing_Spirit'), ('2_lvl', 'Pass_Without_Trace'), #('2_lvl', 'Lesser_Restoration'), #('2_lvl', 'Protection_from_Poison'), #('2_lvl', 'Cordon_of_Arrows'), #('2_lvl', 'Locate_Object'), #('2_lvl', 'Find_Traps'), # Контроль территории, 20-футов радиус, 10 минут: # 2d4 урона за каждую клетку движения. #('2_lvl', 'Spike_Growth'), ], 'Fighting_Style_Archery':True, 'Primeval_Awareness':True, 'Ranger_Archetype_Hunter':True, 'Hunter_Horde_Breaker':True, 'Feat_Mounted_Combatant':True, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shield':1, 'Shortsword':1, 'Longbow +1':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Друиды: # Gardener, grover, metadict_chars['Druid 1 lvl (otherworld terian-forester)'] = { 'level':1, 'char_class':'Druid', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ # Число заклинаний -- мод_мудрости + уровень_друида: # Magic_Stone -- каждый друид значительно усиливает троих пращников. # Goodberry -- 2 слота = 20 хитов на завтра. 20 друидов 2 lvl = 600 хитов лечения. #('cantrip', 'Create_Bonfire'), #('cantrip', 'Control_Flames'), #('cantrip', 'Thorn_Whip'), #('cantrip', 'Guidance'), #('cantrip', 'Gust'), ('cantrip', 'Druidcraft'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Magic_Stone'), #('ritual', 'Detect_Magic'), #('ritual', 'Detect_Poison_and_Disease'), #('ritual', 'Purify_Food_and_Drink'), #('ritual', 'Speak_with_Animals'), ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Entangle'), ('1_lvl', 'Ice_Knife'), #('1_lvl', 'Fog_Cloud'), #('1_lvl', 'Goodberry'), #('1_lvl', 'Charm_Person'), ], 'Druidic_Language':True, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Hide Armor':1, 'Heavy Shield':1, 'Scimitar':1, 'Sling real':1, 'Sling Bullet':10, }, #'mount_combat':True, #'mount_type':'Warhorse', #'equipment_mount':{ # }, } metadict_chars['Druid 2 lvl (otherworld terian-changer)'] = { 'level':2, 'char_class':'Druid', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Druidcraft'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Magic_Stone'), ('cantrip', 'Shape_Water'), #('ritual', 'Detect_Magic'), #('ritual', 'Detect_Poison_and_Disease'), #('ritual', 'Purify_Food_and_Drink'), #('ritual', 'Speak_with_Animals'), ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Entangle'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Ice_Knife'), #('1_lvl', 'Goodberry'), #('1_lvl', 'Charm_Person'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Druid_Circle_Forest':True, 'Natural_Recovery':True, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':3, 'Hide Armor':1, 'Heavy Shield':1, 'Scimitar':1, 'Sling real':1, 'Sling Bullet':10, }, #'mount_combat':True, #'mount_type':'Warhorse', #'equipment_mount':{ # }, } metadict_chars['Druid 3 lvl (otherworld terian-wiseman)'] = { 'level':3, 'fireball_AI':True, 'char_class':'Druid', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Druidcraft'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Magic_Stone'), ('cantrip', 'Shape_Water'), #('ritual', 'Skywrite'), #('ritual', 'Animal_Messenger'), #('ritual', 'Locate_Animals_or_Plants'), # Speak_with_Animals + Beast_Sense = разведка мышками и голубями. ('ritual', 'Speak_with_Animals'), ('ritual', 'Beast_Sense'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Pass_Without_Trace'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Healing_Spirit'), # Moonbeam -- орбитальный лазер. Радиус 5 футов, ~5 целей, 2d10 урона/раунд, минута. ('2_lvl', 'Moonbeam'), #('2_lvl', 'Find_Traps'), #('2_lvl', 'Earthbind'), #('2_lvl', 'Darkvision'), #('2_lvl', 'Dust_Devil'), #('2_lvl', 'Heat_Metal'), #('2_lvl', 'Gust_of_Wind'), # Только горные друиды могут в "Spike_Growth" #('2_lvl', 'Spike_Growth'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Druid_Circle_Forest':True, 'Natural_Recovery':True, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Hide Armor':1, 'Heavy Shield':1, 'Scimitar':1, 'Sling real':1, 'Sling Bullet':10, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Druid 4 lvl (otherworld terian-wonderman)'] = { 'level':4, 'fireball_AI':True, 'char_class':'Druid', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Druidcraft'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Magic_Stone'), ('cantrip', 'Shape_Water'), ('cantrip', 'Create_Bonfire'), ('ritual', 'Speak_with_Animals'), ('ritual', 'Beast_Sense'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Pass_Without_Trace'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Healing_Spirit'), ('2_lvl', 'Gust_of_Wind'), ('2_lvl', 'Moonbeam'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Druid_Circle_Forest':True, 'Natural_Recovery':True, 'Wild_Shape_Improvement':True, 'Ability_Score_Improvement':{ 'wisdom':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Heavy Shield':1, 'Scimitar':1, 'Sling real':1, 'Sling Bullet':10, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Druid 5 lvl (otherworld terian-loremaster)'] = { 'level':5, 'fireball_AI':True, 'char_class':'Druid', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Druidcraft'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Magic_Stone'), ('cantrip', 'Shape_Water'), ('cantrip', 'Create_Bonfire'), #('ritual', 'Feign_Death'), #('ritual', 'Meld_into_Stone'), ('ritual', 'Speak_with_Animals'), ('ritual', 'Beast_Sense'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Pass_Without_Trace'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Healing_Spirit'), ('2_lvl', 'Moonbeam'), ('3_lvl', 'Call_Lightning'), ('3_lvl', 'Conjure_Animals'), ('3_lvl', 'Plant_Growth'), #('3_lvl', 'Dispel_Magic'), #('3_lvl', 'Speak_with_Plants'), #('3_lvl', 'Protection_from_Energy'), # Только для арктических друидов: #('3_lvl', 'Sleet_Storm'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Druid_Circle_Forest':True, 'Natural_Recovery':True, 'Wild_Shape_Improvement':True, 'Ability_Score_Improvement':{ 'wisdom':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Heavy Shield':1, 'Scimitar +1':1, 'Sling real':1, 'Sling Bullet':10, }, #'mount_combat':True, #'mount_type':'Warhorse', #'equipment_mount':{ # }, } #---- # Чародеи: metadict_chars['Sorcerer 1 lvl (otherworld wildfire-novice)'] = { # TODO: Драконья устойчивость даёт +1 hp за уровень, а не только Draconic_Scales. # Поведение бойцов, потому что Burning_Hands для ближнего боя. 'level':1, 'char_class':'Sorcerer', 'hit_dice':'1d6', 'behavior':'elite_warrior', 'class_features':{ #'Feat_Inspiring_Leader':True, # Игнорируем сопротивление к огню. 'Feat_Elemental_Adept':'fire', 'Sorcerous_Origin_Draconic_Bloodline':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Create_Bonfire'), ('cantrip', 'Sword_Burst'), #('cantrip', 'Thunderclap'), #('cantrip', 'Acid_Splash'), #('cantrip', 'Fire_Bolt'), ('1_lvl', 'Shield'), ('1_lvl', 'Burning_Hands'), #('1_lvl', 'Absorb_Elements'), #('1_lvl', 'Magic_Missile'), ], }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Draconic_Scales':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Sorcerer 2 lvl (otherworld wildfire-burner)'] = { 'level':2, 'char_class':'Sorcerer', 'hit_dice':'1d6', 'behavior':'elite_warrior', 'class_features':{ #'Feat_Inspiring_Leader':True, 'Feat_Elemental_Adept':'fire', 'Sorcerous_Origin_Draconic_Bloodline':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Create_Bonfire'), ('cantrip', 'Sword_Burst'), ('1_lvl', 'Shield'), ('1_lvl', 'Burning_Hands'), ('1_lvl', 'Absorb_Elements'), #('1_lvl', 'Magic_Missile'), ], 'Font_of_Magic':True, 'Font_of_Magic_Spellslot_1_lvl':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Draconic_Scales':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Sorcerer 3 lvl (otherworld wildfire-enchanter)'] = { 'level':3, 'fireball_AI':True, #'disengage_AI':True, 'char_class':'Sorcerer', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ # TODO: Metamagic_Twinned_Spell сделай. Нужно же! #'Feat_Inspiring_Leader':True, 'Feat_Elemental_Adept':'fire', 'Sorcerous_Origin_Draconic_Bloodline':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Create_Bonfire'), ('cantrip', 'Sword_Burst'), ('1_lvl', 'Shield'), ('1_lvl', 'Burning_Hands'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Flaming_Sphere'), ], 'Font_of_Magic':True, 'Metamagic':True, 'Metamagic_Distant_Spell':True, 'Metamagic_Twinned_Spell':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Draconic_Scales':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Sorcerer 4 lvl (otherworld wildfire-paragon)'] = { 'level':4, 'fireball_AI':True, #'disengage_AI':True, 'char_class':'Sorcerer', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ #'Feat_Inspiring_Leader':True, 'Feat_Elemental_Adept':'fire', 'Sorcerous_Origin_Draconic_Bloodline':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Create_Bonfire'), ('cantrip', 'Sword_Burst'), ('cantrip', 'Message'), ('1_lvl', 'Shield'), ('1_lvl', 'Burning_Hands'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Flaming_Sphere'), ('2_lvl', 'Mirror_Image'), #('2_lvl', 'Blur'), ], 'Font_of_Magic':True, 'Metamagic':True, 'Metamagic_Distant_Spell':True, 'Metamagic_Twinned_Spell':True, 'Ability_Score_Improvement':{ 'charisma':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Draconic_Scales':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Sorcerer 5 lvl (otherworld wildfire-ravager)'] = { 'level':5, 'fireball_AI':True, #'disengage_AI':True, 'char_class':'Sorcerer', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ #'Feat_Inspiring_Leader':True, 'Feat_Elemental_Adept':'fire', 'Sorcerous_Origin_Draconic_Bloodline':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Create_Bonfire'), ('cantrip', 'Sword_Burst'), ('cantrip', 'Message'), ('1_lvl', 'Shield'), ('1_lvl', 'Burning_Hands'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Mirror_Image'), #('2_lvl', 'Blur'), ('3_lvl', 'Counterspell'), ('3_lvl', 'Fireball'), ], 'Font_of_Magic':True, 'Metamagic':True, 'Metamagic_Distant_Spell':True, 'Metamagic_Twinned_Spell':True, 'Ability_Score_Improvement':{ 'charisma':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Draconic_Scales':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Паладины (конные): # Sefet, wersefet, imeyer metadict_chars['Paladin 1 lvl (city sentry-sefet)'] = { 'level':1, 'char_class':'Paladin', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Divine_Sense':True, 'Lay_on_Hands':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Chain Mail':1, 'Shield':1, 'Lance':1, 'Longsword':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Light Warhorse', 'equipment_mount':{ }, } metadict_chars['Paladin 2 lvl (city sentry-weresefet)'] = { 'level':2, 'char_class':'Paladin', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Divine_Sense':True, 'Lay_on_Hands':True, 'Fighting_Style_Defence':True, #'Fighting_Style_Protection':True, 'Divine_Smite':True, 'Spellcasting':True, 'Spells':[ # Число заклинаний: Charisma modifier + half your paladin level # В среднем 3 заклинания. ('1_lvl', 'Divine_Smite'), ('1_lvl', 'Bless'), ('1_lvl', 'Heroism'), ('1_lvl', 'Shield_of_Faith'), #('1_lvl', 'Searing_Smite'), #('1_lvl', 'Thunderous_Smite'), #('1_lvl', 'Protection_from_Evil_and_Good'), ], }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Chain Mail':1, 'Shield':1, 'Lance':1, 'Longsword':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ }, } metadict_chars['Paladin 3 lvl (city sentry-imeyer)'] = { # TODO: Паладины 3 lvl с "Bless" и "Channel_Sacred_Weapon" имеют мод. атаки 12+ # Это отлично сочетается с "Feat_Great_Weapon_Master" и +10 урона за счёт -5 к атаке. 'level':3, 'char_class':'Paladin', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Divine_Sense':True, 'Lay_on_Hands':True, 'Fighting_Style_Defence':True, #'Fighting_Style_Protection':True, 'Divine_Smite':True, 'Spellcasting':True, 'Spells':[ ('channel', 'Sacred_Weapon'), ('1_lvl', 'Divine_Smite'), ('1_lvl', 'Bless'), ('1_lvl', 'Heroism'), ('1_lvl', 'Shield_of_Faith'), ('1_lvl', 'Protection_from_Evil_and_Good'), ('1_lvl', 'Sanctuary'), ], 'Divine_Health':True, 'Oath_of_Devotion':True, 'Channel_Turn_The_Unholy':True, 'Channel_Sacred_Weapon':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Chain Mail':1, 'Shield':1, 'Lance':1, 'Longsword':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Horse Scale Mail':1, }, } metadict_chars['Paladin 4 lvl (city sentry-sergeant)'] = { 'level':4, 'char_class':'Paladin', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Divine_Sense':True, 'Lay_on_Hands':True, 'Fighting_Style_Defence':True, #'Fighting_Style_Protection':True, 'Divine_Smite':True, 'Spellcasting':True, 'Spells':[ ('channel', 'Sacred_Weapon'), ('1_lvl', 'Divine_Smite'), ('1_lvl', 'Bless'), ('1_lvl', 'Heroism'), ('1_lvl', 'Shield_of_Faith'), ('1_lvl', 'Protection_from_Evil_and_Good'), ('1_lvl', 'Sanctuary'), ], 'Divine_Health':True, 'Oath_of_Devotion':True, 'Channel_Turn_The_Unholy':True, 'Channel_Sacred_Weapon':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Splint Armor':1, 'Shield':1, 'Lance':1, 'Longsword':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Horse Scale Mail':1, }, } metadict_chars['Paladin 5 lvl (city sentry-lieutenant)'] = { # Да уж, паладины могучи. +12-15 мод. атаки с Bless и Sacred_Weapon. 40+ урона/раунд. 'level':5, 'char_class':'Paladin', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Divine_Sense':True, 'Lay_on_Hands':True, 'Fighting_Style_Defence':True, #'Fighting_Style_Protection':True, 'Divine_Smite':True, 'Spellcasting':True, 'Spells':[ ('channel', 'Sacred_Weapon'), ('1_lvl', 'Divine_Smite'), ('2_lvl', 'Divine_Smite'), ('1_lvl', 'Bless'), ('1_lvl', 'Heroism'), ('1_lvl', 'Shield_of_Faith'), ('1_lvl', 'Protection_from_Evil_and_Good'), ('1_lvl', 'Sanctuary'), ('1_lvl', 'Command'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Zone_of_Truth'), ('2_lvl', 'Find_Steed'), #('2_lvl', 'Aid'), #('2_lvl', 'Branding_Smite'), #('2_lvl', 'Magic_Weapon'), ], 'Divine_Health':True, 'Oath_of_Devotion':True, 'Channel_Turn_The_Unholy':True, 'Channel_Sacred_Weapon':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Splint Armor':1, 'Shield':1, 'Lance':1, 'Longsword +1':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Horse Scale Mail':1, }, } #------------------------------------------------------------------------------- # Народы моря, Sea Tribes #---- # Сариссофоры (армия) (Протесилай): metadict_chars['Warrior 1 lvl (Тзаангор) (гипасист)'] = { 'level':1, 'char_class':'Warrior', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Athletics', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Heavy Shield':1, 'Shortsword':1, 'Pike':1, }, } metadict_chars['Warrior 2 lvl (Тзаангор) (ветеран)'] = { 'level':2, 'char_class':'Warrior', 'behavior':'elite_warrior', 'hit_dice':'1d8', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Athletics', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Pike':1, }, } metadict_chars['Warrior 3 lvl (Тзаангор) (ур-лодакос)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Athletics', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Longsword':1, 'Pike':1, }, } metadict_chars['Warrior 4 lvl (Тзаангор) (лодакос)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Magic_Initiate':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Resistance'), ('cantrip', 'Spare_the_Dying'), ('1_lvl', 'Bless'), ], }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Athletics', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Heavy Shield':1, 'Longsword':1, 'Pike':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (Тзаангор) (капитан)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Magic_Initiate':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Resistance'), ('cantrip', 'Spare_the_Dying'), ('1_lvl', 'Bless'), ], 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Athletics', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Longsword':1, 'Pike':1, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Паладины (свита) (Протесилай): metadict_chars['Paladin 1 lvl (Тзаангор) (паладины)'] = { 'level':1, 'char_class':'Paladin', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Divine_Sense':True, 'Lay_on_Hands':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Athletics', 'Intimidation', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Splint Armor':1, 'Heavy Shield':1, 'Battleaxe':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Paladin 5 lvl (Тзаангор) (Протесилай II, «Держатель щита»)'] = { # Клятвопреступник 5 lvl / паладин / человек-дориец / принципиально-злой # https://dungeonmaster.ru/PlayerProfiles.aspx?module=9404 'level':5, 'fearless_AI':True, 'char_class':'Paladin', 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':18, 'dexterity':10, 'constitution':14, 'intelligence':16, 'wisdom':12, 'charisma':18, }, 'class_features':{ 'Feat_Heavy_Armor_Master':True, 'Divine_Sense':True, 'Lay_on_Hands':True, 'Fighting_Style_Defence':True, 'Divine_Smite':True, 'Spellcasting':True, 'Spells':[ # TODO: Допили Героизм и Wrathful_Smite. # Подготовленные заклинания: 10 = 4 ХАР +2 уровень (5/2) +4 Домен ('channel', 'Control_Undead'), ('channel', 'Dreadful_Aspect'), ('ritual', 'Zone_of_Truth'), ('ritual', 'Find_Steed'), ('1_lvl', 'Divine_Smite'), ('2_lvl', 'Divine_Smite'), ('1_lvl', 'Wrathful_Smite'), ('1_lvl', 'Heroism'), ('1_lvl', 'Command'), ('1_lvl', 'Compelled_Duel'), ('1_lvl', 'Hellish_Rebuke)'), ('1_lvl', 'Inflict_Wounds)'), ('2_lvl', 'Crown_of_madness'), ('2_lvl', 'Darkness'), ], 'Divine_Health':True, 'Oathbreaker':True, 'Channel_Control_Undead':True, 'Channel_Dreadful_Aspect':True, 'Feat_Keen_Mind':True, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ # === Strength 'Athletics', # === Dexterity #'Acrobatics', #'Sleight_of_Hand', #'Stealth', # === Intelligence #'Arcana', #'History', #'Investigation', #'Nature', #'Religion', # === Wisdom #'Animal_Handling', 'Insight', #'Medicine', 'Perception', 'Survival', # === Charisma #'Deception', 'Intimidation', #'Performance', #'Persuasion', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':2, #'Rune of Shielding':1, 'Splint Armor':1, 'Heavy Shield':1, #'Shortsword':1, 'Long Spear +1':1, #'Javelin':4, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Дочери медведицы (армия) (Ианта): metadict_chars['Warrior 1 lvl (Vaarsuvius) (дочерь медведицы Филлис)'] = { # Дочери Медведицы [80/80] [1 lvl] [ шкурная броня с медвежьим башкой вместо шлема, Оплон, ромфая, 6 дротиков] сдача 320 денариев 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Stealth', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':3, 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Hide Armor':1, 'Heavy Shield':1, 'Glaive':1, 'Javelin':6, 'Poison Blade':10, }, } metadict_chars['Warrior 2 lvl (Vaarsuvius) (ветеран Филлис)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Stealth', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of False Life':1, 'Infusion of Vitality':1, #'Scale Mail':1, 'Mage_Armor':1, 'Heavy Shield':1, 'Shortsword':1, #'Glaive':1, 'Pilum':12, 'Long Spear':1, 'Poison Blade':40, }, } metadict_chars['Warrior 3 lvl (Vaarsuvius) (сержант Филлис)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Stealth', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of False Life':1, 'Rune of Absorbtion':1, #'Half Plate':1, 'Mage_Armor':1, 'Heavy Shield':1, 'Shortsword':1, #'Glaive':1, 'Pilum':12, 'Long Spear':1, 'Poison Blade':40, }, } metadict_chars['Warrior 4 lvl (Vaarsuvius) (лейтенант Филлис)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, #'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Stealth', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of False Life':1, 'Rune of Absorbtion':1, #'Half Plate':1, 'Mage_Armor':1, 'Heavy Shield':1, 'Shortsword':1, #'Glaive':1, 'Pilum':12, 'Long Spear':1, 'Poison Blade':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (Vaarsuvius) (капитан Филлис)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, #'Fighting_Style_Defence':True, 'Feat_Alert':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Stealth', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of False Life':1, 'Rune of Absorbtion':1, #'Half Plate':1, 'Mage_Armor':1, 'Heavy Shield':1, 'Shortsword':1, #'Glaive':1, 'Pilum':12, 'Long Spear':1, 'Poison Blade':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 7 lvl (Vaarsuvius) (Филлис)'] = { # Сестра Ианты 'level':7, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, #'Fighting_Style_Defence':True, 'Feat_Alert':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Stealth', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of False Life':1, 'Rune of Absorbtion':1, #'Half Plate':1, 'Mage_Armor':1, 'Heavy Shield':1, 'Shortsword':1, #'Glaive':1, 'Pilum':12, 'Long Spear':1, 'Poison Blade':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Ополчение (армия) (Ианта): metadict_chars['Commoner 1 lvl (Vaarsuvius) (охотница)'] = { 'level':1, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Spear':1, 'Hunting Bow':1, 'Hunting Arrow':40, }, } metadict_chars['Commoner 2 lvl (Vaarsuvius) (охотница-ветеран)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Spear':1, 'Hunting Bow':1, 'Hunting Arrow':40, }, } metadict_chars['Warrior 3 lvl (Vaarsuvius) (меткий стрелок-отставник)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':5, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Breastplate':1, 'Dagger':1, 'Shield':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 3 lvl (Vaarsuvius) (сержант Аксиотея)'] = { # Отряд Аксиотеи. 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'fearless_AI':True, 'killer_AI':True, 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':30, 'Infusion of Vitality':1, 'Breastplate':1, 'Dagger':1, 'Shield':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Commoner 1 lvl (Vaarsuvius) (дикарка)'] = { 'level':1, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Hide Armor':1, 'Shield':1, 'Handaxe':1, 'Sling real':1, 'Sling Bullet':10, }, } metadict_chars['Commoner 2 lvl (Vaarsuvius) (дикарка-ветеран)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Hide Armor':1, 'Shield':1, 'Handaxe':1, 'Sling real':1, 'Sling Bullet':10, }, } metadict_chars['Commoner 1 lvl (Vaarsuvius) (токсотай)'] = { 'level':1, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Commoner 2 lvl (Vaarsuvius) (токсотай-ветеран)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, } #---- # Ополчение (армия) (Павсаний): metadict_chars['Commoner 1 lvl (сатир-охотник)'] = { # Сатиры 'level':1, 'char_class':'Commoner', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Satyr', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Spear':1, 'Hunting Bow':1, 'Hunting Arrow':40, }, } metadict_chars['Commoner 2 lvl (сатир-ветеран)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Satyr', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Spear':1, 'Hunting Bow':1, 'Hunting Arrow':40, }, } metadict_chars['Warrior 3 lvl (сатир-сержант)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Satyr', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 4 lvl (сын Павсания)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Inspiring_Leader':True, }, 'race':'Satyr', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } #---- # Лучники (армия) (Ианта): metadict_chars['Warrior 1 lvl (Vaarsuvius) (стрелок)'] = { # Амазонки Ианты 'level':1, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':1, 'Potion of Antidote':1, 'Leather Armor':1, 'Dagger':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 2 lvl (Vaarsuvius) (стрелок-ветеран)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':1, 'Potion of Antidote':1, 'Scale Mail':1, 'Dagger':1, 'Shield':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 3 lvl (Vaarsuvius) (меткий стрелок)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':5, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Breastplate':1, 'Dagger':1, 'Shield':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 4 lvl (Vaarsuvius) (стрелок-лейтенант)'] = { 'level':4, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Dagger':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (Vaarsuvius) (стрелок-капитан)'] = { 'level':5, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Shield':1, 'Dagger':1, 'Longbow':1, 'Arrow':40, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{}, } #---- # Друиды (свита) (Ианта): metadict_chars['Druid 2 lvl (Vaarsuvius) (друид Ианты)'] = { 'level':2, 'char_class':'Druid', 'abilityes_choice':['wisdom','dexterity','constitution','intelligence','charisma','strength'], 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Druidcraft'), ('cantrip', 'Mold_Earth'), ('ritual', 'Speak_with_Animals'), ('1_lvl', 'Goodberry'), #('1_lvl', 'Cure_Wounds'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Entangle'), ('1_lvl', 'Fog_Cloud'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Wild_Shape_Form':'Brown Bear (CR 1)', #'Wild_Shape_Form':'Giant Octopus (CR 1)', 'Druid_Circle_Moon':True, 'Combat_Wild_Shape':True, 'Circle_Forms':True, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'skills':[ 'Nature', 'Animal_Handling', 'Medicine', 'Perception', 'Survival', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':20, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, }, #'mount_combat':True, #'mount_type':'Warhorse', #'equipment_mount':{ # }, } metadict_chars['Druid 2 lvl (Vaarsuvius) (друид Ианты) (Агата)'] = { # Погибла в "Битве за Лемнос". Реинкарнирована в дракона. Повезло. 'level':2, 'seeker_AI':True, 'killer_AI':True, 'changer_AI':True, 'fearless_AI':True, 'char_class':'Druid', 'abilityes':{ 'strength':10, 'dexterity':14, 'constitution':13, 'intelligence':12, 'wisdom':15, 'charisma':12, }, 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Druidcraft'), ('cantrip', 'Mold_Earth'), ('ritual', 'Speak_with_Animals'), ('1_lvl', 'Goodberry'), #('1_lvl', 'Cure_Wounds'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Entangle'), ('1_lvl', 'Fog_Cloud'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Wild_Shape_Form':'Brown Bear (CR 1)', #'Wild_Shape_Form':'Giant Octopus (CR 1)', 'Druid_Circle_Moon':True, 'Combat_Wild_Shape':True, 'Circle_Forms':True, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'skills':[ 'Nature', 'Animal_Handling', 'Medicine', 'Perception', 'Survival', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':20, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, }, #'mount_combat':True, #'mount_type':'Warhorse', #'equipment_mount':{ # }, } metadict_chars['Brass Dragon, (Vaarsuvius) (Агаталара Огненная)'] = { # Реинкарнация Агаты # Молодой латунный дракон 'level':13, #'Dash_AI':True, 'fearless_AI':True, 'disengage_AI':True, 'recharge_AI':True, #'accurate_AI':True, 'no_grappler_AI':True, 'air_walk':True, 'armor_class_natural':17, 'challenge_rating':'6', 'char_class':'Sorcerer', 'behavior':'commander', 'hitpoints_medial':True, 'class_features':{ 'Extra_Attack':2, 'immunity':['fire'], 'Blindvision':30, 'Darkvision':120, 'Recharge':True, 'Recharge_dice':'1d6', 'Recharge_numbers':[5,6], # Способности Агаты: 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Druidcraft'), #('cantrip', 'Mold_Earth'), ('ritual', 'Speak_with_Animals'), #('1_lvl', 'Goodberry'), #('1_lvl', 'Cure_Wounds'), #('1_lvl', 'Healing_Word'), ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Fog_Cloud'), ], 'Druidic_Language':True, 'Wild_Shape':True, #'Wild_Shape_Form':'Brown Bear (CR 1)', #'Wild_Shape_Form':'Giant Octopus (CR 1)', 'Druid_Circle_Moon':True, 'Combat_Wild_Shape':True, 'Circle_Forms':True, }, 'abilityes':{ 'strength':19, 'dexterity':10, 'constitution':17, # Характеристики Агаты: 'intelligence':12, 'wisdom':15, 'charisma':12, }, 'hit_dice':'1d10', 'attacks':{ ('close', 'claws'): { 'attack_mod':7, 'damage_mod':4, 'weapon': False, 'weapon_type':['simple'], 'damage_type':'slashing', 'damage_dice':'2d6', 'attack_range':5, 'attack_type':'close', 'weapon_skills_use': ['simple'], 'attack_mod_type':'strength', 'weapon_of_choice':'claws', }, ('reach', 'bite'): { 'attack_mod':7, 'damage_mod':4, 'weapon': False, 'weapon_type':['simple'], 'damage_type':'piercing', 'damage_dice':'2d10', 'attack_range':10, 'attack_type':'close', 'weapon_skills_use': ['simple'], 'attack_mod_type':'strength', 'weapon_of_choice':'bite' }, ('zone', 'Unconscious'): { 'zone':True, 'debuff':True, 'effect':'sleep', 'effect_timer':100, 'zone_shape':'cone', 'attack_range':30, 'direct_hit':True, 'savethrow':True, 'savethrow_ability':'constitution', 'casting_time':'action', 'spell_save_DC':14, 'recharge': True, 'ammo':1, 'weapon_of_choice':'Unconscious' }, ('zone', 'Fire_Ray'): { 'zone':True, 'accurate':True, 'zone_shape':'ray', 'attack_range':40, 'direct_hit':True, 'savethrow':True, 'savethrow_ability':'dexterity', 'casting_time':'action', 'damage_type':'fire', 'damage_dice':'12d6', 'spell_save_DC':14, 'recharge': True, 'ammo':1, }, }, 'race':'Dragon-big', 'weapon_skill':[], 'armor_skill':[], 'equipment_weapon':{ 'Goodberry':100, 'Potion of Antidote':1, 'Infusion of Regeneration':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, }, 'equipment_backpack':{}, 'equipment_supply':{}, } metadict_chars['Druid 2 lvl (Vaarsuvius) (друид Ианты) (Психея)'] = { # Глава "Подводной стражи" Агаты, 45 лет, лицо в шрамах, садист. 'level':2, 'killer_AI':True, 'changer_AI':True, 'char_class':'Druid', 'abilityes':{ 'strength':12, 'dexterity':17, 'constitution':17, 'intelligence':15, 'wisdom':18, 'charisma':14, }, 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Druidcraft'), ('cantrip', 'Mold_Earth'), ('ritual', 'Speak_with_Animals'), ('1_lvl', 'Goodberry'), #('1_lvl', 'Cure_Wounds'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Entangle'), ('1_lvl', 'Fog_Cloud'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Wild_Shape_Form':'Brown Bear (CR 1)', #'Wild_Shape_Form':'Giant Octopus (CR 1)', 'Druid_Circle_Moon':True, 'Combat_Wild_Shape':True, 'Circle_Forms':True, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'skills':[ 'Nature', 'Animal_Handling', 'Medicine', 'Perception', 'Survival', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':20, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, }, #'mount_combat':True, #'mount_type':'Warhorse', #'equipment_mount':{ # }, } metadict_chars['Druid 7 lvl (Vaarsuvius) (Ианта «Дочь бури»)'] = { 'level':7, 'changer_AI':True, 'char_class':'Druid', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, #'hitpoints_base':8 + 19, 'abilityes':{ 'strength':10, 'dexterity':14, 'constitution':16, 'intelligence':12, 'wisdom':20, 'charisma':16, }, 'class_features':{ #'Feat_Inspiring_Leader':True, 'Feat_Sharpshooter':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Druidcraft'), ('cantrip', 'Thorn_Whip'), ('cantrip', 'Shape_Water'), ('ritual', 'Detect_Magic'), ('ritual', 'Speak_with_Animals'), ('ritual', 'Beast_Sense'), ('ritual', 'Water_Breathing'), ('ritual', 'Water_Walk'), ('1_lvl', 'Jump'), ('2_lvl', 'Moonbeam'), ('2_lvl', 'Pass_Without_Trace'), ('2_lvl', 'Flaming_Sphere'), ('3_lvl', 'Call_Lightning'), ('3_lvl', 'Conjure_Animals'), ('3_lvl', 'Dispel_Magic'), #('3_lvl', 'Plant_Growth'), ('4_lvl', 'Polymorph'), ('4_lvl', 'Conjure_Woodlands_Beings'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Wild_Shape_Form':'Giant Elk (CR 2)', #'Wild_Shape_Form':'Brown Bear (CR 1)', #'Wild_Shape_Form':'Giant Octopus (CR 1)', 'Druid_Circle_Moon':True, 'Combat_Wild_Shape':True, 'Wild_Shape_Improvement':True, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'skills':[ # Учится "Убеждению", забивает на "Уход за животными". # === Intelligence 'Nature', # === Wisdom 'Animal_Handling', #'Insight', 'Medicine', 'Perception', 'Survival', # === Charisma #'Deception', #'Intimidation', #'Performance', 'Persuasion', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Longbow +1':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Warhorse', #'equipment_mount':{ # }, } #---- # Бойцы (свита) (Артаманах): metadict_chars['Fighter 1 lvl (ArbitraryNickname) (снайпер)'] = { # Снайперы, корректируют "Град стрел" ополчения. 'level':1, 'char_class':'Battlemaster', 'abilityes_choice':['dexterity','constitution','strength','charisma'], 'hit_dice':'1d10', 'behavior':'archer', 'class_features':{ 'Feat_Sharpshooter':True, 'Fighting_Style_Archery':True, 'Second_Wind':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Perception', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Armor':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Fighter 5 lvl (ArbitraryNickname) (Артаманах Рыбник)'] = { # Лучник, мастер боевых искусств 'level':5, 'char_class':'Battlemaster', 'abilityes_choice':['dexterity','constitution','strength','charisma'], 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':12, 'dexterity':20, 'constitution':12, 'intelligence':15, 'wisdom':10, 'charisma':16, }, 'class_features':{ # Сложные в реализации "Атака с манёвром" и "Удар командира" # Заменяются на "Точная атака" и "Атака с угрозой" 'Feat_Sharpshooter':True, 'Fighting_Style_Archery':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Battlemaster':True, 'Combat_Superiority':True, 'Student_of_War':True, #'Commander\'s_Strike':True, #'Maneuvering_Attack':True, 'Parry':True, 'Menacing_Attack':True, 'Precision_Attack':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shield':1, 'Longbow +1':1, 'Scimitar':1, 'Dagger':1, 'Arrow':40, }, } #---- # Жрецы (свита) (Патрокл «Македонянин»): # Жрецы -- домен войны: metadict_chars['Cleric 2 lvl (Vened) (жрец Патрокла)'] = { 'level':2, 'char_class':'Cleric', 'abilityes_choice':['wisdom','strength','constitution','charisma'], 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ # Даём халявный Feat_Heavy_Armor_Master, потому что большим созданиям нелегко. 'Feat_Inspiring_Leader':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mend'), ('cantrip', 'Sacred_Flame'), ('cantrip', 'Spare_the_Dying'), ('ritual', 'Detect_Poison_and_Disease'), ('ritual', 'Purify_Food_and_Drink'), #('ritual', 'Detect_Magic'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Bless'), ('1_lvl', 'Guiding_Bolt'), #('1_lvl', 'Shield_of_Faith'), ], 'War_Domain':True, 'War_Priest':True, }, 'race':'Human-hero-big', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':10, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Plate Armor':1, 'Heavy Shield':1, 'Long Spear':1, 'Longsword':1, }, # TODO: ездовые животные -- волы #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 7 lvl (Vened) (Патрокл «Македонянин»)'] = { 'level':7, 'fireball_AI':True, 'char_class':'Cleric', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, #'hitpoints_base':8 + 18 + 4, 'abilityes':{ 'strength':19, 'dexterity':10, 'constitution':12, 'intelligence':10, 'wisdom':18, 'charisma':18, }, 'class_features':{ # TODO: Channel_Guided_Strike 'Feat_Inspiring_Leader':True, 'Feat_Heavy_Armor_Master':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mend'), ('cantrip', 'Thaumaturgy'), ('cantrip', 'Sacred_Flame'), ('cantrip', 'Spare_the_Dying'), ('ritual', 'Water_Walk'), ('ritual', 'Purify_Food_and_Drink'), ('1_lvl', 'Guiding_Bolt'), #('1_lvl', 'Shield_of_Faith'), ('1_lvl', 'Healing_Word'), ('2_lvl', 'Magic_Weapon'), ('2_lvl', 'Spiritual_Weapon'), ('2_lvl', 'Gentle_Repose'), ('2_lvl', 'Zone_of_Truth'), #('3_lvl', 'Spirit_Guardians'), ('3_lvl', 'Crusaders_Mantle'), ('3_lvl', 'Dispel_Magic'), ('3_lvl', 'Revivify'), #('3_lvl', 'Glyph_of_Warding'), ('4_lvl', 'Divination'), ('4_lvl', 'Stone_Shape'), ('4_lvl', 'Freedom_of_Movement'), ('4_lvl', 'Stoneskin'), ], 'War_Domain':True, 'War_Priest':True, 'Channel_Turn_Undead':True, 'Channel_Guided_Strike':True, }, 'race':'Human-hero-big', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':10, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Plate Armor':1, 'Heavy Shield':1, 'Long Spear':1, 'Longsword +1':1, }, # TODO: ездовые животные -- волы #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Жрецы (свита) (Патрокл «Македонянин»): metadict_chars['Druid 2 lvl (Vened) (друид Патрокла)'] = { 'level':2, 'char_class':'Druid', 'abilityes_choice':['wisdom','strength','constitution','intelligence'], 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ # Число заклинаний -- мод_мудрости + уровень_друида: ('cantrip', 'Druidcraft'), ('cantrip', 'Thorn_Whip'), ('1_lvl', 'Thunderwave'), ('1_lvl', 'Goodberry'), ('1_lvl', 'Healing_Word'), #('1_lvl', 'Fog_Cloud'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Wild_Shape_Form':'Brown Bear (CR 1)', #'Wild_Shape_Form':'Giant Octopus (CR 1)', 'Druid_Circle_Moon':True, 'Combat_Wild_Shape':True, 'Circle_Forms':True, }, 'race':'Human-hero-big', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':10, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Plate Armor':1, 'Heavy Shield':1, 'Longsword':1, 'Long Spear':1, }, # TODO: ездовые животные -- волы #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Druid 7 lvl (Vened) (Брат Патрокла)'] = { 'level':7, 'fireball_AI':True, 'char_class':'Druid', 'abilityes_choice':['wisdom','strength','constitution','intelligence'], 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':20, 'dexterity':10, 'constitution':12, 'intelligence':18, 'wisdom':18, 'charisma':10, }, 'class_features':{ 'Feat_Healer':True, 'Feat_Heavy_Armor_Master':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Thorn_Whip'), ('cantrip', 'Mend'), ('cantrip', 'Druidcraft'), #('ritual', 'Speak_with_Animals'), #('ritual', 'Water_Breathing'), ('ritual', 'Water_Walk'), ('1_lvl', 'Thunderwave'), ('1_lvl', 'Goodberry'), #('1_lvl', 'Cure_Wounds'), ('1_lvl', 'Healing_Word'), ('2_lvl', 'Heat_Metal'), ('2_lvl', 'Flame_Blade'), ('2_lvl', 'Spike_Growth'), ('3_lvl', 'Dispel_Magic'), ('3_lvl', 'Wind_Wall'), ('3_lvl', 'Conjure_Animals'), ('4_lvl', 'Conjure_Woodlands_Beings'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Wild_Shape_Form':'Brown Bear (CR 1)', #'Wild_Shape_Form':'Giant Octopus (CR 1)', 'Druid_Circle_Moon':True, 'Combat_Wild_Shape':True, 'Wild_Shape_Improvement':True, }, 'race':'Human-hero-big', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':10, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Absorbtion':1, 'Plate Armor':1, 'Heavy Shield':1, 'Longsword +1':1, 'Long Spear':1, }, # TODO: ездовые животные -- волы #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Сариссофоры (армия) (Патрокл «Македонянин»): metadict_chars['Warrior 1 lvl (Vened) (сариссофор Патрокла)'] = { 'level':1, 'char_class':'Warrior', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':1, 'Potion of Bravery':1, 'Potion of Antidote':1, 'Chain Shirt':1, 'Shortsword':1, 'Heavy Shield':1, 'Pike':1, }, } metadict_chars['Warrior 2 lvl (Vened) (ветеран Патрокла)'] = { 'level':2, 'char_class':'Warrior', 'behavior':'elite_warrior', 'hit_dice':'1d8', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # Длинные копья для подводного боя: 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of False Life':1, 'Infusion of Vitality':1, 'Scale Mail':1, 'Shortsword':1, 'Heavy Shield':1, #'Pike':1, 'Long Spear':1, }, } metadict_chars['Warrior 3 lvl (Vened) (сержант Патрокла)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of False Life':1, 'Infusion of Vitality':1, 'Half Plate':1, 'Shortsword':1, 'Heavy Shield':1, #'Pike':1, 'Long Spear':1, }, } metadict_chars['Warrior 4 lvl (Vened) (лейтенант Патрокла)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of False Life':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Half Plate':1, 'Shortsword':1, 'Heavy Shield':1, #'Pike':1, 'Long Spear':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (Vened) (капитан Патрокла)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Shortsword':1, 'Heavy Shield':1, #'Pike':1, 'Long Spear':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Жрецы (свита) (Фарам «Друг богов»): metadict_chars['Cleric 2 lvl (Mordodrukow) (жрец Фарама) (боевой)'] = { # Домен бури. 'level':2, 'char_class':'Cleric', 'abilityes_choice':['wisdom','strength','constitution','dexterity'], 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Spellcasting':True, 'Spells':[ ('channel', 'Wrath_of_the_Storm'), ('cantrip', 'Mend'), ('cantrip', 'Sacred_Flame'), ('cantrip', 'Word_of_Radiance'), ('ritual', 'Detect_Magic'), ('1_lvl', 'Create_or_Destroy_Water'), ('1_lvl', 'Thunderwave'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Bless'), #('1_lvl', 'Shield_of_Faith'), ], 'Tempest_Domain':True, 'Wrath_of_the_Storm':True, 'Channel_Destructive_Wrath':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Plate Armor':1, 'Heavy Shield':1, 'Longsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 2 lvl (Mordodrukow) (жрец Фарама) (лекарь)'] = { 'level':2, 'char_class':'Cleric', 'abilityes_choice':['wisdom','strength','constitution','dexterity'], 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('channel', 'Wrath_of_the_Storm'), ('cantrip', 'Mend'), ('cantrip', 'Sacred_Flame'), ('cantrip', 'Spare_the_Dying'), ('ritual', 'Detect_Magic'), ('1_lvl', 'Create_or_Destroy_Water'), ('1_lvl', 'Thunderwave'), ('1_lvl', 'Healing_Word'), #('1_lvl', 'Bless'), ('1_lvl', 'Shield_of_Faith'), ], 'Tempest_Domain':True, 'Wrath_of_the_Storm':True, 'Channel_Destructive_Wrath':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Plate Armor':1, 'Heavy Shield':1, 'Longsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Fighter 2 lvl (Mordodrukow) (темплар Фарама)'] = { 'level':2, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Fighting_Style_Defence':True, 'Second_Wind':True, 'Action_Surge':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Plate Armor':1, 'Heavy Shield':1, 'Longsword':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Fighter 2 lvl (Mordodrukow) (снайпер Фарама)'] = { 'level':2, 'archer_AI':True, 'char_class':'Battlemaster', 'abilityes_choice':['dexterity','constitution','strength'], 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Sharpshooter':True, 'Fighting_Style_Archery':True, 'Second_Wind':True, 'Action_Surge':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Perception', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Half Plate':1, 'Shield':1, 'Scimitar':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Fighter 7 lvl (Mordodrukow) (Лонгин)'] = { # Лучник, мастер боевых искусств 'level':7, 'killer_AI':True, 'archer_AI':True, 'commando_AI':True, 'squad_advantage':True, 'char_class':'Battlemaster', 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':13, 'dexterity':20, 'constitution':18, 'intelligence':10, 'wisdom':18, 'charisma':10, }, 'class_features':{ # TODO: отталкивающая атака вместо Menacing_Attack. 'Feat_Resilient':'dexterity', 'Feat_Sharpshooter':True, 'Fighting_Style_Archery':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Battlemaster':True, 'Combat_Superiority':True, 'Student_of_War':True, 'Parry':True, 'Menacing_Attack':True, 'Precision_Attack':True, 'Extra_Attack':True, 'Spellcasting':True, 'Feat_Magic_Initiate':True, 'Spells':[ ('cantrip', 'Minor_Illusion'), ('cantrip', 'Blade_Ward'), ('1_lvl', 'Hex'), ], }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Heroism':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Studded Leather':1, 'Heavy Shield':1, 'Longbow +1':1, 'Scimitar':1, 'Arrow':120, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Cleric 7 lvl (Mordodrukow) (Фарам «Друг Богов»)'] = { 'level':7, 'killer_AI':True, 'commando_AI':True, 'fireball_AI':True, 'squad_advantage':True, 'char_class':'Cleric', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':18, 'dexterity':10, 'constitution':20, 'intelligence':10, 'wisdom':18, 'charisma':14, }, 'class_features':{ 'Feat_Resilient':'constitution', 'Spellcasting':True, 'Spells':[ ('channel', 'Wrath_of_the_Storm'), ('cantrip', 'Guidance'), ('cantrip', 'Thaumaturgy'), ('cantrip', 'Sacred_Flame'), ('cantrip', 'Word_of_Radiance'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Thunderwave'), ('2_lvl', 'Gust_of_Wind'), ('2_lvl', 'Shatter'), ('2_lvl', 'Aid'), ('2_lvl', 'Hold_Person'), ('2_lvl', 'Spiritual_Weapon'), ('2_lvl', 'Warding_Bond'), #('3_lvl', 'Call_Lightning'), ('3_lvl', 'Sleet_Storm'), ('3_lvl', 'Clairvoyance'), ('3_lvl', 'Dispel_Magic'), ('3_lvl', 'Sending'), ('3_lvl', 'Spirit_Guardians'), ('3_lvl', 'Water_Walk'), ('4_lvl', 'Ice_Storm'), ('4_lvl', 'Control_Water'), ('4_lvl', 'Divination'), ('4_lvl', 'Stone_Shape'), ], 'Tempest_Domain':True, 'Wrath_of_the_Storm':True, 'Channel_Turn_Undead':True, 'Channel_Destructive_Wrath':True, 'Feat_Heavy_Armor_Master':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ # === Strength 'Athletics', # === Intelligence 'Religion', # === Wisdom 'Insight', 'Medicine', 'Perception', # === Charisma 'Persuasion', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # TODO: жезл +1, увеличивает сложность спасброска заклинаний. #'Infusion of Vitality':1, 'Potion of Antidote':1, 'Infusion of Heroism':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Plate Armor':1, 'Heavy Shield':1, 'Longsword +1':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Лучники (армия) (Фарам): metadict_chars['Warrior 1 lvl (Mordodrukow) (лучник Фарама)'] = { 'level':1, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Studded Leather':1, 'Dagger':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 2 lvl (Mordodrukow) (ветеран Фарама)'] = { 'level':2, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Studded Leather':1, 'Dagger':1, 'Shield':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 3 lvl (Mordodrukow) (сержант Фарама)'] = { 'level':3, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Breastplate':1, 'Scimitar':1, 'Shield':1, 'Longbow':1, 'Arrow':40, }, } metadict_chars['Warrior 4 lvl (Mordodrukow) (лейтенант Фарама)'] = { 'level':4, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Absorbtion':1, 'Half Plate':1, 'Shield':1, 'Scimitar':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (Mordodrukow) (капитан Фарама)'] = { 'level':5, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Shield':1, 'Scimitar':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{}, } #---- # Бойцы (свита) (Гай Юлий): metadict_chars['Fighter 1 lvl (Katorjnik) (преторианец Гая Юлия)'] = { # Преторианцы, всадники. 'level':1, 'char_class':'Fighter', 'abilityes_choice':['strength','charisma','constitution','wisdom'], 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ # Халявный Feat_Mounted_Combatant: 'Feat_Inspiring_Leader':True, 'Feat_Mounted_Combatant':True, 'Fighting_Style_Protection':True, 'Second_Wind':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Splint Armor':1, 'Shield':1, 'Longsword':1, 'Lance':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ }, } metadict_chars['Fighter 2 lvl (Katorjnik) (преторианец Гая Юлия)'] = { # Преторианцы, всадники. 'level':2, 'char_class':'Fighter', 'abilityes_choice':['strength','charisma','constitution','wisdom'], 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ # Халявный Feat_Mounted_Combatant: 'Feat_Inspiring_Leader':True, 'Feat_Mounted_Combatant':True, 'Fighting_Style_Protection':True, 'Second_Wind':True, 'Action_Surge':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Plate Armor':1, 'Heavy Shield':1, 'Longsword':1, 'Lance':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Horse Scale Mail':1, }, } metadict_chars['Fighter 7 lvl (Katorjnik) (Гай Юлий)'] = { 'level':7, 'char_class':'Fighter', 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':20, 'dexterity':10, 'constitution':14, 'intelligence':14, 'wisdom':18, 'charisma':16, }, 'class_features':{ 'Feat_Inspiring_Leader':True, 'Feat_Mounted_Combatant':True, 'Fighting_Style_Protection':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Champion':True, 'Champion_Improved_Critical':True, 'Feat_Heavy_Armor_Master':True, 'Extra_Attack':True, 'Remarkable_Athlete':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Infusion of Regeneration':1, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Plate Armor':1, 'Heavy Shield':1, 'Sword of Life-Stealing':1, #'Longsword +1':1, 'Lance':1, 'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Horse Scale Mail':1, }, } #---- # Легионеры (армия) (Гай Юлий): metadict_chars['Warrior 1 lvl (Katorjnik) (манипуларий)'] = { # Исторически носили по 2 пилума, но шесть весомее (вот только пехота столько не унесёт). 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Studded Leather':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':7, }, } metadict_chars['Warrior 2 lvl (Katorjnik) (ветеран) (кольчуга)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'class_features':{ 'Fighting_Style_Protection':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Chain Shirt':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':7, }, } metadict_chars['Warrior 2 lvl (Katorjnik) (ветеран)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Protection':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Scale Mail':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':2, }, } metadict_chars['Warrior 3 lvl (Katorjnik) (урагос)'] = { # Десятник (декан, урагос) 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':7, }, } metadict_chars['Warrior 4 lvl (Katorjnik) (опцион)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':7, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (Katorjnik) (центурион)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', #'carefull_AI':True, 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':3, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Следопыты (свита) (Сакатр Ка'Ален): metadict_chars['Ranger 2 lvl (Gogan) (следопыт Сакатра)'] = { 'level':2, 'char_class':'Ranger', 'hit_dice':'1d10', 'behavior':'archer', 'class_features':{ 'Feat_Sharpshooter':True, 'Favored_Enemy':['humans'], 'Natural_Explorer':['sea'], 'Spellcasting':True, 'Spells':[ ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Hail_of_Thorns'), ], 'Fighting_Style_Archery':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':5, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Infusion of Longstrider':1, 'Rune of Absorbtion':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Ranger 7 lvl (Gogan) (Сакатр Ка-Ален)'] = { 'level':7, 'brave_AI':True, 'archer_AI':True, #'killer_AI':True, 'char_class':'Ranger', 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':11, 'dexterity':20, 'constitution':14, 'intelligence':14, 'wisdom':16, 'charisma':17, }, 'class_features':{ # TODO: Сделай Hunter_Steel_Will -- преимущество на спасброски против испуга 'Feat_Sharpshooter':True, 'Favored_Enemy':['humans', 'sea_monsters'], 'Natural_Explorer':['sea', 'coast'], 'Spellcasting':True, 'Spells':[ # TODO: сделай Spike_Growth ('ritual', 'Animal_Messenger'), ('1_lvl', 'Goodberry'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Hail_of_Thorns'), ('2_lvl', 'Pass_Without_Trace'), #('2_lvl', 'Spike_Growth'), ], 'Fighting_Style_Archery':True, 'Primeval_Awareness':True, 'Ranger_Archetype_Hunter':True, 'Hunter_Horde_Breaker':True, 'Hunter_Steel_Will':True, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':15, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Infusion of Longstrider':1, 'Rune of Shielding':1, 'Studded Leather':1, 'Shield':1, 'Scimitar':1, 'Longbow +1':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Пираты (армия) (Сакатр Ка'Ален): metadict_chars['Warrior 1 lvl (Gogan) (кимерийский пират)'] = { 'level':1, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 2 lvl (Gogan) (кимерийский пират-ветеран)'] = { 'level':2, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Scale Mail':1, 'Shield':1, 'Rapier':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 3 lvl (Gogan) (кимерийский пират-сержант)'] = { 'level':3, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Rapier':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 4 lvl (Gogan) (кимерийский пират-лейтенант)'] = { 'level':4, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Rapier':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (Gogan) (кимерийский пират-капитан)'] = { 'level':5, #'volley_AI':True, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Rapier':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Враги (герои) (кара'Ям): metadict_chars['Warlock 1 lvl (колдун Кара\'Яма)'] = { 'level':1, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Create_Bonfire'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Burning_Hands'), ('1_lvl', 'Hex'), ], 'Dark_One\'s_Blessing':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Horseclaw', 'equipment_mount':{ }, } metadict_chars['Warlock 5 lvl (Кара\'Ям)'] = { # Свободно накладывает на себя смену облика: Invocation_Mask_of_Many_Faces # Игнорирует сопротивление огню: Feat_Elemental_Adept 'level':5, 'fireball_AI':True, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':10, 'dexterity':18, 'constitution':14, 'intelligence':16, 'wisdom':8, 'charisma':18, }, 'class_features':{ 'Feat_Mounted_Combatant':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ # Unseen_Servant для разминирования. Для учеников. # Burning_Hands для учеников. # TODO: Сделай Green_Flame_Blade. ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Create_Bonfire'), ('cantrip', 'Minor_Illusion'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('3_lvl', 'Burning_Hands'), ('3_lvl', 'Invisibility'), ('3_lvl', 'Suggestion'), ('3_lvl', 'Earthbind'), ('3_lvl', 'Fireball'), ('3_lvl', 'Fly'), ], 'Dark_One\'s_Blessing':True, 'Eldritch_Invocations':True, 'Invocation_Eldritch_Spear':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Mask_of_Many_Faces':True, 'Pact_Boon':True, 'Pact_of_the_Blade':True, 'Feat_Elemental_Adept':'fire', }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # Добряника от друида Тик-Бо: # Договор клинка, оружие +1. 'Goodberry':30, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shortsword +1':1, 'Shortbow +1':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Horseclaw', 'equipment_mount':{ }, } #---- # Враги (герои) (Кема'Эш): metadict_chars['Warlock 1 lvl (колдун Кема\'Эша)'] = { 'level':1, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Create_Bonfire'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Burning_Hands'), ('1_lvl', 'Hex'), ], 'Dark_One\'s_Blessing':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Horseclaw', 'equipment_mount':{ }, } metadict_chars['Warlock 5 lvl (Кема\'Эш)'] = { # Атакует издалека: Invocation_Eldritch_Spear. # Воодушевляет своих: Feat_Inspiring_Leader. # Передаёт команды с помощью Dancing_Lights и Message. 'level':5, 'fireball_AI':True, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':10, 'dexterity':16, 'constitution':12, 'intelligence':14, 'wisdom':16, 'charisma':18, }, 'class_features':{ 'Feat_Mounted_Combatant':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Minor_Illusion'), ('cantrip', 'Prestidigitation'), ('cantrip', 'Dancing_Lights'), ('cantrip', 'Message'), ('ritual', 'Detect_Magic'), ('ritual', 'Identify'), ('3_lvl', 'Charm_Person'), ('3_lvl', 'Hex'), ('3_lvl', 'Burning_Hands'), ('3_lvl', 'Summon_Lesser_Demons'), ('3_lvl', 'Fly'), ], 'Dark_One\'s_Blessing':True, 'Eldritch_Invocations':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Eldritch_Spear':True, 'Invocation_Book_of_Ancient_Secrets':True, 'Pact_Boon':True, 'Pact_of_the_Tome':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':30, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Dagger':1, 'Shortbow +1':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Horseclaw', 'equipment_mount':{ }, } #---- # Враги (герои) (Энзиф): metadict_chars['Ranger 1 lvl (следопыт Энзифа)'] = { 'level':1, 'char_class':'Ranger', 'hit_dice':'1d10', 'behavior':'archer', 'class_features':{ 'Feat_Sharpshooter':True, 'Favored_Enemy':['humans'], 'Natural_Explorer':['forest'], }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Ranger 5 lvl (Энзиф «Ходи-гора»)'] = { 'level':5, 'char_class':'Ranger', 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':18, 'dexterity':18, 'constitution':16, 'intelligence':8, 'wisdom':12, 'charisma':14, }, 'class_features':{ 'Feat_Sharpshooter':True, 'Favored_Enemy':['humans'], 'Natural_Explorer':['forest'], 'Spellcasting':True, 'Spells':[ ('ritual', 'Animal_Messenger'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Pass_Without_Trace'), ('2_lvl', 'Find_Traps'), ('2_lvl', 'Spike_Growth'), ], 'Fighting_Style_Archery':True, 'Primeval_Awareness':True, 'Ranger_Archetype_Hunter':True, 'Hunter_Horde_Breaker':True, 'Feat_Great_Weapon_Master':True, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Longbow +1':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Враги (герои) (Магор): metadict_chars['Paladin 1 lvl (паладин Магора)'] = { 'level':1, 'char_class':'Paladin', 'hit_dice':'1d10', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Tough':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Divine_Sense':True, 'Lay_on_Hands':True, }, 'race':'Human-hero-big', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Splint Armor':1, 'Heavy Shield':1, 'Flait':1, 'Long Spear':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Paladin 5 lvl (Магор «Детоед»)'] = { 'level':5, 'char_class':'Paladin', 'hit_dice':'1d10', 'behavior':'commander', #'fearless_AI':True, 'killer_AI':True, 'hitpoints_medial':True, 'abilityes':{ 'strength':18, 'dexterity':10, 'constitution':18, 'intelligence':10, 'wisdom':12, 'charisma':18, }, 'class_features':{ 'Feat_Tough':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+3, }, 'Divine_Sense':True, 'Lay_on_Hands':True, 'Fighting_Style_Defence':True, 'Divine_Smite':True, 'Spellcasting':True, 'Spells':[ ('channel', 'Sacred_Weapon'), ('1_lvl', 'Divine_Smite'), ('2_lvl', 'Divine_Smite'), ('1_lvl', 'Bless'), ('1_lvl', 'Heroism'), ('1_lvl', 'Shield_of_Faith'), ('1_lvl', 'Protection_from_Evil_and_Good'), ('1_lvl', 'Sanctuary'), ('1_lvl', 'Command'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Zone_of_Truth'), ('2_lvl', 'Find_Steed'), ], 'Divine_Health':True, 'Oath_of_Devotion':True, 'Channel_Turn_The_Unholy':True, 'Channel_Sacred_Weapon':True, 'Extra_Attack':True, }, 'race':'Human-hero-big', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':2, 'Rune of Absorbtion':1, 'Splint Armor':1, 'Heavy Shield':1, 'Flait +1':1, 'Long Spear':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Враги (герои) (Хана'Вам): metadict_chars['Fighter 1 lvl (снайпер Хана\'Вама)'] = { # Снайперы, корректируют "Град стрел" ополчения. 'level':1, 'char_class':'Battlemaster', 'abilityes_choice':['dexterity','constitution','strength','charisma'], 'hit_dice':'1d10', 'behavior':'archer', 'class_features':{ 'Feat_Sharpshooter':True, 'Fighting_Style_Archery':True, 'Second_Wind':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ 'Perception', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Armor':1, 'Shield':1, 'Shortsword':1, 'Longbow':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } metadict_chars['Fighter 5 lvl (Хана\'Вам)'] = { # Лучник-чемпион 'level':5, 'char_class':'Battlemaster', 'abilityes_choice':['dexterity','constitution','strength','charisma'], 'hit_dice':'1d10', 'behavior':'commander', 'killer_AI':True, 'hitpoints_medial':True, 'abilityes':{ 'strength':12, 'dexterity':20, 'constitution':12, 'intelligence':16, 'wisdom':10, 'charisma':16, }, 'class_features':{ 'Feat_Sharpshooter':True, 'Fighting_Style_Archery':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Champion':True, 'Champion_Improved_Critical':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shield':1, 'Scimitar +1':1, 'Longbow +1':1, 'Arrow':40, }, 'mount_combat':True, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Враги (герои) (Тик-Бо): metadict_chars['Druid 1 lvl (друид Тик-Бо)'] = { # На них "Водное дыхание" или "Хождение по воде" 'level':1, 'water_walk':True, 'char_class':'Druid', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ # Число заклинаний -- мод_мудрости + уровень_друида: # Goodberry -- 2 слота = 20 хитов на завтра. 20 друидов 2 lvl = 600 хитов лечения. ('cantrip', 'Druidcraft'), ('cantrip', 'Mold_Earth'), #('cantrip', 'Magic_Stone'), #('ritual', 'Speak_with_Animals'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Entangle'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Goodberry'), ], 'Druidic_Language':True, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Armor':1, 'Heavy Shield':1, 'Club':1, 'Sling real':1, 'Sling Bullet':10, }, 'mount_combat':True, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } metadict_chars['Druid 5 lvl (Тик-Бо «Робкий»)'] = { # Пацифист, призыватель зверей. 'level':5, 'fireball_AI':True, 'water_walk':True, 'char_class':'Druid', 'hit_dice':'1d8', 'behavior':'commander', #'fearless_AI':True, 'hitpoints_medial':True, 'abilityes':{ 'strength':10, 'dexterity':14, 'constitution':14, 'intelligence':16, 'wisdom':18, 'charisma':14, }, 'class_features':{ 'Feat_Healer':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Druidcraft'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Guidance'), ('ritual', 'Speak_with_Animals'), ('ritual', 'Water_Breathing'), ('ritual', 'Water_Walk'), ('1_lvl', 'Entangle'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Pass_Without_Trace'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Healing_Spirit'), ('3_lvl', 'Conjure_Animals'), ('3_lvl', 'Plant_Growth'), ], 'Druidic_Language':True, 'Wild_Shape':True, 'Druid_Circle_Forest':True, 'Natural_Recovery':True, 'Wild_Shape_Improvement':True, 'Ability_Score_Improvement':{ 'wisdom':+2, }, }, 'race':'Human-hero', 'weapon_skill':['simple','Scimitar'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':30, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Heavy Shield':1, 'Club':1, 'Sling real':1, 'Sling Bullet':10, }, 'mount_combat':True, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Враги (армии) (демоны Кема'Эша): metadict_chars['Commoner 1 lvl (карл)'] = { # Карлы с дубинками. Ничего особенного, только шкуры у них крепкие. 'level':1, 'char_class':'Commoner', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Primevial-medium', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Mace':1, 'Shield':1, 'Javelin':6, }, } metadict_chars['Commoner 1 lvl (карл-ветеран)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Primevial-medium', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Mace':1, 'Shield':1, 'Javelin':6, }, } metadict_chars['Warrior 3 lvl (демон Кема\'Эша)'] = { # Опасный гад. 'level':3, #'fearless_AI':True, 'seeker_AI':True, 'killer_AI':True, 'char_class':'Warrior-officer', 'behavior':'commander', 'class_features':{ 'Regeneration':3, }, 'hitpoints_medial':True, 'abilityes':{ 'strength':18, 'dexterity':14, 'constitution':18, 'intelligence':10, 'wisdom':12, 'charisma':16, }, 'hit_dice':'1d10', 'race':'Primevial-large', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Battleaxe':1, 'Shield':1, 'Javelin':6, }, } #---- # Нейтралы (свита) (волшебники Менона): metadict_chars['Wizard 4 lvl (волшебник Менона)'] = { 'level':4, 'archer_AI':True, 'fireball_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ 'Feat_Resilient':'constitution', 'Ability_Score_Improvement':{ 'constitution':+1, 'intelligence':+2, }, 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ # Уровень_персонажа + мод_интеллекта (8 заклинаний) ('cantrip', 'Prestidigitation'), ('cantrip', 'Shape_Water'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Message'), # Ритуалы из книги заклинаний: ('ritual', 'Alarm'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('ritual', 'Gentle_Repose'), ('ritual', 'Find_Familiar'), ('ritual', 'Comprehend_Languages'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Warding_Wind'), ('2_lvl', 'Invisibility'), ('2_lvl', 'Flaming_Sphere'), ('2_lvl', 'See_Invisibility'), #('2_lvl', 'Dragon_Breath'), #('2_lvl', 'Suggestion'), #('2_lvl', 'Shatter'), ], # TODO: # - Grim_Harvest -- лечение x2 круг заклинания, или x3, если некромантия. 'School_of_Necromancy':True, 'Grim_Harvest':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Wizard 12 lvl (Менон Теварин)'] = { # Wizard 1 lvl (otherworld mage-disciple) sum:100 STR:16 DEX:17 CON:17 INT:19 WIS:17 CHA:14 # "Предосторожность" (Contingency) хранит заклинание Otiluke_Resilent_Sphere, или Wall_of_Force. # "Feat_Alert", -- нельзя застать врасплох. "Feat_Keen_Mind" -- помнит всё. 'level':12, 'fireball_AI':True, 'disengage_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':16, 'dexterity':17, 'constitution':17, 'intelligence':19, 'wisdom':17, 'charisma':14, }, 'class_features':{ 'Feat_Alert':True, 'Feat_Keen_Mind':True, 'Feat_Resilient':'constitution', 'Ability_Score_Improvement':{ 'dexterity':+1, 'constitution':+1, 'intelligence':+1, 'wisdom':+1, }, 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ # Уровень_персонажа + мод_интеллекта (17 заклинаний) ('cantrip', 'Prestidigitation'), ('cantrip', 'Shape_Water'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Message'), ('cantrip', 'Minor_Illusion'), # Ритуалы из книги заклинаний: ('ritual', 'Alarm'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('ritual', 'Gentle_Repose'), ('ritual', 'Find_Familiar'), ('ritual', 'Comprehend_Languages'), ('ritual', 'Feign_Death'), ('ritual', 'Water_Breathing'), ('ritual', 'Leomund_Tiny_Hut'), ('ritual', 'Rary_Telepathic_Bond'), ('ritual', 'Contact_Other_Plane'), # Для свиты: ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Warding_Wind'), ('2_lvl', 'Invisibility'), ('2_lvl', 'Flaming_Sphere'), ('2_lvl', 'See_Invisibility'), #('2_lvl', 'Dragon_Breath'), #('2_lvl', 'Suggestion'), #('2_lvl', 'Shatter'), # Личные (9 заклинаний): ('3_lvl', 'Counterspell'), ('3_lvl', 'Fireball'), ('3_lvl', 'Sending'), ('4_lvl', 'Fabricate'), ('4_lvl', 'Dimension_Door'), ('5_lvl', 'Teleportation_Circle'), ('5_lvl', 'Animated_Objects'), ('5_lvl', 'Cone_of_Cold'), ('6_lvl', 'Soul_Cage'), # ---- #('3_lvl', 'Blink'), #('3_lvl', 'Animate_Dead'), #('3_lvl', 'Dispel_Magic'), #('3_lvl', 'Vampiric_Touch'), #('3_lvl', 'Melf_Minute_Meteors'), # ---- #('4_lvl', 'Stoneskin'), #('4_lvl', 'Arcane_Eye'), #('4_lvl', 'Control_Water'), #('4_lvl', 'Leomund_Secret_Chest'), #('4_lvl', 'Otiluke_Resilent_Sphere'), #('4_lvl', 'Mordenkainen_Private_Sanctum'), #('4_lvl', 'Conjure_Minor_Elementals'), #('4_lvl', 'Sickening_Radiance'), #('4_lvl', 'Ice_Storm'), #('4_lvl', 'Banishment'), # ---- #('5_lvl', 'Enervation'), #('5_lvl', 'Cone_of_Cold'), #('5_lvl', 'Danse_Macabre'), #('5_lvl', 'Negative_Energy_Flood'), #('5_lvl', 'Conjure_Elemental'), #('5_lvl', 'Wall_of_Force'), #('5_lvl', 'Cloudkill'), #('5_lvl', 'Passwall'), #('5_lvl', 'Scrying'), # ---- #('6_lvl', 'Create_Undead'), #('6_lvl', 'Circle_of_Death'), #('6_lvl', 'Programmed_Illusion'), #('6_lvl', 'Arcane_Gate'), #('6_lvl', 'True_Seeing'), #('6_lvl', 'Magic_Jar'), #('6_lvl', 'Contingency'), #('6_lvl', 'Create_Undead'), ], # TODO: # - Grim_Harvest -- лечение x2 круг заклинания, или x3, если некромантия. # - Undead_Thralls -- 2 цели "Animate_Dead", +уровень_мага к max_hp, +бонус_мастерства к урону. # - Inured_to_Undeath -- сопротивление к урону некротикой, максимум хитов не уменьшается. 'School_of_Necromancy':True, 'Grim_Harvest':True, 'Undead_Thralls':True, 'Inured_to_Undeath':True, 'resistance':['necrotic_energy'], }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # TODO: руны 3-4 круга # - Rune of Flying # - Rune of Stoneskin # - Rune of Greater Invisibility 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Wizard 12 lvl (симулякр Менона)'] = { # "Feat_Alert", -- нельзя застать врасплох. "Feat_Keen_Mind" -- помнит всё. # Связан с самим Меноном через Rary_Telepathic_Bond. 'level':12, 'simulacrum':True, 'fireball_AI':True, 'disengage_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':16, 'dexterity':17, 'constitution':17, 'intelligence':19, 'wisdom':17, 'charisma':14, }, 'class_features':{ 'Feat_Alert':True, 'Feat_Keen_Mind':True, 'Feat_Resilient':'constitution', 'Ability_Score_Improvement':{ 'dexterity':+1, 'constitution':+1, 'intelligence':+1, 'wisdom':+1, }, 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ # Уровень_персонажа + мод_интеллекта (17 заклинаний) # https://www.dandwiki.com/wiki/5e_SRD:Wizard ('cantrip', 'Prestidigitation'), ('cantrip', 'Shape_Water'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Message'), ('cantrip', 'Minor_Illusion'), # Ритуалы из книги заклинаний: ('ritual', 'Alarm'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('ritual', 'Gentle_Repose'), ('ritual', 'Water_Breathing'), ('ritual', 'Leomund_Tiny_Hut'), ('ritual', 'Rary_Telepathic_Bond'), ('1_lvl', 'Shield'), ('2_lvl', 'Invisibility'), ('2_lvl', 'Mirror_Image'), ('2_lvl', 'Knock'), ('3_lvl', 'Counterspell'), ('3_lvl', 'Dispel_Magic'), ('3_lvl', 'Enemies_Abound'), ('3_lvl', 'Blink'), ('4_lvl', 'Arcane_Eye'), ('4_lvl', 'Dimension_Door'), # ('4_lvl', 'Sickening_Radiance'), ('5_lvl', 'Teleportation_Circle'), ('5_lvl', 'Conjure_Elemental'), ('5_lvl', 'Danse_Macabre'), ('5_lvl', 'Passwall'), #('6_lvl', 'Circle_of_Death'), ('6_lvl', 'Arcane_Gate'), ], 'School_of_Necromancy':True, #'Grim_Harvest':True, 'Undead_Thralls':True, 'Inured_to_Undeath':True, 'resistance':['necrotic_energy'], }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # Симулякру не полагаются драгоценные руны. 'Rune of Absorbtion':2, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Нейтралы (армии) (Бронзовые гоплиты Менона): metadict_chars['Warrior 4 lvl (бронзовый гоплит Менона)'] = { # Умертвие. 'level':4, 'sneak_AI':True, 'killer_AI':True, 'fearless_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'immunity':['poison','poisoned'], 'Fighting_Style_Blind_Fighting':True, 'Feat_Magic_Initiate':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Sword_Burst'), ('cantrip', 'Mold_Earth'), #('cantrip', 'Frostbite'), #('cantrip', 'Fire_Bolt'), #('cantrip', 'Create_Bonfire'), ('1_lvl', 'Fog_Cloud'), #('1_lvl', 'Magic_Missile'), ], }, 'race':'Human-hero-undead', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # Нежить не может использовать эссенции: #'Infusion of Vitality':1, 'Infusion of False Life':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Plate Armor':1, 'Heavy Shield':1, 'Long Spear':1, 'Longsword':1, 'Plumbata':12, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (бронзовый гоплит-капитан Менона)'] = { 'level':5, 'sneak_AI':True, 'killer_AI':True, 'fearless_AI':True, #'carefull_AI':True, #'no_grappler_AI':True, #'fearless_AI':True, #'seeker_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'immunity':['poison','poisoned'], 'Fighting_Style_Blind_Fighting':True, 'Feat_Magic_Initiate':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Sword_Burst'), ('cantrip', 'Mold_Earth'), #('cantrip', 'Frostbite'), #('cantrip', 'Fire_Bolt'), #('cantrip', 'Create_Bonfire'), #('cantrip', 'Message'), ('1_lvl', 'Fog_Cloud'), #('1_lvl', 'Magic_Missile'), ], 'Extra_Attack':True, }, 'race':'Human-hero-undead', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # Нежить не может использовать эссенции: #'Infusion of Vitality':1, 'Infusion of False Life':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Plate Armor':1, 'Heavy Shield':1, 'Long Spear':1, 'Longsword':1, 'Plumbata':12, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Нейтралы (армия) (ветераны Карагос): metadict_chars['Warrior 1 lvl (пират Карагоса)'] = { # Щиты используют против лучников, но не в ближнем бою. 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Hide Armor':1, 'Shield':1, 'Longsword':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 2 lvl (ветеран Карагоса)'] = { # Штурмовики-ветераны 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Hide Armor':1, 'Shield':1, 'Shortsword':1, 'Glaive':1, 'Javelin':6, }, } metadict_chars['Warrior 3 lvl (сержант Карагоса)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Glaive':1, 'Javelin':6, }, } metadict_chars['Warrior 4 lvl (лейтенант Карагоса)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':3, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Glaive':1, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } metadict_chars['Warrior 5 lvl (капитан Карагоса)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Great_Weapon_Fighting':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Glaive':1, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Нейтралы (герои) (Карагос): metadict_chars['Barbarian 9 lvl (Карагос «Мудрый»)'] = { # Barbarian 1 lvl (thracian slayer-dogface) sum:108 STR:19 DEX:18 CON:19 INT:18 WIS:16 CHA:18 'level':9, 'hunter_AI':True, 'fearless_AI':True, 'no_grappler_AI':True, 'squad_advantage':True, 'char_class':'Barbarian', 'hit_dice':'1d12', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':19, 'dexterity':18, 'constitution':19, 'intelligence':16, 'wisdom':18, 'charisma':18, }, 'class_features':{ # TODO: # 4. сделай Mindless_Rage (защищает от очарования и страха) 'Feat_Great_Weapon_Master':True, 'Unarmored_Defense':True, 'Rage':True, 'Reckless_Attack':True, 'Danger_Sense':True, 'Primal_Path_Berserker':True, 'Berserker_Frenzy':True, 'Fast_Movement':True, 'Feral_Instinct':True, 'Mindless_Rage':True, 'Extra_Attack':True, 'Brutal_Critical':True, 'Ability_Score_Improvement':{ 'dexterity':+2, 'strength':+1, 'constitution':+1, }, }, 'race':'Human-hero-big', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Regeneration':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, #'Sword of Life-Stealing':1, #'Sword of Sharpness':1, 'Sword of the Past +2':1, }, #'mount_combat':False, #'mount_type':'Warhorse', #'equipment_mount':{ # }, } #---- # Нейтралы (герои) (Кирос): metadict_chars['Fighter 4 lvl (боец Кироса)'] = { 'level':4, 'char_class':'Eldritch_Knight', 'hit_dice':'1d10', 'behavior':'commander', 'class_features':{ 'Feat_Mounted_Combatant':True, #'Feat_Sentinel':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, }, 'Fighting_Style_Dueling':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Eldritch_Knight':True, 'Weapon_Bond':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Message'), ('cantrip', 'Green_Flame_Blade'), ('ritual', 'Alarm'), ('1_lvl', 'Shield'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), #('1_lvl', 'Fog_Cloud'), ], }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Heroism':1, 'Infusion of Regeneration':1, 'Rune of Absorbtion':1, 'Plate Armor':1, 'Heavy Shield':1, 'Longsword +1':1, 'Lance':1, #'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Rune of Absorbtion':1, 'Infusion of Regeneration':1, 'Horse Scale Mail':1, }, } metadict_chars['Fighter 13 lvl (Кирос «Симарх»)'] = { # Fighter 1 lvl (legionary sentinel-battler) sum:103 STR:19 DEX:17 CON:18 INT:16 WIS:16 CHA:17 # Использует "Обнаружение мыслей" (Detect_Thoughts), чтобы читать мысли других. 'level':13, 'fearless_AI':True, #'predator_AI':True, 'hunter_AI':True, 'no_grappler_AI':True, 'char_class':'Eldritch_Knight', 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':19, 'dexterity':17, 'constitution':18, 'intelligence':16, 'wisdom':16, 'charisma':17, }, 'class_features':{ # TODO: # - Eldritch_Strike -- удачный удар = помеха на спасброски от закл. до конца следующего хода. 'Feat_Mounted_Combatant':True, 'Feat_War_Caster':True, #'Feat_Sentinel':True, 'Feat_Shield_Master':True, 'Feat_Heavy_Armor_Master':True, 'Ability_Score_Improvement':{ 'strength':+1, 'intelligence':+4, }, 'Fighting_Style_Dueling':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Eldritch_Knight':True, 'Weapon_Bond':True, 'Spellcasting':True, 'Spells':[ # 9 заклинаний на 13 lvl (2 заклинания вне школ evocation и abjuration) ('cantrip', 'Message'), ('cantrip', 'Green_Flame_Blade'), ('cantrip', 'Blade_Ward'), #('cantrip', 'Prestidigitation'), ('ritual', 'Alarm'), ('1_lvl', 'Shield'), #('2_lvl', 'Shield'), #('1_lvl', 'Magic_Missile'), #('1_lvl', 'Fog_Cloud'), ('2_lvl', 'Blur'), ('3_lvl', 'Blur'), ('2_lvl', 'Detect_Thoughts'), ('2_lvl', 'Warding_Wind'), ('2_lvl', 'Gust_of_Wind'), ('3_lvl', 'Counterspell'), ('3_lvl', 'Sending'), ], 'Extra_Attack':True, 'Indomitable':True, 'War_Magic':True, 'Eldritch_Strike':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Heroism':1, 'Infusion of Regeneration':1, 'Rune of Absorbtion':1, 'Plate Armor +1':1, 'Heavy Shield +1':1, #'Sword of Flame Tongue':1, 'Longsword +2':1, 'Lance':1, #'Pilum':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Rune of Absorbtion':1, 'Infusion of Regeneration':1, 'Horse Scale Mail':1, }, } #---- # Враги (герои) (Радамант): metadict_chars['Barbarian 2 lvl (варвар Радаманта)'] = { 'level':2, 'char_class':'Barbarian', 'hit_dice':'1d12', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Unarmored_Defense':True, 'Rage':True, 'Reckless_Attack':True, 'Danger_Sense':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':2, 'Scale Mail':1, 'Shield':1, 'Longsword':1, 'Lance':1, 'Javelin':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Scale Mail':1, }, } metadict_chars['Barbarian 5 lvl (Радамант «Бдительный»)'] = { 'level':5, 'char_class':'Barbarian', 'hit_dice':'1d12', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':18, 'dexterity':14, 'constitution':18, 'intelligence':10, 'wisdom':12, 'charisma':16, }, 'class_features':{ 'Feat_Alert':True, 'Feat_Mounted_Combatant':True, 'Unarmored_Defense':True, 'Rage':True, 'Reckless_Attack':True, 'Danger_Sense':True, 'Primal_Path_Berserker':True, 'Berserker_Frenzy':True, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':3, 'Half Plate':1, 'Shield':1, 'Longsword +1':1, 'Lance':1, 'Javelin':6, }, 'mount_combat':True, 'mount_type':'Warhorse', 'equipment_mount':{ 'Scale Mail':1, }, } #---- # Враги (свита) (Чара Атенак): metadict_chars['Warlock 3 lvl (колдун Чары)'] = { # Фамильяр -- бес. Разведчик-невидимка. 'level':3, 'fireball_AI':True, 'disengage_AI':True, #'archer_AI':True, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Resilient':'constitution', 'Ability_Score_Improvement':{ 'constitution':+1, }, #'Feat_Spellsniper':True, #'Feat_Elemental_Adept':'fire', 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ # Дополнительный кантрип за Feat_Spellsniper ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Create_Bonfire'), ('cantrip', 'Message'), ('ritual', 'Find_Familiar'), ('2_lvl', 'Armor_of_Agathys'), ('2_lvl', 'Flaming_Sphere'), ('2_lvl', 'Invisibility'), #('2_lvl', 'Shatter'), ], 'Dark_One\'s_Blessing':True, 'Eldritch_Invocations':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Eldritch_Spear':True, 'Pact_Boon':True, 'Pact_of_the_Chain':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Regeneration':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, 'Poison Arrow':40, 'Poison Blade':10, }, #'mount_combat':True, #'mount_type':'Horseclaw', #'equipment_mount':{ # 'Horse Scale Mail':1, # }, } metadict_chars['Warlock 11 lvl (Чара Атенак)'] = { # Warlock 1 lvl (otherworld seeker-follower) sum:97 STR:15 DEX:18 CON:16 INT:15 WIS:15 CHA:18 # 18 слотов/сутки под "Вещий сон" (Dream) и "Наблюдение" (Scrying) # Неограниченный "Разговор с мёртвыми" (Speak_with_Dead). # Фамильяр (попугай) может передавать голос Чары. # Ритуальный заклинатель (заклинания волшебника): 'level':11, 'fireball_AI':True, 'disengage_AI':True, #'archer_AI':True, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':15, 'dexterity':18, 'constitution':16, 'intelligence':15, 'wisdom':15, 'charisma':18, }, 'class_features':{ 'Feat_Resilient':'constitution', 'Ability_Score_Improvement':{ 'constitution':+1, 'charisma':+2, }, #'Feat_Spellsniper':True, #'Feat_Elemental_Adept':'fire', 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ # Дополнительный кантрип за Feat_Spellsniper ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Create_Bonfire'), ('cantrip', 'Prestidigitation'), ('cantrip', 'Minor_Illusion'), ('cantrip', 'Message'), # Pact_of_the_Chain: ('ritual', 'Find_Familiar'), # Ритуальный заклинатель (волшебник): ('ritual', 'Alarm'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('ritual', 'Comprehend_Languages'), ('ritual', 'Water_Breathing'), ('ritual', 'Leomund_Tiny_Hut'), ('ritual', 'Rary_Telepathic_Bond'), ('ritual', 'Contact_Other_Plane'), # Для свиты: ('5_lvl', 'Armor_of_Agathys'), ('5_lvl', 'Flaming_Sphere'), ('5_lvl', 'Invisibility'), #('5_lvl', 'Shatter'), # Личные: ('5_lvl', 'Dream'), ('5_lvl', 'Scrying'), ('5_lvl', 'Counterspell'), #('5_lvl', 'Wall_of_Fire'), ('5_lvl', 'Synaptic_Static'), ('5_lvl', 'Summon_Greater_Demon'), ('5_lvl', 'Dimension_Door'), ('5_lvl', 'Banishment'), # Invocation_Minios_of_Chaos: ('5_lvl', 'Conjure_Elemental'), # Таинственный арканум: ('6_lvl', 'True_Seeing'), ], # TODO: # - Удача темнейшего, +1d10 к спасброску/проверке характеристики. 1 раз/кор.отдых. # - Устойчивость исчадия, сопротивление типу урона. Даже к колющему/рубящему. 'Dark_One\'s_Blessing':True, 'Dark_One\'s_Own_Luck':True, 'Fiendish_Resilience':True, 'resistance':['piercing'], # 11 lvl, 5 инвокаций: 'Eldritch_Invocations':True, 'Invocation_Eldritch_Spear':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Minios_of_Chaos':True, 'Invocation_Voice_of_the_Chain_Master':True, 'Invocation_Whispers_of_the_Grave':True, # Договор цепи: 'Pact_Boon':True, 'Pact_of_the_Chain':True, # Черта на 8 lvl: 'Feat_Ritual_Caster':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # Магические предметы: # d6 | Ритуальная магия Шекелеш | Свойства # ----- | ------------------------- | ------------------------------------------------------ # 1 | Жезл договора* | Восстанавливает ячейку заклинания колдуна. 1 раз/сутки # 2 | Мантия глаз* | Всестороннее зрение. Тёмное, эфирный план, 120 футов. # 3 | Кольцо заклинаний* | Хранит любое заклинание 1-3 lvl. Перезарядка магом. # 4 | Оковы измерений | Служат как наручники. Запрещают телепорты всех форм. # 5 | Подковы скорости | Увеличивает скорость лошади на 30 футов/раунд # 6 | Подковы ветра | Лошадь свободно бежит по сложной местности, воде. # Чара не использует руны, привязка к магическим предметам. #'Rune of Absorbtion':1, #'Rune of Shielding':1, 'Mage_Armor':1, 'Shortsword +1':1, 'Shortbow +1':1, 'Arrow':40, 'Poison Arrow':40, 'Poison Blade':10, }, # TODO: летучий зверь вместо когтеклюва: #'mount_combat':True, #'mount_type':'Horseclaw', #'equipment_mount':{ # 'Horse Scale Mail':1, # }, } #---- # Враги (армии) (мирмидоны Чары): metadict_chars['Warrior 1 lvl (мирмидон)'] = { # Армия Номисто. "Универсальные солдаты", x2 стоимость снаряжения. 'level':1, 'char_class':'Warrior', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Chain Shirt':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Shortbow':1, 'Arrow':30, 'Poison Arrow':10, 'Poison Blade':10, }, } metadict_chars['Warrior 2 lvl (мирмидон-ветеран)'] = { 'level':2, 'char_class':'Warrior', 'behavior':'elite_warrior', 'hit_dice':'1d8', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Shortbow':1, 'Arrow':30, 'Poison Arrow':10, 'Poison Blade':10, }, } metadict_chars['Warrior 3 lvl (мирмидон-сержант)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Shortbow':1, 'Arrow':30, 'Poison Arrow':10, 'Poison Blade':10, }, } metadict_chars['Warrior 4 lvl (мирмидон-лейтенант)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Heroism':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Shortbow':1, 'Poison Arrow':40, 'Poison Blade':10, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } metadict_chars['Warrior 5 lvl (мирмидон-капитан)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Heroism':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Shortbow':1, 'Poison Arrow':40, 'Poison Blade':10, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Враги (армии) (легионеры Акхена): metadict_chars['Warrior 1 lvl (легионер Акхена)'] = { # "Универсальные солдаты", удвоенная стоимость снаряжения. # Пользуются усыпляющим ядом. Очень хороши против варваров и больших зверей. 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Studded Leather':1, 'Heavy Shield':1, 'Shortsword':1, 'Javelin':8, 'Sleep Blade':10, }, } metadict_chars['Warrior 2 lvl (ветеран Акхена)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Protection':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Javelin':5, 'Sleep Blade':10, }, } metadict_chars['Warrior 3 lvl (сержант Акхена)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Infusion of Heroism':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Javelin':5, 'Sleep Blade':10, }, } metadict_chars['Warrior 4 lvl (лейтенант Акхена)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Infusion of Heroism':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Javelin':5, 'Sleep Blade':10, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } metadict_chars['Warrior 5 lvl (капитан Акхена)'] = { 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Infusion of Heroism':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Javelin':5, 'Sleep Blade':10, }, 'mount_combat':False, 'mount_type':'Riding Horse', 'equipment_mount':{ }, } #---- # Враги (свита) (чародеи Ашеры): metadict_chars['Sorcerer 3 lvl (otherworld wildfire-enchanter)'] = { 'level':3, 'fireball_AI':True, 'disengage_AI':True, 'char_class':'Sorcerer', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ 'Feat_Elemental_Adept':'fire', 'Spellcasting':True, 'Spells':[ ('cantrip', 'Prestidigitation'), ('cantrip', 'Control_Flames'), ('cantrip', 'Create_Bonfire'), ('cantrip', 'Fire_Bolt'), ('1_lvl', 'Shield'), ('1_lvl', 'Burning_Hands'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'Flaming_Sphere'), ], 'Font_of_Magic':True, 'Metamagic':True, #'Metamagic_Subtle_Spell':True, 'Metamagic_Extended_Spell':True, 'Metamagic_Distant_Spell':True, }, 'race':'Primevial-large', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Dagger':1, }, } #---- # Враги (армии) (демоны Ашеры): metadict_chars['Warrior 1 lvl (демон-рядовой)'] = { # У них природный доспех с 12 AC. Крепкая шкура. В лёгкой броне демоны не нуждаются. 'level':1, 'char_class':'Warrior', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Primevial-medium', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Shield':1, 'Battleaxe':1, 'Long Spear':1, 'Javelin':6, }, } metadict_chars['Warrior 2 lvl (демон-ветеран)'] = { # У демонов-ветеранов сопротивляемость к огню и обычному оружию. # Уязвимость к излучению и серебру. 'level':2, 'char_class':'Warrior', 'behavior':'elite_warrior', 'class_features':{ 'resistance':['slashing','piercing','bludgeoning'], 'vultenability':['radiant'], }, 'hit_dice':'1d8', 'race':'Primevial-medium', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Infusion of Regeneration':1, 'Heavy Shield':1, 'Battleaxe':1, 'Long Spear':1, 'Javelin':6, }, } metadict_chars['Warrior 3 lvl (демон-сержант)'] = { 'level':3, 'brave_AI':True, 'killer_AI':True, 'carefull_AI':True, 'char_class':'Warrior-officer', 'behavior':'commander', 'class_features':{ 'resistance':['slashing','piercing','bludgeoning'], 'vultenability':['radiant'], }, 'hit_dice':'1d10', 'race':'Primevial-large', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Infusion of Regeneration':1, 'Infusion of Heroism':1, 'Heavy Shield':1, 'Battleaxe':1, 'Long Spear':1, 'Javelin':6, }, } metadict_chars['Warrior 4 lvl (демон-лейтенант)'] = { 'level':4, 'brave_AI':True, 'killer_AI':True, 'carefull_AI':True, 'char_class':'Warrior-officer', 'behavior':'commander', 'class_features':{ 'resistance':['slashing','piercing','bludgeoning'], 'vultenability':['radiant'], }, 'hit_dice':'1d10', 'race':'Primevial-large', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Infusion of Regeneration':1, 'Infusion of Heroism':1, 'Rune of Absorbtion':1, 'Heavy Shield':1, 'Battleaxe':1, 'Long Spear':1, 'Javelin':6, }, } metadict_chars['Warrior 5 lvl (демон-капитан)'] = { 'level':5, 'brave_AI':True, 'killer_AI':True, 'carefull_AI':True, 'char_class':'Warrior-officer', 'behavior':'commander', 'class_features':{ 'resistance':['slashing','piercing','bludgeoning'], 'vultenability':['radiant'], }, 'hit_dice':'1d10', 'race':'Primevial-large', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Infusion of Regeneration':1, 'Infusion of Heroism':1, 'Rune of Absorbtion':1, 'Half Plate':1, 'Heavy Shield':1, 'Battleaxe':1, 'Long Spear':1, 'Javelin':6, }, } #---- # Враги (армии) (водяные Нингиримы): metadict_chars['Warrior 1 lvl (гоплит Нингиримы)'] = { 'level':1, 'water_walk':True, 'char_class':'Warrior', 'behavior':'warrior', 'hit_dice':'1d8', 'race':'Humanoid-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Studded Leather':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Poison Blade':10, }, } metadict_chars['Warrior 2 lvl (гоплит-ветеран Нингиримы)'] = { 'level':2, 'water_walk':True, 'char_class':'Warrior', 'behavior':'elite_warrior', 'hit_dice':'1d8', 'class_features':{ 'Fighting_Style_Dueling':True, }, 'race':'Humanoid-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Scale Mail':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Poison Blade':10, }, } metadict_chars['Warrior 3 lvl (гоплит-сержант Нингиримы)'] = { 'level':3, 'water_walk':True, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Dueling':True, }, 'race':'Humanoid-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Poison Blade':10, }, } metadict_chars['Warrior 4 lvl (гоплит-лейтенант Нингиримы)'] = { 'level':4, #'close_order_AI':True, 'water_walk':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Dueling':True, 'Feat_Inspiring_Leader':True, }, 'race':'Humanoid-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Poison Blade':10, }, } metadict_chars['Warrior 5 lvl (гоплит-капитан Нингиримы)'] = { 'level':5, #'close_order_AI':True, 'water_walk':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Dueling':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Humanoid-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Long Spear':1, 'Poison Blade':10, }, } #---- # Союзники (герои) (Кумар): metadict_chars['Monk 3 lvl (монах Кумара)'] = { # Путь тени 'level':3, 'grappler_AI':True, 'carefull_AI':True, 'char_class':'Monk', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Feat_Defensive_Duelist':True, 'Unarmored_Defense':True, 'Martial_Arts':True, 'Flurry_of_Blows':True, 'Patient_Defense':True, 'Step_of_the_Wind':True, 'Unarmored_Movement':True, 'Deflect_Missiles':True, 'Shadow_Arts':True, 'Spells':[ ('2_lvl', 'Pass_Without_Trace'), ('2_lvl', 'Darkvision'), #('2_lvl', 'Darkness'), ('2_lvl', 'Silence'), ], }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, 'Shortsword +1':1, }, } metadict_chars['Monk 9 lvl (Кумар «Чугуннорукий»)'] = { # Путь тени # Monk 1 lvl (city windsong-apprentice) sum:104 STR:17 DEX:19 CON:17 INT:16 WIS:18 CHA:17 'level':9, 'grappler_AI':True, 'carefull_AI':True, 'char_class':'Monk', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':17, 'dexterity':19, 'constitution':17, 'intelligence':16, 'wisdom':18, 'charisma':17, }, 'class_features':{ # TODO: # 2. Shadow_Step -- телепорт на 60 футов от тени к тени бонусным действием. # ------ # 5. Stillness_of_Mind -- действием снимает очарование или испуг. # 6. Unarmored_Movement_improvement -- бег по вертикальным стенам и воде 'Feat_Defensive_Duelist':True, 'Unarmored_Defense':True, 'Martial_Arts':True, 'Flurry_of_Blows':True, 'Patient_Defense':True, 'Step_of_the_Wind':True, 'Unarmored_Movement':True, 'Deflect_Missiles':True, 'Shadow_Arts':True, 'Spells':[ ('2_lvl', 'Pass_Without_Trace'), ('2_lvl', 'Darkvision'), #('2_lvl', 'Darkness'), ('2_lvl', 'Silence'), ], 'Slow_Fall':True, 'Extra_Attack':True, 'Stunning_Strike':True, 'Ability_Score_Improvement':{ 'wisdom':+2, 'dexterity':+1, 'constitution':+1, }, 'Ki_Empowered_Strikes':True, 'Shadow_Step':True, 'Evasion':True, 'Stillness_of_Mind':True, 'Unarmored_Movement_improvement':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # TODO: # 2. Наручи защиты. # 3. Руны 3-4 круга. # Посох ударов продан за 4000 эфесов на оборону Илиона 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Infusion of Heroism':1, 'Bracers of Defence':1, 'Rune of Shielding':1, #'Staff of Striking +3':1, 'Shortsword +1':1, }, } #---- # Союзники (герои) (Тинв): metadict_chars['Wizard 3 lvl (кошка Тинв)'] = { 'level':3, 'fireball_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'archer', 'class_features':{ 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Friends'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Message'), ('ritual', 'Detect_Magic'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Sleep'), ('2_lvl', 'Blur'), ('2_lvl', 'Suggestion'), ('2_lvl', 'Hold_Person'), ('2_lvl', 'Invisibility'), ], 'School_of_Enchantment':True, 'Hypnotic_Gaze':True, }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Wizard 9 lvl (Тинв)'] = { # Тинв, коттаямская кошка, волшебница школы Очарования. # Wizard 2 lvl (city cat-weaver) sum:101 STR:14 DEX:19 CON:17 INT:19 WIS:16 CHA:16 # Feat_Observant +5 к пассивной внимательности. Читает по губам. 'level':9, 'fireball_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':14, 'dexterity':21, 'constitution':18, 'intelligence':20, 'wisdom':18, 'charisma':16, }, 'class_features':{ # TODO: сделай Instinctive_Charm -- перенаправление атаки врага на другого, за счёт реакции. 'Feat_Resilient':'constitution', 'Feat_Observant':True, 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Friends'), ('cantrip', 'Minor_Illusion'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Message'), ('ritual', 'Detect_Magic'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Sleep'), #('2_lvl', 'Blur'), ('2_lvl', 'Suggestion'), ('2_lvl', 'Hold_Person'), ('2_lvl', 'Invisibility'), ('3_lvl', 'Counterspell'), ('3_lvl', 'Nondetection'), ('3_lvl', 'Fireball'), ('3_lvl', 'Melf_Minute_Meteors'), #('4_lvl', 'Fear'), ('4_lvl', 'Arcane_Eye'), ('5_lvl', 'Teleportation_Circle'), ('5_lvl', 'Geas'), ], 'School_of_Enchantment':True, 'Hypnotic_Gaze':True, 'Instinctive_Charm':True, }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # TODO: добавить руны 3-4 круга. # Добавить кошачьи волшебные вещи. 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, }, } #---- # Союзники (армия) (Кумар): metadict_chars['Warrior 1 lvl (легионер Илиона)'] = { 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Studded Leather':1, 'Heavy Shield':1, 'Shortsword':1, 'Fire Spear':4, 'Holy Blade':10, }, } metadict_chars['Warrior 2 lvl (ветеран Илиона)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Scale Mail':1, 'Heavy Shield':1, 'Shortsword':1, 'Fire Spear':2, 'Holy Blade':10, }, } metadict_chars['Warrior 3 lvl (сержант Илиона)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Fire Spear':2, 'Holy Blade':10, }, } metadict_chars['Warrior 4 lvl (лейтенант Илиона)'] = { 'level':4, #'rearm_AI':True, 'defence_AI':True, 'carefull_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Heavy Shield':1, 'Shortsword':1, 'Fire Spear':2, 'Holy Blade':10, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (капитан Илиона)'] = { # Сидит на месте, обороняется. На врага не ведёт. 'level':5, #'rearm_AI':True, 'defence_AI':True, 'carefull_AI':True, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Defence':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Half Plate':1, 'Heavy Shield':1, 'Shortsword':1, 'Fire Spear':2, 'Holy Blade':10, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Commoner 1 lvl (пращник Илиона)'] = { # Пращники Илиона 'level':1, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':militia_pack, 'equipment_weapon':{ 'Leather Armor':1, 'Shield':1, 'Dagger':1, 'Sling real':1, #'Holy Bullet':10, 'Lead Bullet':10, #'Sling Bullet':10, }, } metadict_chars['Commoner 2 lvl (ветеран пращников Илиона)'] = { 'level':2, 'char_class':'Commoner', 'behavior':'archer', 'hit_dice':'1d8', 'race':'Human-common', 'weapon_skill':['simple'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Studded Leather':1, 'Shield':1, 'Dagger':1, 'Sling real':1, #'Holy Bullet':10, 'Lead Bullet':10, #'Sling Bullet':10, }, } metadict_chars['Warrior 3 lvl (сержант пращников Илиона)'] = { 'level':3, 'rearm_AI':True, 'volley_AI':True, 'defence_AI':True, 'carefull_AI':True, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ #'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Sling real':1, #'Holy Bullet':10, 'Lead Bullet':10, #'Sling Bullet':10, }, } #---- # Союзники (герои) (Тетро): metadict_chars['Bard 2 lvl (бард Тетры)'] = { # TODO: Jack_of_All_Trades позволяет добавлять 1/2 бонуса мастерства к модификаторам характеристик. 'level':2, 'char_class':'Bard', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'abilityes_choice':['charisma','dexterity','constitution'], 'class_features':{ 'Feat_Inspiring_Leader':True, 'Bardic_Inspiration':True, 'Spellcasting':True, 'Spells':[ # 2 lvl -- 5 заклинаний ('cantrip', 'Message'), ('cantrip', 'Prestidigitation'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Silent_Image'), ('1_lvl', 'Dissonant_Whispers'), #('1_lvl', 'Sleep'), ], 'Jack_of_All_Trades':True, 'Song_of_Rest':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Rapier':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Bard 6 lvl (Тетра Курио)'] = { 'level':6, 'fireball_AI':True, 'char_class':'Bard', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ # sum:85 STR:10 DEX:16 CON:15 INT:14 WIS:14 CHA:16 'strength':10, 'dexterity':16, 'constitution':15, 'intelligence':14, 'wisdom':14, 'charisma':16, }, 'class_features':{ 'Feat_Inspiring_Leader':True, 'Bardic_Inspiration':True, 'Spellcasting':True, 'Spells':[ # 6 lvl -- 9 заклинаний # TODO: "Тишина" (Silence) на 2 lvl. Защита от урона громом. ('cantrip', 'Message'), ('cantrip', 'Prestidigitation'), ('cantrip', 'Dancing_Lights'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Healing_Word'), ('1_lvl', 'Silent_Image'), ('1_lvl', 'Dissonant_Whispers'), #('1_lvl', 'Sleep'), ('2_lvl', 'Shatter'), ('3_lvl', 'Crusaders_Mantle'), ('3_lvl', 'Counterspell'), ('3_lvl', 'Sending'), ], 'Jack_of_All_Trades':True, 'Song_of_Rest':True, 'Expertise':True, 'College_of_Lore':True, 'Bonus_Proficiencies':True, 'Cutting_Words':True, 'Font_of_Inspiration':True, 'Ability_Score_Improvement':{ 'charisma':+2, }, 'Additional_Magical_Secrets':True, 'Countercharm':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'skills':[ # 8 = 2 предыстория + 3 бард + 3 Bonus_Proficiencies # === Intelligence 'Arcana', 'Investigation', 'Religion', # === Wisdom 'Insight', 'Perception', # === Charisma 'Deception', 'Intimidation', 'Persuasion', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Heroism':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Rapier +1':1, 'Longbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Союзники (армии) (Тетро): metadict_chars['Warrior 1 lvl (арбалетчик Тетры)'] = { 'level':1, #'archer_AI':True, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Studded Leather':1, 'Shield':1, 'Shortsword':1, 'Crossbow, Heavy':1, 'Crossbow Bolt':40, }, } metadict_chars['Warrior 2 lvl (арбалетчик-ветеран Тетры)'] = { 'level':2, #'archer_AI':True, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Chain Shirt':1, 'Shield':1, 'Shortsword':1, 'Crossbow, Heavy':1, 'Crossbow Bolt':40, }, } metadict_chars['Warrior 3 lvl (арбалетчик-сержант Тетры)'] = { 'level':3, #'archer_AI':True, 'brave_AI':True, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Crossbow, Heavy':1, 'Crossbow Bolt':40, }, } metadict_chars['Warrior 4 lvl (арбалетчик-лейтенант Тетры)'] = { 'level':4, #'archer_AI':True, 'brave_AI':True, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Crossbow, Heavy':1, 'Crossbow Bolt':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (арбалетчик-капитан Тетры)'] = { 'level':5, #'archer_AI':True, 'brave_AI':True, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Breastplate':1, 'Shield':1, 'Shortsword':1, 'Crossbow, Heavy':1, 'Crossbow Bolt':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Союзники (армии) (Коза): metadict_chars['Warlock 2 lvl (гневнорожка Козы)'] = { 'level':2, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Otherworldly_Patron':'Archfey', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Thunderclap'), ('cantrip', 'Eldritch_Blast'), ('1_lvl', 'Armor_of_Agathys'), ], 'Eldritch_Invocations':True, 'Invocation_Eldritch_Spear':True, }, 'race':'Fourlegged-common', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, #'Infusion of Claws':1, #'Infusion of Barkskin':1, 'Infusion of Regeneration':1, }, } metadict_chars['Warlock 3 lvl (главнорожка Козы)'] = { 'level':3, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Otherworldly_Patron':'Archfey', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Thunderclap'), ('cantrip', 'Eldritch_Blast'), ('2_lvl', 'Armor_of_Agathys'), #('2_lvl', 'Invisibility'), #('2_lvl', 'Suggestion'), #('2_lvl', 'Shatter'), #('2_lvl', 'Hex'), ], 'Dark_One\'s_Blessing':True, 'Eldritch_Invocations':True, 'Invocation_Eldritch_Spear':True, 'Invocation_Agonizing_Blast':True, }, 'race':'Fourlegged-common', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, #'Infusion of Claws':1, 'Infusion of Barkskin':1, 'Infusion of Regeneration':1, }, } metadict_chars['Warlock 3 lvl (Сефо Форонейская)'] = { 'level':3, #'defence_AI':True, 'fireball_AI':True, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ # TODO: пакт фамильяра 'Otherworldly_Patron':'Archfey', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Thunderclap'), ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Prestidigitation'), ('2_lvl', 'Armor_of_Agathys'), ('2_lvl', 'Invisibility'), ('2_lvl', 'Suggestion'), #('2_lvl', 'Shatter'), #('2_lvl', 'Hex'), ], 'Dark_One\'s_Blessing':True, 'Eldritch_Invocations':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Eldritch_Spear':True, 'Pact_Boon':True, 'Pact_of_the_Tome':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Regeneration':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Союзники (герои) (Кема'Эш): metadict_chars['Warlock 2 lvl (колдун Кема\'Эша)'] = { 'level':2, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'archer', 'class_features':{ 'Feat_Mounted_Combatant':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ ('cantrip', 'Shape_Water'), ('cantrip', 'Eldritch_Blast'), ('1_lvl', 'Charm_Person'), ('1_lvl', 'Armor_of_Agathys'), ('1_lvl', 'Sleep'), ], # TODO: пили бонусы архифеи Козы. # - 1 lvl Fey_Presence, пугает/очаровывает на ход, 10-футовый куб на себя. 'Fey_Presence':True, 'Eldritch_Invocations':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Mask_of_Many_Faces':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # Коза даёт своим эссенцию регенерации: 'Infusion of Regeneration':1, 'Potion of Antidote':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shortsword':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Horseclaw', #'equipment_mount':{ # 'Horse Scale Mail':1, # }, } metadict_chars['Warlock 6 lvl (Кема\'Эш «Ловкач»)'] = { 'level':6, 'fireball_AI':True, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':10, 'dexterity':16, 'constitution':12, 'intelligence':14, 'wisdom':16, 'charisma':18, }, 'class_features':{ 'Feat_Mounted_Combatant':True, 'Otherworldly_Patron':'Fiend', 'Pact_Magic':True, 'Spells':[ # Козочка даёт кантрип Shape_Water вместо Create_Bonfire Ашеры: ('cantrip', 'Shape_Water'), ('cantrip', 'Eldritch_Blast'), ('cantrip', 'Minor_Illusion'), ('cantrip', 'Prestidigitation'), ('cantrip', 'Message'), ('ritual', 'Detect_Magic'), ('ritual', 'Identify'), ('3_lvl', 'Sleep'), ('3_lvl', 'Charm_Person'), ('3_lvl', 'Armor_of_Agathys'), ('3_lvl', 'Summon_Lesser_Demons'), ('3_lvl', 'Counterspell'), # Коза не даёт лётных заклинаний, не умеет: #('3_lvl', 'Fly'), ], # TODO: пили бонусы архифеи Козы. # - 1 lvl Fey_Presence, пугает/очаровывает на ход, 10-футовый куб на себя. # - 6 lvl Misty_Escape, телепорт на 60 футов, реакцией, после ранения. Плюс невидимость на ход. 'Fey_Presence':True, 'Misty_Escape':True, 'Eldritch_Invocations':True, 'Invocation_Agonizing_Blast':True, 'Invocation_Mask_of_Many_Faces':True, 'Invocation_Book_of_Ancient_Secrets':True, 'Pact_Boon':True, 'Pact_of_the_Tome':True, 'Feat_Inspiring_Leader':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # Коза даёт своим эссенцию регенерации: 'Infusion of Regeneration':1, 'Potion of Antidote':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Shortsword +1':1, 'Shortbow':1, 'Arrow':40, }, #'mount_combat':True, #'mount_type':'Horseclaw', #'equipment_mount':{ # 'Horse Scale Mail':1, # }, } #---- # Союзники (герои) (Тави): metadict_chars['Wizard 2 lvl (кошка Тави)'] = { 'level':2, 'commando_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'archer', 'class_features':{ 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mend'), ('cantrip', 'Water_Shape'), ('cantrip', 'Mold_Earth'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), #('1_lvl', 'Sleep'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), ], }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':10, 'Potion of Antidote':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, }, } metadict_chars['Wizard 7 lvl (Тави)'] = { 'level':7, 'archer_AI':True, 'commando_AI':True, 'fireball_AI':True, 'squad_advantage':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ # Школа Преобразования. Feat_Resilient за счёт камня преобразования. 'Feat_Resilient':'constitution', 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mend'), ('cantrip', 'Water_Shape'), ('cantrip', 'Mold_Earth'), ('cantrip', 'Message'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), #('1_lvl', 'Sleep'), ('1_lvl', 'Magic_Missile'), ('1_lvl', 'Absorb_Elements'), # Не нуждается в Blur, "Идеальное взаимодействие" #('2_lvl', 'Blur'), ('2_lvl', 'Suggestion'), ('2_lvl', 'Hold_Person'), ('2_lvl', 'Invisibility'), ('3_lvl', 'Counterspell'), ('3_lvl', 'Nondetection'), ('3_lvl', 'Sending'), #('3_lvl', 'Dispel_Magic'), # Огнешары неэффективны под водой: #('3_lvl', 'Fireball'), #('3_lvl', 'Melf_Minute_Meteors'), #('4_lvl', 'Ice_Storm'), ('4_lvl', 'Arcane_Eye'), ('4_lvl', 'Control_Water'), #('4_lvl', 'Greater_Invisibility'), #('4_lvl', 'Polymorph'), ], 'Ability_Score_Improvement':{ 'intelligence':+2, }, }, 'race':'Cat-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':10, 'Potion of Antidote':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, }, } #---- # Союзники (армии) (Тави): metadict_chars['Warrior 1 lvl (легионер Тави)'] = { 'level':1, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'warrior', 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Chain Shirt':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':6, }, } metadict_chars['Warrior 2 lvl (ветеран Тави)'] = { 'level':2, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Protection':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of False Life':1, 'Infusion of Vitality':1, #'Scale Mail':1, 'Mage_Armor':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':12, 'Sleep Blade':40, }, } metadict_chars['Warrior 3 lvl (сержант Тави)'] = { 'level':3, 'char_class':'Warrior', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of False Life':1, 'Rune of Absorbtion':1, #'Half Plate':1, 'Mage_Armor':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':12, 'Sleep Blade':40, }, } metadict_chars['Warrior 4 lvl (лейтенант Тави)'] = { 'level':4, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, 'Feat_Alert':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of False Life':1, 'Rune of Absorbtion':1, #'Half Plate':1, 'Mage_Armor':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':12, 'Sleep Blade':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (капитан Тави)'] = { # Командир сотни легионеров, центурион (кентурион). 'level':5, 'char_class':'Warrior-officer', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, 'Extra_Attack':True, 'Feat_Alert':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Goodberry':4, 'Potion of Antidote':1, 'Infusion of Longstrider':1, 'Infusion of False Life':1, 'Rune of Absorbtion':1, #'Half Plate':1, 'Mage_Armor':1, 'Heavy Shield':1, 'Shortsword':1, 'Pilum':12, 'Sleep Blade':40, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #------------------------------------------------------------------------------- # Чёрные флаги Ост-Индии, Black Flags metadict_chars['Warrior 2 lvl (абордажник-ветеран) (кошка)'] = { 'sneak_AI':True, 'grappler_AI':True, 'disengage_AI':True, 'base_unit':'Warrior 2 lvl (grenadier line-infantry-veteran)', 'char_class':'Warrior-pirate', 'race':'Cat-hero', 'class_features':{ 'Cunning_Action':True, 'Cunning_Action_Defence':True, 'Fighting_Style_Blind_Fighting':True, }, 'equipment_weapon':{ 'Potion of Heroism':1, 'Potion of Antidote':1, 'Infusion of Claws':1, 'Hand Grenade':10, 'Smoke Grenade':2, }, } metadict_chars['Warrior 5 lvl (абордажник-лейтенант) (котяра)'] = { 'sneak_AI':True, 'grappler_AI':True, 'disengage_AI':True, 'base_unit':'Warrior 5 lvl (grenadier line-infantry-lieutenant)', 'char_class':'Warrior-pirate', 'race':'Cat-hero', 'class_features':{ 'Cunning_Action':True, 'Cunning_Action_Defence':True, 'Fighting_Style_Blind_Fighting':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'equipment_weapon':{ 'Potion of Heroism':1, 'Potion of Antidote':1, 'Infusion of Claws':1, 'Infusion of Vitality':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Hand Grenade':10, 'Smoke Grenade':2, }, } #---- # Союзники (армия) (Генри Эвери): metadict_chars['Warrior 2 lvl (абордажник-ветеран)'] = { 'base_unit':'Warrior 2 lvl (grenadier line-infantry-veteran)', 'char_class':'Warrior-heavy', 'equipment_weapon':{ 'Potion of Heroism':1, 'Potion of Antidote':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, #'Hand Mortar':1, #'2lb Bomb':3, }, } metadict_chars['Warrior 5 lvl (абордажник-лейтенант) (лидер)'] = { 'base_unit':'Warrior 5 lvl (grenadier line-infantry-lieutenant)', 'char_class':'Warrior-officer', 'equipment_weapon':{ 'Potion of Heroism':1, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre +1':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':5, 'Smoke Grenade':1, #'Hand Mortar':1, #'2lb Bomb':3, }, } metadict_chars['Warrior 4 lvl (абордажник Эвери)'] = { 'base_unit':'Warrior 4 lvl (grenadier line-infantry-sergeant)', 'char_class':'Warrior-heavy', 'behavior':'elite_warrior', 'class_features':{ 'Feat_Martial_Adept':True, 'Menacing_Attack':True, 'Precision_Attack':True, #'Parry':True, }, 'equipment_weapon':{ #'Potion of Rage':1, 'Potion of Heroism':1, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':10, 'Smoke Grenade':1, #'Hand Mortar':1, #'2lb Bomb':3, }, } metadict_chars['Warrior 5 lvl (лейтенант Эвери)'] = { 'base_unit':'Warrior 5 lvl (grenadier line-infantry-lieutenant)', 'char_class':'Warrior-officer', 'class_features':{ 'Feat_Martial_Adept':True, 'Menacing_Attack':True, 'Precision_Attack':True, #'Parry':True, 'Extra_Attack':True, }, 'equipment_weapon':{ #'Potion of Rage':1, 'Potion of Heroism':1, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre +1':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':10, 'Smoke Grenade':1, #'Hand Mortar':1, #'2lb Bomb':3, }, } metadict_chars['Warrior 4 lvl (абордажник Эвери) (лидер)'] = { 'base_unit':'Warrior 4 lvl (grenadier line-infantry-sergeant)', 'char_class':'Warrior-heavy', 'behavior':'elite_warrior', 'equipment_weapon':{ #'Potion of Rage':1, 'Potion of Heroism':1, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':10, 'Smoke Grenade':1, #'Hand Mortar':1, #'2lb Bomb':3, }, } metadict_chars['Warrior 5 lvl (лейтенант Эвери) (лидер)'] = { 'base_unit':'Warrior 5 lvl (grenadier line-infantry-lieutenant)', 'char_class':'Warrior-officer', 'equipment_weapon':{ #'Potion of Rage':1, 'Potion of Heroism':1, 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Rune of Absorbtion':1, 'Breastplate, 17 century':1, 'Halberd':1, 'Sabre +1':1, 'Shield':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Hand Grenade':10, 'Smoke Grenade':1, #'Hand Mortar':1, #'2lb Bomb':3, }, } #---- # Союзники (армия) (Генри Эвери): metadict_chars['Warrior 1 lvl (артиллерист)'] = { 'base_unit':'Warrior 1 lvl (cannoneer artillery)', 'behavior':'warrior', } metadict_chars['Warrior 2 lvl (артиллерист-ветеран)'] = { 'base_unit':'Warrior 2 lvl (cannoneer artillery-veteran)', 'behavior':'warrior', } metadict_chars['Warrior 2 lvl (артиллерист-ветеран) (6lb Cannon)'] = { 'base_unit':'Warrior 2 lvl (cannoneer artillery-veteran)', 'behavior':'elite_warrior', 'equipment_weapon':{ 'Rune of Armor':1, '6lb Cannon, naval':1, '6lb Bar':100, '6lb Ball':100, }, 'mount_combat':True, 'mount_type':'6lb Cannon, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 2 lvl (артиллерист-ветеран) (2lb Falconet)'] = { 'base_unit':'Warrior 2 lvl (cannoneer artillery-veteran)', 'behavior':'elite_warrior', 'equipment_weapon':{ 'Rune of Armor':1, '2lb Falconet':1, #'2lb Ball':100, '2lb Bomb':100, }, 'mount_combat':True, 'mount_type':'2lb Cannon, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 3 lvl (артиллерист-капрал)'] = { 'base_unit':'Warrior 3 lvl (cannoneer artillery-corporal)', 'behavior':'warrior', } metadict_chars['Warrior 3 lvl (артиллерист-капрал) (6lb Cannon)'] = { 'base_unit':'Warrior 3 lvl (cannoneer artillery-corporal)', 'behavior':'elite_warrior', 'equipment_weapon':{ 'Rune of Armor':1, '6lb Cannon, naval':1, '6lb Bar':100, '6lb Ball':100, }, 'mount_combat':True, 'mount_type':'6lb Cannon, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 3 lvl (артиллерист-капрал) (12lb Cannon)'] = { 'base_unit':'Warrior 3 lvl (cannoneer artillery-corporal)', 'behavior':'elite_warrior', 'equipment_weapon':{ 'Rune of Armor':1, '12lb Cannon, naval':1, '12lb Bar':100, '12lb Ball':100, }, 'mount_combat':True, 'mount_type':'12lb Cannon, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 4 lvl (артиллерист-сержант)'] = { 'base_unit':'Warrior 4 lvl (cannoneer artillery-sergeant)', 'behavior':'commander', } metadict_chars['Warrior 4 lvl (артиллерист-сержант) (12lb Mortar)'] = { 'base_unit':'Warrior 4 lvl (cannoneer artillery-sergeant)', 'behavior':'elite_warrior', 'equipment_weapon':{ 'Rune of Armor':1, '12lb Mortar':1, '12lb Bomb':100, }, 'mount_combat':True, 'mount_type':'12lb Mortar, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 4 lvl (артиллерист-сержант) (2lb Falconet)'] = { 'base_unit':'Warrior 4 lvl (cannoneer artillery-sergeant)', 'behavior':'elite_warrior', 'equipment_weapon':{ 'Rune of Armor':1, '2lb Falconet':1, '2lb Ball':100, #'2lb Bomb':100, }, 'mount_combat':True, 'mount_type':'2lb Cannon, chassis', 'equipment_mount':{}, } metadict_chars['Warrior 5 lvl (артиллерист-лейтенант)'] = { 'base_unit':'Warrior 5 lvl (cannoneer artillery-lieutenant)', } #---- # Союзники (свита) (Генри Эвери): metadict_chars['Fighter 11 lvl (Люсьен де ла Помпаж)'] = { # Тестовый вариант Эвери -- мастера боевых искусств. Боль-боль-боль, всего 17% шансы против кенсэя. # Fighter 1 lvl (legionary slayer-rookie) sum:100 STR:19 DEX:18 CON:19 INT:15 WIS:12 CHA:17 # Commanding_Presence даёт +1d10 к проверкам Харизмы (Запугивание, Выступление, Убеждение) # Tactical_Assessment даёт +1d10 к проверкам Мудрости (Проницательность) и Интеллекта (История, Анализ) 'level':11, 'fearless_AI':True, 'hunter_AI':True, 'sneak_AI':True, 'char_class':'Battlemaster', 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':19, 'dexterity':18, 'constitution':19, 'intelligence':15, 'wisdom':12, 'charisma':17, }, 'class_features':{ 'Feat_Shield_Master':True, 'Feat_Heavy_Armor_Master':True, 'Fighting_Style_Defence':True, 'Second_Wind':True, 'Action_Surge':True, 'Extra_Attack':True, 'Indomitable':True, 'Ability_Score_Improvement':{ 'strength':+1, 'constitution':+1, }, # Мастер боевых искусств: 'Martial_Archetype_Battlemaster':True, 'Combat_Superiority':True, 'Student_of_War':True, # Манёвры (11 lvl -- 7 приёмов, 5 костей превосходства 1d10): # TODO: # - Trip_Attack -- сбивание с ног. # - Grappling_Strike -- захват атакой. # - Bait_and_Switch -- обмен позициями и +1d10 к AC себя/союзника на ход. #'Parry':True, 'Menacing_Attack':True, 'Disarming_Attack':True, 'Precision_Attack':True, 'Commanding_Presence':True, 'Tactical_Assessment':True, #'Bait_and_Switch':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Antidote':1, 'Infusion of Heroism':1, 'Rune of Shielding':2, 'Plate Armor +1':1, 'Heavy Shield +1':1, 'Rarity +2':1, 'Rapier +2':1, 'Pistol, Ashbeard':1, 'Muskete Bullet':30, #'Hand Grenade':10, 'Smoke Grenade':1, 'Poison Blade':40, }, } metadict_chars['Fighter 13 lvl (Генри Эвери)'] = { # Тестовый вариант Эвери -- мистического рыцаря. С Mirror_Image и Blur побеждает кенсэя в 60% случаев. # Fighter 1 lvl (legionary sentinel-battler) sum:103 STR:19 DEX:17 CON:18 INT:16 WIS:16 CHA:17 # Использует "Обнаружение мыслей" (Detect_Thoughts), чтобы читать мысли других. 'level':13, 'fearless_AI':True, 'hunter_AI':True, 'no_grappler_AI':True, 'char_class':'Eldritch_Knight', 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':19, 'dexterity':17, 'constitution':18, 'intelligence':16, 'wisdom':16, 'charisma':17, }, 'class_features':{ # TODO: # - Eldritch_Strike -- удачный удар = помеха на спасброски от закл. до конца следующего хода. 'Feat_War_Caster':True, 'Feat_Shield_Master':True, 'Feat_Heavy_Armor_Master':True, 'Feat_Inspiring_Leader':True, 'Ability_Score_Improvement':{ 'strength':+1, 'intelligence':+2, }, 'Fighting_Style_Blind_Fighting':True, 'Second_Wind':True, 'Action_Surge':True, # Мистический рыцарь 'Martial_Archetype_Eldritch_Knight':True, 'Weapon_Bond':True, 'Spellcasting':True, 'Spells':[ # 9 заклинаний на 13 lvl (2 заклинания вне школ evocation и abjuration) ('cantrip', 'Message'), ('cantrip', 'Green_Flame_Blade'), #('cantrip', 'Blade_Ward'), #('ritual', 'Alarm'), ('1_lvl', 'Shield'), #('2_lvl', 'Shield'), #('1_lvl', 'Fog_Cloud'), ('2_lvl', 'Mirror_Image'), ('3_lvl', 'Blur'), ('2_lvl', 'Darkness'), #('2_lvl', 'Flaming_Sphere'), #('2_lvl', 'Detect_Thoughts'), ('2_lvl', 'Gust_of_Wind'), ('2_lvl', 'Warding_Wind'), ('3_lvl', 'Counterspell'), ('3_lvl', 'Fireball'), ], 'Extra_Attack':True, 'Indomitable':True, 'War_Magic':True, 'Eldritch_Strike':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # TODO: руны 3 круга #'Infusion of Regeneration':1, 'Rune of Absorbtion':2, 'Plate Armor +1':1, 'Heavy Shield +1':1, #'Sword of Flame Tongue':1, #'Sword of Life-Stealing':1, #'Longsword +2':1, 'Rarity +2':1, }, } #---- # Противник (армия) (Гангсвэй, Gunsway): metadict_chars['Commoner 1 lvl (паломник с Ганг-и-Савайя)'] = { 'base_unit':'Commoner 1 lvl (militia bowman)', 'behavior':'warrior', 'equipment_weapon':{ 'Dagger':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Commoner 2 lvl (дворянин с Ганг-и-Савайя)'] = { 'base_unit':'Commoner 2 lvl (militia bowman-veteran)', 'behavior':'warrior', 'weapon_skill':['simple','martial'], 'equipment_weapon':{ 'Shield':1, 'Scimitar':1, 'Shortbow':1, 'Arrow':40, }, } metadict_chars['Warrior 3 lvl (охранник с Ганг-и-Савайя)'] = { 'base_unit':'Warrior 3 lvl (sqythian bowman-corporal)', 'behavior':'elite_warrior', 'equipment_weapon':{ 'Rune of Armor':1, 'Shield':1, 'Scimitar':1, 'Longbow':1, 'Arrow':40, #'Pistol, Lorenzony':1, #'Muskete Bullet':30, }, } metadict_chars['Warrior 4 lvl (охранник-сержант с Ганг-и-Савайя)'] = { 'base_unit':'Warrior 4 lvl (sqythian bowman-sergeant)', 'equipment_weapon':{ 'Rune of Armor':1, 'Rune of Shielding':1, 'Shield':1, 'Scimitar':1, 'Longbow':1, 'Arrow':40, #'Pistol, Lorenzony':1, #'Muskete Bullet':30, }, } metadict_chars['Warrior 5 lvl (охранник-лейтенант с Ганг-и-Савайя)'] = { 'base_unit':'Warrior 5 lvl (sqythian bowman-lieutenant)', 'equipment_weapon':{ 'Rune of Armor':1, 'Rune of Shielding':1, 'Rune of Absorbtion':1, 'Shield':1, 'Scimitar +1':1, 'Longbow':1, 'Arrow':40, #'Pistol, Lorenzony':1, #'Muskete Bullet':30, }, } #---- # Противник (армия) (Аурелис): metadict_chars['Ranger 5 lvl (лейтенант Аурелиса) (следопыт)'] = { # Шайтаны 'volley_AI':True, 'base_unit':'Ranger 5 lvl (otherworld wanderer-lieutenant)', 'race':'Primevial-medium-hero', 'equipment_weapon':{ 'Potion of Heroism':1, 'Potion of Antidote':1, 'Infusion of Regeneration':1, 'Rune of Armor':1, 'Rune of Shielding':1, 'Shield':1, 'Longsword +1':1, 'Longbow, Black Skies':1, 'Seeking Arrow':60, 'Sleep Blade':60, #'Poison Blade':40, }, } metadict_chars['Barbarian 5 lvl (лейтенант Аурелиса) (берсерк)'] = { 'volley_AI':True, 'base_unit':'Barbarian 5 lvl (thracian slayer-lord)', 'race':'Primevial-medium-hero', 'equipment_weapon':{ 'Potion of Heroism':1, 'Potion of Antidote':1, 'Infusion of Regeneration':1, #'Rune of Armor':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Heavy Shield':1, 'Greatsword +1':1, 'Longbow, Black Skies':1, 'Seeking Arrow':60, 'Sleep Blade':60, }, } metadict_chars['Warrior 5 lvl (лейтенант Аурелиса)'] = { 'level':5, 'char_class':'Warrior-bowman', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Sharpshooter':True, 'Extra_Attack':True, }, 'race':'Primevial-medium', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Potion of Heroism':1, 'Potion of Antidote':1, 'Infusion of Regeneration':1, 'Rune of Armor':1, 'Rune of Shielding':1, 'Shield':1, 'Longsword +1':1, 'Longbow, Black Skies':1, 'Seeking Arrow':60, 'Sleep Blade':60, #'Poison Blade':40, }, } #---- # Противник (армия) (Салиф): metadict_chars['Warrior 4 lvl (гвардеец Салифа)'] = { 'level':4, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Protection':True, 'Feat_Magic_Initiate':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mending'), ('cantrip', 'Acid_Splash'), ('ritual', 'Unseen_Servant'), ], }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Potion of Rage':1, 'Potion of Heroism':1, 'Potion of Antidote':1, 'Rune of Armor':1, 'Rune of Absorbtion':1, 'Heavy Shield':1, 'Sabre':1, 'Longbow':1, 'Poison Arrow':40, 'Poison Blade':10, #'Flame Grenade':10, 'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (лейтенант Салифа)'] = { 'level':5, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Protection':True, 'Feat_Magic_Initiate':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mending'), ('cantrip', 'Acid_Splash'), ('ritual', 'Unseen_Servant'), ], 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Potion of Rage':1, 'Potion of Heroism':1, 'Potion of Antidote':1, 'Rune of Armor':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Heavy Shield':1, 'Sabre':1, 'Longbow':1, 'Poison Arrow':40, 'Poison Blade':10, #'Flame Grenade':10, 'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Противник (свита) (Салиф): metadict_chars['Wizard 13 lvl (Салиф)'] = { # Wizard 1 lvl (otherworld mage-disciple) sum:94 STR:13 DEX:17 CON:16 INT:19 WIS:14 CHA:15 # Черты: # - Feat_Alert, -- нельзя застать врасплох. # - Feat_Keen_Mind -- помнит всё. # - Feat_Metamagic_Adept -- удвоенная дальность Arcane_Gate и неощутимые Mass_Suggestion # Заклинания: # - Изготовление (Fabricate) для ремонта корабля в бою. # - Предосторожность (Contingency) хранит заклинание Wall_of_Force. # - Волшебные врата (Arcane_Gate), портал для солдат на 1000 футов (с Metamagic_Distant_Spell) # - Гомункул (Create_Homunculus), это разведчик с телепатической связью для телепортов. 'level':13, 'fireball_AI':True, 'disengage_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':13, 'dexterity':17, 'constitution':16, 'intelligence':19, 'wisdom':14, 'charisma':15, }, 'class_features':{ 'Feat_Alert':True, 'Feat_Keen_Mind':True, 'Feat_Metamagic_Adept':True, 'Metamagic_Subtle_Spell':True, 'Metamagic_Distant_Spell':True, 'Ability_Score_Improvement':{ 'dexterity':+1, 'intelligence':+1, 'charisma':+1, }, 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ # Уровень_персонажа + мод_интеллекта (18 заклинаний) ('cantrip', 'Prestidigitation'), ('cantrip', 'Acid_Splash'), ('cantrip', 'Mending'), ('cantrip', 'Message'), ('cantrip', 'Mage_Hand'), # Ритуалы из книги заклинаний: ('ritual', 'Alarm'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('ritual', 'Gentle_Repose'), ('ritual', 'Find_Familiar'), ('ritual', 'Comprehend_Languages'), ('ritual', 'Feign_Death'), ('ritual', 'Water_Breathing'), ('ritual', 'Rary_Telepathic_Bond'), ('ritual', 'Contact_Other_Plane'), # Для свиты (6 заклинаний): # TODO: допиливай Dust_Devil подобно Flaming_Sphere. ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'See_Invisibility'), ('2_lvl', 'Invisibility'), ('2_lvl', 'Dust_Devil'), # Личные (12 заклинаний): ('3_lvl', 'Counterspell'), ('3_lvl', 'Sleet_Storm'), ('3_lvl', 'Sending'), ('4_lvl', 'Fabricate'), ('4_lvl', 'Dimension_Door'), ('4_lvl', 'Conjure_Minor_Elementals'), ('5_lvl', 'Conjure_Elemental'), ('5_lvl', 'Planar_Binding'), ('5_lvl', 'Scrying'), ('6_lvl', 'Arcane_Gate'), ('6_lvl', 'Mass_Suggestion'), ('7_lvl', 'Teleportation'), # ---- # Книга заклинаний (все 1-3 lvl): # ---- #('3_lvl', 'Blink'), #('3_lvl', 'Animate_Dead'), #('3_lvl', 'Dispel_Magic'), #('3_lvl', 'Melf_Minute_Meteors'), #('3_lvl', 'Summon_Lesser_Demons'), # ---- #('4_lvl', 'Stoneskin'), #('4_lvl', 'Arcane_Eye'), #('4_lvl', 'Control_Water'), #('4_lvl', 'Leomund_Secret_Chest'), #('4_lvl', 'Otiluke_Resilent_Sphere'), #('4_lvl', 'Mordenkainen_Private_Sanctum'), #('4_lvl', 'Conjure_Minor_Elementals'), #('4_lvl', 'Summon_Greater_Demon'), #('4_lvl', 'Sickening_Radiance'), #('4_lvl', 'Banishment'), # ---- #('5_lvl', 'Animated_Objects'), #('5_lvl', 'Conjure_Elemental'), #('5_lvl', 'Planar_Binding'), #('5_lvl', 'Wall_of_Force'), #('5_lvl', 'Passwall'), #('5_lvl', 'Scrying'), #('5_lvl', 'Cone_of_Cold'), #('5_lvl', 'Cloudkill'), #('5_lvl', 'Teleportation_Circle'), # ---- #('6_lvl', 'Soul_Cage'), #('6_lvl', 'Arcane_Gate'), #('6_lvl', 'True_Seeing'), #('6_lvl', 'Contingency'), #('6_lvl', 'Mass_Suggestion'), #('6_lvl', 'Programmed_Illusion'), #('6_lvl', 'Create_Homunculus'), #('6_lvl', 'Whirlwind'), # ---- #('7_lvl', 'Teleportation'), #('7_lvl', 'Mordenkainens_Magnificent_Mansion'), ], # TODO: телепорт с Benign_Transposition и автоуспех концентрации с Focused_Conjuration 'School_of_Conjuration':True, 'Minor_Conjuration':True, 'Benign_Transposition':True, 'Focused_Conjuration':True, #'Durable_Summons':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # TODO: руны 3-4 круга # - Rune of Flying # - Rune of Stoneskin # - Rune of Greater Invisibility 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } metadict_chars['Wizard 4 lvl (волшебник Салифа)'] = { 'level':4, 'archer_AI':True, 'fireball_AI':True, 'char_class':'Wizard', 'hit_dice':'1d6', 'behavior':'commander', 'class_features':{ 'Feat_Alert':True, 'Ability_Score_Improvement':{ 'intelligence':+2, }, 'Arcane_Recovery':True, 'Spellcasting':True, 'Spells':[ # Уровень_персонажа + мод_интеллекта (8 заклинаний) ('cantrip', 'Prestidigitation'), ('cantrip', 'Acid_Splash'), ('cantrip', 'Mending'), ('cantrip', 'Message'), # Ритуалы из книги заклинаний: ('ritual', 'Alarm'), ('ritual', 'Identify'), ('ritual', 'Detect_Magic'), ('ritual', 'Unseen_Servant'), ('ritual', 'Gentle_Repose'), ('ritual', 'Find_Familiar'), ('ritual', 'Comprehend_Languages'), ('1_lvl', 'Shield'), ('1_lvl', 'Fog_Cloud'), ('1_lvl', 'Absorb_Elements'), ('2_lvl', 'See_Invisibility'), ('2_lvl', 'Invisibility'), ('2_lvl', 'Dust_Devil'), ], 'School_of_Conjuration':True, 'Minor_Conjuration':True, 'Benign_Transposition':True, }, 'race':'Human-hero', 'weapon_skill':['simple'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Rune of Armor':1, 'Dagger':1, }, #'mount_combat':True, #'mount_type':'Light Warhorse', #'equipment_mount':{ # }, } #---- # Противник (армия) (Намулис): metadict_chars['Warrior 4 lvl (гвардеец Намулиса)'] = { 'level':4, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'elite_warrior', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Defensive_Duelist':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Potion of Rage':1, 'Potion of Heroism':1, 'Potion of Antidote':1, 'Rune of Armor':1, 'Rune of Absorbtion':1, 'Shield':1, 'Sabre':1, 'Glaive':1, 'Longbow':1, 'Poison Arrow':40, 'Poison Blade':10, #'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } metadict_chars['Warrior 5 lvl (лейтенант Намулиса)'] = { 'level':5, 'char_class':'Warrior-pirate', 'hit_dice':'1d8', 'behavior':'commander', 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Defensive_Duelist':True, 'Extra_Attack':True, }, 'race':'Human-common', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Potion of Rage':1, 'Potion of Heroism':1, 'Potion of Antidote':1, 'Rune of Armor':1, 'Rune of Absorbtion':1, 'Rune of Shielding':1, 'Shield':1, 'Glaive':1, 'Sabre +1':1, 'Longbow':1, 'Poison Arrow':40, 'Poison Blade':10, #'Smoke Grenade':1, }, #'mount_combat':False, #'mount_type':'Riding Horse', #'equipment_mount':{ # }, } #---- # Противник (свита) (Намулис): metadict_chars['Monk 13 lvl (Намулис)'] = { # Кенсэй # Monk 1 lvl (city windsong-apprentice) sum:97 STR:16 DEX:19 CON:17 INT:14 WIS:19 CHA:12 # Tongue_of_the_Sun_and_Moon -- говорит на любом языке. 'level':13, #'grappler_AI':True, 'fireball_AI':True, 'carefull_AI':True, 'char_class':'Monk', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ 'strength':16, 'dexterity':19, 'constitution':17, 'intelligence':14, 'wisdom':19, 'charisma':12, }, 'class_features':{ # TODO: # ------ # 1. Stillness_of_Mind -- действием снимает очарование или испуг. # 2. Unarmored_Movement_improvement -- бег по вертикальным стенам и воде. # ------ 'Feat_Sharpshooter':True, 'Feat_Weapon_Master':True, 'Fighting_Style_Archery':True, 'Feat_Defensive_Duelist':True, 'Ability_Score_Improvement':{ 'wisdom':+1, 'dexterity':+1, }, # Кенсэй: 'Agile_Parry':True, #'Kensei_Weapons':['Saber','Longbow','Glaive','Chakram'], 'Kensei_Weapons':['simple','martial'], 'Kensei_Shot':'1d4', 'Magic_Kensei_Weapons':True, 'Deft_Strike':True, 'Sharpen_the_Blade':True, # Базовые способности монаха: 'Unarmored_Defense':True, 'Martial_Arts':True, 'Flurry_of_Blows':True, 'Patient_Defense':True, 'Step_of_the_Wind':True, 'Unarmored_Movement':True, 'Deflect_Missiles':True, 'Slow_Fall':True, 'Extra_Attack':True, 'Stunning_Strike':True, 'Ki_Empowered_Strikes':True, 'Evasion':True, 'Stillness_of_Mind':True, 'Unarmored_Movement_improvement':True, 'Purity_of_Body':True, 'immunity':['poison','disease'], 'Tongue_of_the_Sun_and_Moon':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':[], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # TODO: # 3. Руны 3-4 круга. 'Potion of Antidote':1, 'Infusion of Vitality':1, 'Infusion of Heroism':1, 'Rune of Shielding':1, 'Bracers of Defence':1, #'Sword of Sharpness':1, #'Sword of Hopesfire':1, 'Sword of Flame Tongue':1, 'Longbow':1, 'Poison Arrow':80, 'Sleep Blade':10, 'Chakram':10, }, } #---- # Свои (Динки) (Томас Стью): metadict_chars['Warlock 5 lvl (Динки) (Томас Стью)'] = { # Эксперт в скрытности, +10 и +20 под Pass_Without_Trace. Также +10 ловкости рук. # Pact_of_the_Chain: фамильяр -- попугай 'level':5, 'fireball_AI':True, 'char_class':'Warlock', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_medial':True, 'abilityes':{ # Народность (шайтан): +2 харизме; # Народность (шайтан): +2 ловкость 'strength':11, 'dexterity':18+2, 'constitution':16, 'intelligence':13, 'wisdom':10, 'charisma':18+2, }, 'class_features':{ # Расовые способности в классе, чтобы было видно: 'immunity':['sleep'], 'resistance':['charmed'], 'Darkvision':60, # ---- 'Feat_Elemental_Adept':'fire', 'Otherworldly_Patron':'Efreeti', 'Pact_Magic':True, 'Spells':[ # 3 кантрипа и 6 заклинаний на 5 lvl ('cantrip','Create_Bonfire'), ('cantrip','Minor_Illusion'), ('cantrip','Mage_Hand'), ('cantrip','Silent_Image'), ('ritual', 'Find_Familiar'), ('3_lvl','Invisibility'), ('3_lvl','Enhance_Ability'), ('3_lvl','Phantasmal_Force'), ('3_lvl','Armor_of_Agathys'), ('3_lvl','Fireball'), ('3_lvl','Tongues'), #('3_lvl','Hypnotic_Pattern'), ], 'Pact_Boon':True, 'Pact_of_the_Chain':True, 'Genies_Vessel':True, 'Genies_Wrath':'fire', 'Bottled_Respite':True, 'Eldritch_Invocations':True, 'Invocation_Misty_Visions':True, 'Invocation_Mask_of_Many_Faces':True, 'Invocation_Voice_of_the_Chain_Master':True, }, 'race':'Primevial-medium-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light'], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Infusion of Heroism':1, #'Infusion of Claws':1, 'Rune of Shielding':1, 'Rune of Absorbtion':1, 'Rune of Armor':1, 'Rarity +2':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, 'Smoke Grenade':1, }, } #---- # Свои (Shady) (Тенза Йозора): metadict_chars['Warrior 3 lvl (Тензина девчонка)'] = { 'base_unit':'Warrior 3 lvl (fusilier line-infantry-corporal)', 'behavior':'elite_warrior', 'equipment_weapon':{ 'Infusion of Longstrider':1, 'Scimitar':1, 'Shield':1, 'Muskete, Lorenzony':1, 'Muskete Bullet':30, 'Smoke Grenade':1, }, } metadict_chars['Warrior 4 lvl (Тензина девчонка поопытнее)'] = { 'base_unit':'Warrior 4 lvl (fusilier line-infantry-sergeant)', 'equipment_weapon':{ 'Rune of Armor':1, 'Infusion of Longstrider':1, 'Scimitar':1, 'Shield':1, 'Muskete, Lorenzony':1, 'Muskete Bullet':30, 'Smoke Grenade':1, }, } metadict_chars['Warrior 5 lvl (Шакти)'] = { 'base_unit':'Warrior 5 lvl (fusilier line-infantry-lieutenant)', 'hitpoints_medial':True, 'abilityes':{ 'strength':12, 'dexterity':16, 'constitution':14, 'intelligence':10, 'wisdom':6, 'charisma':16, }, 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Inspiring_Leader':True, 'Extra_Attack':True, }, 'equipment_weapon':{ 'Rune of Armor':1, 'Rune of Message':1, 'Infusion of Longstrider':1, 'Dagger':1, #'Scimitar':1, #'Muskete, Brown Bess':1, #'Muskete Bullet, bess':30, 'Smoke Grenade':1, }, } metadict_chars['Artificier 5 lvl (Shady) (Тенза Йозора)'] = { 'level':5, 'sneak_AI':True, 'fireball_AI':True, #'enslave_AI':True, #'defence_AI':True, #'grenadier_AI':True, #'firearm_AI':True, 'char_class':'Artificier', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_base':8 + 4*5, 'abilityes':{ # Монгол; +1 выносливость, +1 ловкость 'strength':9, 'dexterity':17+1, 'constitution':11+1, 'intelligence':18+2, 'wisdom':18, 'charisma':13, }, 'class_features':{ 'Feat_Linguist':True, 'Feat_Healer':True, 'Feat_Skill_Expert':'medicine', 'Spellcasting':True, 'Spells':[ # Подготовленные заклинания: 4 доменных +7 (+5 ИНТ +2 УРОВЕНЬ/2) ('cantrip', 'Mending'), ('cantrip', 'Mage_Hand'), ('1_lvl', 'Healing_Word'), #('1_lvl', 'Ray_of_Sickness'), ('1_lvl', 'Expeditious_Retreat'), ('1_lvl', 'Sanctuary'), #('1_lvl', 'Identify'), #('1_lvl', 'Alarm'), #('1_lvl', 'Detect_Magic'), #('1_lvl', 'Purify_Food_and_Drink'), ('2_lvl', 'Flaming_Sphere'), #('2_lvl', 'Melfs_Acid_Arrow'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'See_Invisibility'), ('2_lvl', 'Invisibility'), #('2_lvl', 'Blur'), #('2_lvl', 'Web'), #('2_lvl', 'Enhance_Ability'), #('2_lvl', 'Continual_Flame'), #('2_lvl', 'Arcane_Lock'), #('2_lvl', 'Magic_Mouth'), #('2_lvl', 'Skywrite'), ], 'Magical_Tinkering':True, 'Infuse_Item':True, 'The_Right_Tool_for_the_Job':True, 'Artificier_Alchemist':True, 'Experimental_Elixir':True, 'Alchemical_Savant':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'skills':[ # Инструменты (аристократка): инструменты каллиграфа, инструменты картографа # Инструменты (изобретатель): воровские инструменты, инструменты жестянщика, инструменты пивовара # Инструменты (изобретатель-алхимик): инструменты алхимика 'History', 'Nature', 'Religion', 'Animal_Handling', 'Insight', 'Medicine', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ #'Infusion of Claws':1, #'Potion of Rage':1, 'Potion of Heroism':1, 'Potion of Antidote':1, 'Potion of Boldness':1, 'Potion of Resilience':1, # ---- 'Rune of Armor':1, 'Rune of Message':1, 'Rune of Shielding':1, 'Scimitar +1':1, 'Shield':1, #'Muskete, Lorenzony':1, #'Pistol, Lorenzony':1, #'Muskete Bullet':30, '10lb Bomb, mine':2, 'Smoke Grenade':1, }, } #---- # Свои (Katorjnik) (Питер Янсен): metadict_chars['Ranger 5 lvl (Katorjnik) (Питер Янсен)'] = { 'level':5, #'sneak_AI':True, 'striker_AI':True, 'firearm_AI':True, #'defence_AI':True, #'killer_AI':True, 'char_class':'Ranger', 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_base':10 + 6*4, 'abilityes':{ # Голландец; +1 мудрость, +1 ловкость 'strength':14, 'dexterity':18+1, 'constitution':12, 'intelligence':10, 'wisdom':17+1, 'charisma':15, }, 'class_features':{ 'Fighting_Style_Archery':True, 'Feat_Firearms_Expert':True, 'Feat_Sharpshooter':True, 'Feat_Alert':True, 'Favored_Enemy':['humans', 'spain'], 'Natural_Explorer':['sea', 'coast'], 'Spellcasting':True, 'Spells':[ #('ritual', 'Beast_Sense'), ('1_lvl', 'Hunters_Mark'), ('1_lvl', 'Hail_of_Thorns'), ('2_lvl', 'Pass_Without_Trace'), ('2_lvl', 'Lesser_Restoration'), ], 'Primeval_Awareness':True, 'Ranger_Archetype_Hunter':True, 'Hunter_Colossus_Slayer':'1d8', 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'skills':[ # Инструменты (моряк): Инструменты навигатора, транспорт (водный) # Инструменты (следопыт): Инструменты каллиграфа, инструменты картографа 'Athletics', 'Stealth', 'Insight', 'Perception', 'Survival', 'Persuasion', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # Настройка на штуцер Шварц Марка и две руны. 'Rune of Armor':1, 'Rune of Absorbtion':1, 'Bracers of Silver':1, 'Sabre':1, 'Shield':1, 'Rifle, Schwartz Mark':1, #'Pistol, Lorenzony':1, 'Muskete Bullet':90, 'Smoke Grenade':2, }, } #---- # Свои (Волшебник) (Тобиас Олдридж): metadict_chars['Fighter 5 lvl (Волшебник) (Тобиас Олдридж)'] = { 'level':5, #'defence_AI':True, 'striker_AI':True, 'no_grappler_AI':True, 'char_class':'Battlemaster', 'hit_dice':'1d10', 'behavior':'commander', 'hitpoints_base':10 + 6*4, 'abilityes':{ # Англичанин; +1 мудрость, +1 обаяние # Черта: Отличная память (+ 1 интеллект) # Черта: Языковед (+ 1 интеллект) # Черта: Внимательный (+ 1 мудрость) 'strength':9, 'dexterity':16, 'constitution':8, 'intelligence':18+2, 'wisdom':18+2, 'charisma':17+1, }, 'class_features':{ # TODO: Feat_Martial_Adept даёт +1 кость превосходство, это эффект рапиры. Предмет допили. 'Feat_Martial_Adept':True, 'Feat_Keen_Mind':True, 'Feat_Observant':True, 'Feat_Linguist':True, 'Feat_Defensive_Duelist':True, 'Fighting_Style_Dueling':True, 'Second_Wind':True, 'Action_Surge':True, 'Martial_Archetype_Battlemaster':True, 'Combat_Superiority':True, 'Student_of_War':True, 'Disarming_Attack':True, 'Precision_Attack_Close':True, 'Feinting_Attack':True, 'Extra_Attack':True, }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','heavy','shield'], 'skills':[ # Инструменты (благородный): Инструменты каллиграфа, Набор для фальсификации # Инструменты (воин): Шахматы # Инструменты (казначей): Набор казначея 'History', 'Investigation', 'Insight', 'Perception', 'Persuasion', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ # Честь дороже жизни. Щитом не пользуется. #'Shield, Bladebreaker':1, 'Rune of Armor':1, 'Rune of Shielding':2, 'Rapier of Sharpness':1, 'Pistol, Lorenzony':1, 'Muskete Bullet':30, #'Smoke Grenade':1, }, } #---- # Свои (Endeavour) (Джон Кук): metadict_chars['Bard 5 lvl (firesalamander) (Джон Кук)'] = { # TODO: Combat_Inspiration допиливай. # Бонусы вдохновения к урону -- польза сомнительная. Нужно потестить. # Бонусы вдохновения к AC -- только пока неясен успех атаки врага. 'level':5, 'striker_AI':True, 'fireball_AI':True, 'char_class':'Bard', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_base':8 + 4*5, 'abilityes':{ # Народность (метис): +2 харизме; # Народность (метис): +1 мудрость, +1 сила; # Черта (Шеф-повар): +1 мудрости; 'strength':10+1, 'dexterity':18, 'constitution':8, 'intelligence':14, 'wisdom':18+2, 'charisma':18+2, }, 'class_features':{ # Расовые способности в классе, чтобы было видно: 'immunity':['sleep'], 'resistance':['charmed'], 'Darkvision':60, # ---- 'Feat_Chef':True, 'Feat_Healer':True, 'Bardic_Inspiration':True, 'Spellcasting':True, 'Spells':[ ('cantrip', 'Mending'), ('cantrip', 'Mage_Hand'), ('cantrip', 'Message'), ('ritual', 'Unseen_Servant'), ('ritual', 'Comprehend_Languages'), ('1_lvl', 'Sleep'), ('1_lvl', 'Expeditious_Retreat'), ('2_lvl', 'Knock'), ('2_lvl', 'Calm_Emotions'), ('3_lvl', 'Catnap'), ('3_lvl', 'Fear'), ('3_lvl', 'Sleep'), ], 'Jack_of_All_Trades':True, 'Song_of_Rest':True, 'College_of_Valor':True, 'Combat_Inspiration':True, 'Expertise':['Survival','Deception'], 'Font_of_Inspiration':True, }, 'race':'Half-elf-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'skills':[ # Инструменты (бард): флейта, барабаны, волынка # Инструменты (шарлатан): набор для грима, набор для фальсификации # Инструменты (кок): набор для готовки 'Sleight_of_Hand', 'Medicine', 'Perception', 'Survival', 'Deception', 'Performance', 'Persuasion', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Rune of Absorbtion':1, 'Rune of Shielding':2, 'Armor, One-of-Many':1, 'Shield':1, 'Rapier':1, 'Hand Grenade':2, #'Pistol, Lorenzony':1, #'Muskete Bullet':30, #'Smoke Grenade':1, }, } #---- # Свои (Гримсон) (Тим Серый): metadict_chars['Artificier 5 lvl (Гримсон) (Тим Серый)'] = { 'level':5, #'accurate_AI':True, 'striker_AI':True, 'firearm_AI':True, 'fireball_AI':True, 'no_grappler_AI':True, 'disengage_AI':True, 'char_class':'Artificier', 'hit_dice':'1d8', 'behavior':'commander', 'hitpoints_base':8 + 4*5, 'abilityes':{ # Человек; +1 ловкость, +1 интеллект # Черта (???): +1 интеллект 'strength':13, 'dexterity':13+1, 'constitution':14, 'intelligence':18+2, 'wisdom':18, 'charisma':10, }, 'class_features':{ 'Feat_Spellsniper':True, 'Feat_Sharpshooter':True, 'Feat_Telekinetic':True, 'Spellcasting':True, 'Spells':[ # Подготовленные заклинания: 4 доменных +7 (+5 ИНТ +2 УРОВЕНЬ/2) # Scorching_Ray закомментирован, чтобы не жрал слоты. Слабое заклинание. ('cantrip', 'Magic_Stone'), ('cantrip', 'Mending'), ('cantrip', 'Mage_Hand'), ('cantrip', 'Shocking_Grasp'), ('ritual', 'Purify_Food_and_Drink'), ('ritual', 'Detect_Magic'), ('ritual', 'Skywrite'), ('1_lvl', 'Shield'), ('1_lvl', 'Thunderwave'), ('1_lvl', 'Absorb_Elements'), ('1_lvl', 'Cure_Wounds'), #('2_lvl', 'Scorching_Ray'), ('2_lvl', 'Shatter'), ('2_lvl', 'Lesser_Restoration'), ('2_lvl', 'Levitate'), ], 'Magical_Tinkering':True, 'Infuse_Item':True, 'The_Right_Tool_for_the_Job':True, 'Artificier_Artillerist':True, 'Eldritch_Cannon':True, 'Eldritch_Cannon_Control_Distance':60, 'Arcane_Firearm':'1d8', }, 'race':'Human-hero', 'weapon_skill':['simple','martial'], 'armor_skill':['light','medium','shield'], 'skills':[ # Инструменты (происхождение): инструменты кузнеца, инструменты работы плотника # Инструменты (изобретатель): воровские инструменты, инструменты ремотнтика, инструменты для работы с кожей # Инструменты (изобретатель-артиллерист): инструменты резчика по дереву 'Arcana', 'History', 'Nature', 'Religion', 'Perception', ], 'equipment_supply':soldier_supply, 'equipment_backpack':soldiers_pack, 'equipment_weapon':{ 'Infusion of Longstrider':1, 'Rune of Shielding':2, 'Half Plate, 17 century':1, 'Shield, Bladebreaker':1, 'Equalizer':1, 'Magic Boom-stone':3, '10lb Bomb, mine':1, 'Smoke Grenade':1, }, 'mount_combat':True, #'mount_type':'Eldritch Cannon (flamethrower)', #'mount_type':'Eldritch Cannon (force ballista)', 'mount_type':'Eldritch Cannon (protector)', 'equipment_mount':{ '10lb Bomb, mine':4, 'Smoke Grenade':4, }, }
29.188831
133
0.551602
0
0
0
0
0
0
0
0
291,163
0.631241
1953a970695d2673fad8c3f0a83d3f344f3fbfa4
5,647
py
Python
sandbox/kl_div/kl.py
samuelfneumann/RLControl
71430b1de2e4262483908932eb44579c2ec8216d
[ "Apache-2.0" ]
9
2018-07-30T20:12:47.000Z
2021-02-05T17:02:04.000Z
sandbox/kl_div/kl.py
samuelfneumann/RLControl
71430b1de2e4262483908932eb44579c2ec8216d
[ "Apache-2.0" ]
14
2020-01-28T22:38:58.000Z
2022-02-10T00:11:21.000Z
sandbox/kl_div/kl.py
samuelfneumann/RLControl
71430b1de2e4262483908932eb44579c2ec8216d
[ "Apache-2.0" ]
3
2018-08-08T14:52:53.000Z
2021-01-23T18:00:05.000Z
import numpy as np import scipy as sp import scipy.stats import matplotlib.pyplot as plt class GaussianMixture1D: def __init__(self, mixture_probs, means, stds): self.num_mixtures = len(mixture_probs) self.mixture_probs = mixture_probs self.means = means self.stds = stds def sample(self, num_samples=1): mixture_ids = np.random.choice(self.num_mixtures, size=num_samples, p=self.mixture_probs) result = np.zeros([num_samples]) for sample_idx in range(num_samples): result[sample_idx] = np.random.normal( loc=self.means[mixture_ids[sample_idx]], scale=self.stds[mixture_ids[sample_idx]] ) return result def logpdf(self, samples): mixture_logpdfs = np.zeros([len(samples), self.num_mixtures]) for mixture_idx in range(self.num_mixtures): mixture_logpdfs[:, mixture_idx] = scipy.stats.norm.logpdf( samples, loc=self.means[mixture_idx], scale=self.stds[mixture_idx] ) return sp.special.logsumexp(mixture_logpdfs + np.log(self.mixture_probs), axis=1) def pdf(self, samples): return np.exp(self.logpdf(samples)) def approx_kl(gmm_1, gmm_2, xs): ys = gmm_1.pdf(xs) * (gmm_1.logpdf(xs) - gmm_2.logpdf(xs)) return np.trapz(ys, xs) def minimize_pq(p, xs, q_means, q_stds): q_mean_best = None q_std_best = None kl_best = np.inf for q_mean in q_means: for q_std in q_stds: q = GaussianMixture1D(np.array([1]), np.array([q_mean]), np.array([q_std])) kl = approx_kl(p, q, xs) if kl < kl_best: kl_best = kl q_mean_best = q_mean q_std_best = q_std q_best = GaussianMixture1D(np.array([1]), np.array([q_mean_best]), np.array([q_std_best])) return q_best, kl_best def minimize_qp(p, xs, q_means, q_stds): q_mean_best = None q_std_best = None kl_best = np.inf for q_mean in q_means: for q_std in q_stds: q = GaussianMixture1D(np.array([1]), np.array([q_mean]), np.array([q_std])) kl = approx_kl(q, p, xs) if kl < kl_best: kl_best = kl q_mean_best = q_mean q_std_best = q_std q_best = GaussianMixture1D(np.array([1]), np.array([q_mean_best]), np.array([q_std_best])) return q_best, kl_best def main(): p_second_means_min = 0 p_second_means_max = 2 num_p_second_means = 5 p_second_mean_list = np.linspace(p_second_means_min, p_second_means_max, num_p_second_means) print('second mean: {}'.format(p_second_mean_list)) p = [None] * num_p_second_means q_best_forward = [None] * num_p_second_means kl_best_forward = [None] * num_p_second_means q_best_reverse = [None] * num_p_second_means kl_best_reverse = [None] * num_p_second_means for p_second_mean_idx, p_second_mean in enumerate(p_second_mean_list): p_mixture_probs = np.array([0.5, 0.5]) p_means = np.array([0, p_second_mean]) p_stds = np.array([0.2, 0.2]) p[p_second_mean_idx] = GaussianMixture1D(p_mixture_probs, p_means, p_stds) q_means_min = np.min(p_means) - 1 q_means_max = np.max(p_means) + 1 num_q_means = 100 q_means = np.linspace(q_means_min, q_means_max, num_q_means) q_stds_min = 0.37 q_stds_max = 5 num_q_stds = 100 q_stds = np.linspace(q_stds_min, q_stds_max, num_q_stds) trapz_xs_min = np.min(np.append(p_means, q_means_min)) - 3 * np.max(np.append(p_stds, q_stds_max)) trapz_xs_max = np.max(np.append(p_means, q_means_min)) + 3 * np.max(np.append(p_stds, q_stds_max)) num_trapz_points = 1000 trapz_xs = np.linspace(trapz_xs_min, trapz_xs_max, num_trapz_points) q_best_forward[p_second_mean_idx], kl_best_forward[p_second_mean_idx] = minimize_pq( p[p_second_mean_idx], trapz_xs, q_means, q_stds ) q_best_reverse[p_second_mean_idx], kl_best_reverse[p_second_mean_idx] = minimize_qp( p[p_second_mean_idx], trapz_xs, q_means, q_stds ) # plotting fig, axs = plt.subplots(nrows=1, ncols=num_p_second_means, sharex=True, sharey=True) # fig.set_size_inches(8, 1.5) for p_second_mean_idx, p_second_mean in enumerate(p_second_mean_list): xs_min = -1 xs_max = 4 num_plot_points = 1000 xs = np.linspace(xs_min, xs_max, num_plot_points) axs[p_second_mean_idx].plot(xs, p[p_second_mean_idx].pdf(xs), label='$p$', color='black') axs[p_second_mean_idx].plot(xs, q_best_forward[p_second_mean_idx].pdf(xs), label='$\mathrm{argmin}_q \,\mathrm{KL}(p || q)$', color='black', linestyle='dashed') axs[p_second_mean_idx].plot(xs, q_best_reverse[p_second_mean_idx].pdf(xs), label='$\mathrm{argmin}_q \,\mathrm{KL}(q || p)$', color='black', linestyle='dotted') axs[p_second_mean_idx].spines['right'].set_visible(False) axs[p_second_mean_idx].spines['top'].set_visible(False) # axs[p_second_mean_idx].set_yticks([]) # axs[p_second_mean_idx].set_xticks([]) axs[p_second_mean_idx].set_title('mean: [0, {}]'.format(p_second_mean)) axs[2].legend(ncol=3, loc='upper center', bbox_to_anchor=(0.5, 0), fontsize='small') filenames = ['reverse_forward_kl.pdf', 'reverse_forward_kl.png'] for filename in filenames: fig.savefig(filename, bbox_inches='tight', dpi=200) print('Saved to {}'.format(filename)) plt.show() if __name__ == '__main__': main()
38.155405
168
0.64583
1,160
0.205419
0
0
0
0
0
0
388
0.068709
1953dea348e57ea12a9ad8bb64e5c7842c0eba20
37,416
py
Python
pysnmp-with-texts/CIRCUIT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
8
2019-05-09T17:04:00.000Z
2021-06-09T06:50:51.000Z
pysnmp-with-texts/CIRCUIT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
4
2019-05-31T16:42:59.000Z
2020-01-31T21:57:17.000Z
pysnmp-with-texts/CIRCUIT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module CIRCUIT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CIRCUIT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:49:40 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint") circuit, coriolisMibs = mibBuilder.importSymbols("CORIOLIS-MIB", "circuit", "coriolisMibs") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, IpAddress, Integer32, iso, Gauge32, Counter64, MibIdentifier, NotificationType, TimeTicks, Unsigned32, Counter32, Bits, NotificationType, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "IpAddress", "Integer32", "iso", "Gauge32", "Counter64", "MibIdentifier", "NotificationType", "TimeTicks", "Unsigned32", "Counter32", "Bits", "NotificationType", "ModuleIdentity") DisplayString, TruthValue, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TruthValue", "TextualConvention") circuitMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 5812, 6, 1)) if mibBuilder.loadTexts: circuitMIB.setLastUpdated('0010300000Z') if mibBuilder.loadTexts: circuitMIB.setOrganization('Coriolis Networks') if mibBuilder.loadTexts: circuitMIB.setContactInfo(' Srivathsan Srinivasagopalan Postal: 330 Codman Hill Road, Boxboro MA, 01719. Tel: +1 978 264 1904 Fax: +1 978 264 1929 E-mail: [email protected]') if mibBuilder.loadTexts: circuitMIB.setDescription(' The MIB module for transport channels ') circuitLoadBalanceInterval = MibScalar((1, 3, 6, 1, 4, 1, 5812, 6, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitLoadBalanceInterval.setStatus('current') if mibBuilder.loadTexts: circuitLoadBalanceInterval.setDescription('The default load balancing schedule is to examine 1 circuit every 3 minutes at the GNE. Regardless of whether the circuit is moved to a better ring path or not, the next circuit is not examined until another 3 minutes (default) had expired. The duration of the load balance timer will be configurable from a range of 0 to 65535 seconds. Using a value of 0 will turn off load balancing.') circuitLoadBalanceNumPerInterval = MibScalar((1, 3, 6, 1, 4, 1, 5812, 6, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitLoadBalanceNumPerInterval.setStatus('current') if mibBuilder.loadTexts: circuitLoadBalanceNumPerInterval.setDescription('Indicates the number of circuits being loadbalanced in a fixed interval. The maximum value is 10 circuits per second.') circuitOldIpAddrToSwap = MibScalar((1, 3, 6, 1, 4, 1, 5812, 6, 4), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitOldIpAddrToSwap.setStatus('current') if mibBuilder.loadTexts: circuitOldIpAddrToSwap.setDescription('When a chassis running several circuits has to be moved to a new location with a new different IpAddress, then all the associated circuits has to be properly modified with the new IpAddress. This object will specify the old-IpAddress. This process is almost transparent to the user, but, he will notice traffic loss due to the circuits being brought down and up.') circuitNewIpAddrToSwap = MibScalar((1, 3, 6, 1, 4, 1, 5812, 6, 5), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitNewIpAddrToSwap.setStatus('current') if mibBuilder.loadTexts: circuitNewIpAddrToSwap.setDescription('When a chassis running several circuits has to be moved to a new location with a new different IpAddress, then all the associated circuits has to be properly modified with the new IpAddress. This object will specify the old-IpAddress. This process is almost transparent to the user, but, he will notice traffic loss due to the circuits being brought down and up.') circuitEventInterval = MibScalar((1, 3, 6, 1, 4, 1, 5812, 6, 6), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitEventInterval.setStatus('current') if mibBuilder.loadTexts: circuitEventInterval.setDescription('For any circuit related events, events are generated at a specific time interval. circuitEventInterval specifies that. The default value is 1 second.') circuitEventNumPerInterval = MibScalar((1, 3, 6, 1, 4, 1, 5812, 6, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 10))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitEventNumPerInterval.setStatus('current') if mibBuilder.loadTexts: circuitEventNumPerInterval.setDescription('This object specifies the number of events generated per interval. The default is 10 per second.') circuitTable = MibTable((1, 3, 6, 1, 4, 1, 5812, 6, 8), ) if mibBuilder.loadTexts: circuitTable.setStatus('current') if mibBuilder.loadTexts: circuitTable.setDescription('A table containing information about the transport channels in the system') circuitEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1), ).setIndexNames((0, "CIRCUIT-MIB", "circuitSrcIpAddr"), (0, "CIRCUIT-MIB", "circuitSrcInterfaceNum"), (0, "CIRCUIT-MIB", "circuitSrcConnectionID")) if mibBuilder.loadTexts: circuitEntry.setStatus('current') if mibBuilder.loadTexts: circuitEntry.setDescription('Entry in the table for a single transport channel') circuitSrcIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 1), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitSrcIpAddr.setStatus('current') if mibBuilder.loadTexts: circuitSrcIpAddr.setDescription('IP address of the source circuit endpoint.') circuitSrcInterfaceNum = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 2), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitSrcInterfaceNum.setStatus('current') if mibBuilder.loadTexts: circuitSrcInterfaceNum.setDescription('The interface number of the source circuit endpoint.') circuitSrcConnectionID = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 3), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitSrcConnectionID.setStatus('current') if mibBuilder.loadTexts: circuitSrcConnectionID.setDescription('Connection Identifier of the source circuit endpoint. Based on the protocol type, further information may be required to completely specify a circuit on a channel. For example, Ethernet VLAN requires a VLAN Id, Frame Relay requires a DLCI and ATM requires VPI and VCI. For ATM, this field is encoded as 12 bits of VPI and 16 bits of VCI.') circuitSrcDescString = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 4), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitSrcDescString.setStatus('current') if mibBuilder.loadTexts: circuitSrcDescString.setDescription('Textual description of the source side of the circuit endpoint.') circuitDestIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 5), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitDestIpAddr.setStatus('current') if mibBuilder.loadTexts: circuitDestIpAddr.setDescription('IP address of the destination circuit endpoint.') circuitDestInterfaceNum = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 6), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitDestInterfaceNum.setStatus('current') if mibBuilder.loadTexts: circuitDestInterfaceNum.setDescription('The interface number of the destination circuit endpoint.') circuitDestConnectionID = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 7), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitDestConnectionID.setStatus('current') if mibBuilder.loadTexts: circuitDestConnectionID.setDescription('Connection Identifier of the destination circuit endpoint. Based on the protocol type, further information may be required to completely specify a circuit on a channel. For example, Ethernet VLAN requires a VLAN Id, Frame Relay requires a DLCI and ATM requires VPI and VCI. For ATM, this field is encoded as 12 bits of VPI and 16 bits of VCI.') circuitDestDescString = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 8), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitDestDescString.setStatus('current') if mibBuilder.loadTexts: circuitDestDescString.setDescription('Textual description of the destination side of the circuit endpoint.') circuitName = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitName.setStatus('current') if mibBuilder.loadTexts: circuitName.setDescription('CircuitName is a unique name given to a circuit.') circuitID = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 10), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitID.setStatus('current') if mibBuilder.loadTexts: circuitID.setDescription('CircuitID is a unique ID given to a circuit. It is equal to the TC-ID in the PM.') circuitRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("active", 1), ("notInService", 2), ("notReady", 3), ("createAndGo", 4), ("createAndWait", 5), ("destroy", 6)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitRowStatus.setStatus('current') if mibBuilder.loadTexts: circuitRowStatus.setDescription('Indicates if a row has been created or deleted. See SNMPv2-TC for complete description.') circuitReasonText = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 12), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitReasonText.setStatus('current') if mibBuilder.loadTexts: circuitReasonText.setDescription('Provides the reason for the error indicated.') circuitFailLocIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 13), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitFailLocIpAddr.setStatus('current') if mibBuilder.loadTexts: circuitFailLocIpAddr.setDescription('IP address of location where circuit failure code is encountered.') circuitFailLocSlot1 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 26))).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitFailLocSlot1.setStatus('current') if mibBuilder.loadTexts: circuitFailLocSlot1.setDescription('Slot number where circuit failure code is encountered.') circuitFailLocPort1 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitFailLocPort1.setStatus('current') if mibBuilder.loadTexts: circuitFailLocPort1.setDescription('Port number where circuit failure code is encountered.') circuitFailLocInterfaceNum1 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 16), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitFailLocInterfaceNum1.setStatus('current') if mibBuilder.loadTexts: circuitFailLocInterfaceNum1.setDescription('Interface number where circuit failure code is encountered.') circuitFailLocConnectionID1 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 17), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitFailLocConnectionID1.setStatus('current') if mibBuilder.loadTexts: circuitFailLocConnectionID1.setDescription('Connection Identifier of the failed circuit endpoint.') circuitFailLocSlot2 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 26))).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitFailLocSlot2.setStatus('current') if mibBuilder.loadTexts: circuitFailLocSlot2.setDescription('Slot number where circuit failure code is encountered.') circuitFailLocPort2 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitFailLocPort2.setStatus('current') if mibBuilder.loadTexts: circuitFailLocPort2.setDescription('Port number where circuit failure code is encountered.') circuitFailLocInterfaceNum2 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 20), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitFailLocInterfaceNum2.setStatus('current') if mibBuilder.loadTexts: circuitFailLocInterfaceNum2.setDescription('Interface number where circuit failure code is encountered.') circuitFailLocConnectionID2 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 21), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitFailLocConnectionID2.setStatus('current') if mibBuilder.loadTexts: circuitFailLocConnectionID2.setDescription('Connection Identifier of the failed circuit endpoint.') circuitEndPoint1Protocol = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("ethernet", 1), ("frameRelay", 2), ("atm", 3), ("vt", 4), ("axData", 5), ("axTdm", 6), ("isl", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitEndPoint1Protocol.setStatus('current') if mibBuilder.loadTexts: circuitEndPoint1Protocol.setDescription('Protocol determines the connectionID.') circuitFwdTDType = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 23), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("ethernet", 1), ("frameRelay", 2), ("tdm", 3), ("atm-cbr", 4), ("atm-vbr-rt", 5), ("atm-vbr-nrt", 6), ("atm-vbr-ubr", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitFwdTDType.setStatus('current') if mibBuilder.loadTexts: circuitFwdTDType.setDescription("Specifies the traffic descriptor type associated with the forward traffic descriptor parameters. The forward direction is 'into the network' from the circuit endpoint. TDType is independent of the end-point protocol.") circuitFwdTDParam1 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 24), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitFwdTDParam1.setStatus('current') if mibBuilder.loadTexts: circuitFwdTDParam1.setDescription('Parameter 1 of the forward traffic descriptor of type circuitFwdTdType. For type Ethernet, this value corresponds to CIR. For type Frame Relay, this value corresponds to CIR. For type ATM-CBR, this value corresponds to PCR(0+1).') circuitFwdTDParam2 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 25), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitFwdTDParam2.setStatus('current') if mibBuilder.loadTexts: circuitFwdTDParam2.setDescription('Parameter 2 of the forward traffic descriptor of type circuitFwdTdType. For type Ethernet, this value corresponds to Bc. For type Frame Relay, this value corresponds to Bc.') circuitFwdTDParam3 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 26), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitFwdTDParam3.setStatus('current') if mibBuilder.loadTexts: circuitFwdTDParam3.setDescription('Parameter 3 of the forward traffic descriptor of type circuitFwdTdType. For type Ethernet, this value corresponds to Be. For type Frame Relay, this value corresponds to Be.') circuitFwdTDParam4 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 27), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitFwdTDParam4.setStatus('current') if mibBuilder.loadTexts: circuitFwdTDParam4.setDescription('Parameter 4 of the forward traffic descriptor of type circuitFwdTdType.') circuitEndPoint2Protocol = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 28), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("ethernet", 1), ("frameRelay", 2), ("atm", 3), ("vt", 4), ("axData", 5), ("axTdm", 6), ("isl", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitEndPoint2Protocol.setStatus('current') if mibBuilder.loadTexts: circuitEndPoint2Protocol.setDescription('Protocol determines the connectionID.') circuitBwdTDType = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 29), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("ethernet", 1), ("frameRelay", 2), ("tdm", 3), ("atm-cbr", 4), ("atm-vbr-rt", 5), ("atm-vbr-nrt", 6), ("atm-vbr-ubr", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitBwdTDType.setStatus('current') if mibBuilder.loadTexts: circuitBwdTDType.setDescription("Specifies the traffic descriptor type associated with the backward traffic descriptor parameters. The backward direction is 'out of the network' from the circuit endpoint. TDType is independent to of the end-point protocol.") circuitBwdTDParam1 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 30), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitBwdTDParam1.setStatus('current') if mibBuilder.loadTexts: circuitBwdTDParam1.setDescription('Parameter 1 of the backward traffic descriptor of type circuitBwdTdType. For type Ethernet, this value corresponds to CIR. For type Frame Relay, this value corresponds to CIR. For type ATM-CBR, this value corresponds to PCR(0+1).') circuitBwdTDParam2 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 31), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitBwdTDParam2.setStatus('current') if mibBuilder.loadTexts: circuitBwdTDParam2.setDescription('Parameter 2 of the backward traffic descriptor of type circuitBwdTdType. For type Ethernet, this value corresponds to Bc. For type Frame Relay, this value corresponds to Bc.') circuitBwdTDParam3 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 32), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitBwdTDParam3.setStatus('current') if mibBuilder.loadTexts: circuitBwdTDParam3.setDescription('Parameter 3 of the backward traffic descriptor of type circuitBwdTdType. For type Ethernet, this value corresponds to Be. For type Frame Relay, this value corresponds to Be.') circuitBwdTDParam4 = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 33), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitBwdTDParam4.setStatus('current') if mibBuilder.loadTexts: circuitBwdTDParam4.setDescription('Parameter 4 of the backward traffic descriptor of type circuitBwdTdType.') circuitClassOfService = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 34), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitClassOfService.setStatus('current') if mibBuilder.loadTexts: circuitClassOfService.setDescription('Specifies the class of service for Data or non-TDM circuits. This value is in the range of 0-7 where 1 has the highest priority and 7 has the lowest.') circuitAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 35), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2), ("enabledButNotUsed", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitAdminState.setStatus('current') if mibBuilder.loadTexts: circuitAdminState.setDescription("Administrative state of the circuit. Circuits in the disabled state do not consume network resources such as bandwidth. The network continuously attempts to establish circuits until successful while in the enabled state. The 'enabledButNotUsed' state tells that the transport segment is established and network resources are assigned to it, but, traffic is not allowed to pass though it.") circuitOperState = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 36), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("test", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitOperState.setStatus('current') if mibBuilder.loadTexts: circuitOperState.setDescription('Aperational state of the circuit. Circuits in the disabled state do not consume network resources such as bandwidth. The network continuously attempts to establish circuits until successful while in the enabled state.') circuitTimeSinceStatusChange = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 37), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitTimeSinceStatusChange.setStatus('current') if mibBuilder.loadTexts: circuitTimeSinceStatusChange.setDescription('Gives the time (in seconds) since the most recent status change.') circuitSetupPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 38), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitSetupPriority.setStatus('current') if mibBuilder.loadTexts: circuitSetupPriority.setDescription('If there are insufficient network resources for establishing all transport channels, this field specifies the priority of the transport channel.') circuitHoldPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 39), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitHoldPriority.setStatus('current') if mibBuilder.loadTexts: circuitHoldPriority.setDescription('If a number of transport channels of a low Setup Priority need to be cleared in order to release resources allowing for a higher priority (Setup) transport channel to be established, this field specifies the Hold priority where low Hold priority transport channels are cleared before higher Hold priority transport channels.') circuitIsRedundancyReqd = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 40), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitIsRedundancyReqd.setStatus('current') if mibBuilder.loadTexts: circuitIsRedundancyReqd.setDescription("Specifies if the circuit is to be established over rings that are logically configured as 'protected'. A protected ring could physically be in a fault state where one fiber has failed. A circuit that requires redundancy will be established over rings logically configured as 'protected' even though the current physical state of a protected ring may be in a fault state.") circuitPreferredEP1OptSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 41), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 26))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitPreferredEP1OptSlot.setStatus('current') if mibBuilder.loadTexts: circuitPreferredEP1OptSlot.setDescription('If the circuit spans one or two rings, this is the slot number of the first preferred ring. Preferred rings allow a manual overide of the routed circuit path.') circuitPreferredEP1OptPort = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 42), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitPreferredEP1OptPort.setStatus('current') if mibBuilder.loadTexts: circuitPreferredEP1OptPort.setDescription('If the circuit spans one or two rings, this is the port number of the first preferred ring.') circuitPreferredEP1OptVport = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 43), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitPreferredEP1OptVport.setStatus('current') if mibBuilder.loadTexts: circuitPreferredEP1OptVport.setDescription('If the circuit spans one or two rings, this is the lambda number of the first preferred ring.') circuitPreferredEP2OptSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 44), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 26))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitPreferredEP2OptSlot.setStatus('current') if mibBuilder.loadTexts: circuitPreferredEP2OptSlot.setDescription('If the circuit spans two rings, this is the slot number of the second preferred ring. Preferred rings allow a manual overide of the routed circuit path.') circuitPreferredEP2OptPort = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 45), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitPreferredEP2OptPort.setStatus('current') if mibBuilder.loadTexts: circuitPreferredEP2OptPort.setDescription('If the circuit spans two rings, this is the port number of the second preferred ring.') circuitPreferredEP2OptVport = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 46), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitPreferredEP2OptVport.setStatus('current') if mibBuilder.loadTexts: circuitPreferredEP2OptVport.setDescription('If the circuit spans two rings, this is the lambda number of the second preferred ring.') circuitUseAlternateRing = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 47), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("yes", 1), ("no", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: circuitUseAlternateRing.setStatus('current') if mibBuilder.loadTexts: circuitUseAlternateRing.setDescription('Allows operator to specify whether an alternate ring can be used if the preferred ring(s) fail. This requires the ability to load-balance back onto the preferred ring once it becomes available. The format for this field is Boolean.') circuitInFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 48), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInFrames.setStatus('current') if mibBuilder.loadTexts: circuitInFrames.setDescription('Number of frames received at the ingress point and passed on to the circuit.') circuitInDEFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 49), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInDEFrames.setStatus('current') if mibBuilder.loadTexts: circuitInDEFrames.setDescription('Number of frames received at the ingress point and passed on to the circuit.') circuitInOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 50), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInOctets.setStatus('current') if mibBuilder.loadTexts: circuitInOctets.setDescription('Number of octets received at the ingress point and passed on to the circuit.') circuitInDEOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 51), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInDEOctets.setStatus('current') if mibBuilder.loadTexts: circuitInDEOctets.setDescription('Number of octets received at the ingress point and passed on to the circuit.') circuitInCLP0Cells = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 52), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInCLP0Cells.setStatus('current') if mibBuilder.loadTexts: circuitInCLP0Cells.setDescription('Number of cells received at the ingress point and passed on to the circuit.') circuitInCLP1Cells = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 53), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInCLP1Cells.setStatus('current') if mibBuilder.loadTexts: circuitInCLP1Cells.setDescription('Number of cells received at the ingress point and passed on to the circuit.') circuitInFramesDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 54), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInFramesDiscard.setStatus('current') if mibBuilder.loadTexts: circuitInFramesDiscard.setDescription('Number of frames received at the ingress point but are discarded due to the non-conformance of the contract, i.e., it exceeds the traffic contract (BE).') circuitInDEFramesDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 55), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInDEFramesDiscard.setStatus('current') if mibBuilder.loadTexts: circuitInDEFramesDiscard.setDescription('Number of frames received at the ingress point but are discarded due to the non-conformance of the contract, i.e., it exceeds the traffic contract (BE).') circuitInOctetsDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 56), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInOctetsDiscard.setStatus('current') if mibBuilder.loadTexts: circuitInOctetsDiscard.setDescription('Number of octets received at the ingress point but are discarded due to the non-conformance of the contract, i.e., it exceeds the traffic contract (BE).') circuitInDEOctetsDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 57), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInDEOctetsDiscard.setStatus('current') if mibBuilder.loadTexts: circuitInDEOctetsDiscard.setDescription('Number of octets received at the ingress point but are discarded due to the non-conformance of the contract, i.e., it exceeds the traffic contract (BE).') circuitInCLP0CellsDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 58), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInCLP0CellsDiscard.setStatus('current') if mibBuilder.loadTexts: circuitInCLP0CellsDiscard.setDescription('Number of octets received at the ingress point but are discarded due to the non-conformance of the contract, i.e., it exceeds the traffic contract (BE).') circuitInCLP1CellsDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 59), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInCLP1CellsDiscard.setStatus('current') if mibBuilder.loadTexts: circuitInCLP1CellsDiscard.setDescription('Number of octets received at the ingress point but are discarded due to the non-conformance of the contract, i.e., it exceeds the traffic contract (BE).') circuitInFramesTagged = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 60), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInFramesTagged.setStatus('current') if mibBuilder.loadTexts: circuitInFramesTagged.setDescription('Number of tagged frames received. A tagged frame represents non-conforming frames to the contract (when CIR < frame contract < BE). In these frames, the DE (Discard Enable) is set. ') circuitInOctetsTagged = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 61), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInOctetsTagged.setStatus('current') if mibBuilder.loadTexts: circuitInOctetsTagged.setDescription('Number of tagged octets received. A tagged octet represents non-conforming octet to the contract (when CIR < octet contract < BE).In these octets, the DE (Discard Enable) is set.') circuitInCLP0CellsTagged = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 62), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitInCLP0CellsTagged.setStatus('current') if mibBuilder.loadTexts: circuitInCLP0CellsTagged.setDescription('Number of tagged octets received. A tagged octet represents non-conforming octet to the contract (when CIR < octet contract < BE).In these octets, the DE (Discard Enable) is set.') circuitOutFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 63), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitOutFrames.setStatus('current') if mibBuilder.loadTexts: circuitOutFrames.setDescription('Number of frames sent out through the circuit.') circuitOutDEFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 64), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitOutDEFrames.setStatus('current') if mibBuilder.loadTexts: circuitOutDEFrames.setDescription('Number of frames sent out through the circuit.') circuitOutOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 65), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitOutOctets.setStatus('current') if mibBuilder.loadTexts: circuitOutOctets.setDescription('Number of octets sent out through the circuit.') circuitOutDEOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 66), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitOutDEOctets.setStatus('current') if mibBuilder.loadTexts: circuitOutDEOctets.setDescription('Number of octets sent out through the circuit.') circuitOutCLP0Cells = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 67), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitOutCLP0Cells.setStatus('current') if mibBuilder.loadTexts: circuitOutCLP0Cells.setDescription('Number of cells sent out through the circuit.') circuitOutCLP1Cells = MibTableColumn((1, 3, 6, 1, 4, 1, 5812, 6, 8, 1, 68), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: circuitOutCLP1Cells.setStatus('current') if mibBuilder.loadTexts: circuitOutCLP1Cells.setDescription('Number of cells sent out through the circuit.') circuitInactive = NotificationType((1, 3, 6, 1, 4, 1, 5812) + (0,24)).setObjects(("CIRCUIT-MIB", "circuitReasonText")) if mibBuilder.loadTexts: circuitInactive.setDescription('Indicates that the circuit became inactive and specifies the reason for it becoming inactive') circuitActive = NotificationType((1, 3, 6, 1, 4, 1, 5812) + (0,25)).setObjects(("CIRCUIT-MIB", "circuitReasonText")) if mibBuilder.loadTexts: circuitActive.setDescription('Indicates that the circuit became active') circuitLoadBalancing = NotificationType((1, 3, 6, 1, 4, 1, 5812) + (0,26)).setObjects(("CIRCUIT-MIB", "circuitReasonText")) if mibBuilder.loadTexts: circuitLoadBalancing.setDescription('Indicates that the circuit underwent load balancing') mibBuilder.exportSymbols("CIRCUIT-MIB", circuitEndPoint2Protocol=circuitEndPoint2Protocol, circuitInDEOctets=circuitInDEOctets, circuitID=circuitID, circuitInOctetsDiscard=circuitInOctetsDiscard, circuitInCLP1CellsDiscard=circuitInCLP1CellsDiscard, circuitInFrames=circuitInFrames, circuitFwdTDParam4=circuitFwdTDParam4, circuitPreferredEP1OptVport=circuitPreferredEP1OptVport, circuitInCLP1Cells=circuitInCLP1Cells, circuitMIB=circuitMIB, circuitInDEFrames=circuitInDEFrames, circuitBwdTDParam1=circuitBwdTDParam1, circuitInCLP0CellsTagged=circuitInCLP0CellsTagged, circuitEventNumPerInterval=circuitEventNumPerInterval, circuitSrcIpAddr=circuitSrcIpAddr, circuitFailLocPort2=circuitFailLocPort2, circuitFwdTDType=circuitFwdTDType, circuitDestInterfaceNum=circuitDestInterfaceNum, circuitSrcConnectionID=circuitSrcConnectionID, circuitRowStatus=circuitRowStatus, circuitFailLocInterfaceNum2=circuitFailLocInterfaceNum2, circuitInFramesTagged=circuitInFramesTagged, circuitInCLP0CellsDiscard=circuitInCLP0CellsDiscard, circuitOutOctets=circuitOutOctets, circuitFwdTDParam1=circuitFwdTDParam1, circuitOutDEOctets=circuitOutDEOctets, circuitFailLocSlot1=circuitFailLocSlot1, circuitFwdTDParam3=circuitFwdTDParam3, circuitPreferredEP2OptSlot=circuitPreferredEP2OptSlot, circuitInDEFramesDiscard=circuitInDEFramesDiscard, circuitBwdTDParam2=circuitBwdTDParam2, circuitBwdTDParam3=circuitBwdTDParam3, circuitDestDescString=circuitDestDescString, circuitLoadBalanceInterval=circuitLoadBalanceInterval, circuitFailLocPort1=circuitFailLocPort1, circuitSetupPriority=circuitSetupPriority, circuitActive=circuitActive, circuitIsRedundancyReqd=circuitIsRedundancyReqd, circuitInFramesDiscard=circuitInFramesDiscard, circuitAdminState=circuitAdminState, circuitPreferredEP1OptSlot=circuitPreferredEP1OptSlot, circuitSrcInterfaceNum=circuitSrcInterfaceNum, circuitBwdTDParam4=circuitBwdTDParam4, circuitBwdTDType=circuitBwdTDType, circuitFailLocConnectionID2=circuitFailLocConnectionID2, circuitPreferredEP1OptPort=circuitPreferredEP1OptPort, circuitName=circuitName, circuitOperState=circuitOperState, circuitClassOfService=circuitClassOfService, circuitInDEOctetsDiscard=circuitInDEOctetsDiscard, circuitFailLocIpAddr=circuitFailLocIpAddr, circuitInCLP0Cells=circuitInCLP0Cells, circuitOutDEFrames=circuitOutDEFrames, circuitOldIpAddrToSwap=circuitOldIpAddrToSwap, circuitFwdTDParam2=circuitFwdTDParam2, circuitDestConnectionID=circuitDestConnectionID, circuitLoadBalancing=circuitLoadBalancing, circuitDestIpAddr=circuitDestIpAddr, circuitInOctetsTagged=circuitInOctetsTagged, circuitUseAlternateRing=circuitUseAlternateRing, circuitHoldPriority=circuitHoldPriority, PYSNMP_MODULE_ID=circuitMIB, circuitInactive=circuitInactive, circuitFailLocInterfaceNum1=circuitFailLocInterfaceNum1, circuitReasonText=circuitReasonText, circuitEndPoint1Protocol=circuitEndPoint1Protocol, circuitNewIpAddrToSwap=circuitNewIpAddrToSwap, circuitFailLocConnectionID1=circuitFailLocConnectionID1, circuitOutFrames=circuitOutFrames, circuitPreferredEP2OptVport=circuitPreferredEP2OptVport, circuitLoadBalanceNumPerInterval=circuitLoadBalanceNumPerInterval, circuitTimeSinceStatusChange=circuitTimeSinceStatusChange, circuitOutCLP0Cells=circuitOutCLP0Cells, circuitTable=circuitTable, circuitPreferredEP2OptPort=circuitPreferredEP2OptPort, circuitFailLocSlot2=circuitFailLocSlot2, circuitSrcDescString=circuitSrcDescString, circuitEntry=circuitEntry, circuitOutCLP1Cells=circuitOutCLP1Cells, circuitEventInterval=circuitEventInterval, circuitInOctets=circuitInOctets)
146.729412
3,536
0.795836
0
0
0
0
0
0
0
0
13,420
0.35867
19556d177fed4def9f6818303c33e5aa562c38b8
904
py
Python
SortingAlgorithm/shell_sort.py
hpf0532/algorithms_demo
4f02444ee634295e5cbf8e5624d4e5b65931897d
[ "MIT" ]
null
null
null
SortingAlgorithm/shell_sort.py
hpf0532/algorithms_demo
4f02444ee634295e5cbf8e5624d4e5b65931897d
[ "MIT" ]
null
null
null
SortingAlgorithm/shell_sort.py
hpf0532/algorithms_demo
4f02444ee634295e5cbf8e5624d4e5b65931897d
[ "MIT" ]
null
null
null
# -*- coding:utf-8 -*- # author: hpf # create time: 2020/7/16 21:33 # file: shell_sort.py # IDE: PyCharm # 希尔排序(Shell Sort)是插入排序的一种。也称缩小增量排序,是直接插入排序算法的一种更高效的改进版本。 # 希尔排序是非稳定排序算法。该方法因DL.Shell于1959年提出而得名。 希尔排序是把记录按下标的一定增量分组, # 对每组使用直接插入排序算法排序;随着增量逐渐减少,每组包含的关键词越来越多,当增量减至1时,整个文件恰被分成一组,算法便终止。 def shell_sort(alist): n = len(alist) # 初始步长 gap = n // 2 while gap > 0: # 按步长进行插入排序 for j in range(gap, n): i = j # 按步长进行插入排序 while i > 0: if alist[i] < alist[i-gap]: alist[i-gap], alist[i] = alist[i], alist[i-gap] i -= gap else: break # 得到新的步长 gap //= 2 if __name__ == '__main__': li = [34, 2, 13, 76, 54, 22, 90, 46, 13] print(li) shell_sort(li) print(li) # 时间复杂度 # 最优时间复杂度:根据步长序列的不同而不同 # 最坏时间复杂度:O(n2) # 稳定想:不稳定
21.52381
67
0.535398
0
0
0
0
0
0
0
0
816
0.608955
19557822a163b70d4aa82e704dabbed7f22587fe
4,273
py
Python
tests/rl/test_rainbow.py
pocokhc/simple_rl
765f12f392f87e6897027905d74f1bced6a2b7bf
[ "MIT" ]
1
2022-03-01T09:16:57.000Z
2022-03-01T09:16:57.000Z
tests/rl/test_rainbow.py
pocokhc/simple_rl
765f12f392f87e6897027905d74f1bced6a2b7bf
[ "MIT" ]
null
null
null
tests/rl/test_rainbow.py
pocokhc/simple_rl
765f12f392f87e6897027905d74f1bced6a2b7bf
[ "MIT" ]
null
null
null
import unittest import srl from srl.test import TestRL class Test(unittest.TestCase): def setUp(self) -> None: self.tester = TestRL() self.rl_config = srl.rl.rainbow.Config() def test_sequence(self): self.tester.play_sequence(self.rl_config) def test_mp(self): self.tester.play_mp(self.rl_config) def test_verify_IGrid(self): # window_length test, 4以上じゃないと学習できない self.rl_config.window_length = 8 self.rl_config.multisteps = 1 self.rl_config.lr = 0.001 self.rl_config.batch_size = 8 self.rl_config.hidden_layer_sizes = (32,) self.rl_config.epsilon = 0.5 self.rl_config.enable_dueling_network = False self.rl_config.memory_name = "ReplayMemory" self.tester.play_verify_singleplay("IGrid", self.rl_config, 12000, 100) def test_verify_Pendulum(self): self.rl_config.hidden_layer_sizes = (64, 64) self.rl_config.memory_beta_initial = 1.0 self.tester.play_verify_singleplay("Pendulum-v1", self.rl_config, 200 * 50, 10) # def test_verify_Pong(self): # rl_config = rl.rainbow.Config( # window_length=4, # multisteps=10, # ) # self.tester.play_verify_singleplay(self, "ALE/Pong-v5", rl_config, 15000, 10, is_atari=True) def test_verify_OX(self): # invalid action test self.rl_config.hidden_layer_sizes = (128,) self.rl_config.multisteps = 3 self.rl_config.epsilon = 0.5 self.rl_config.enable_dueling_network = False self.tester.play_verify_2play("OX", self.rl_config, 4000, 100) class TestGrid(unittest.TestCase): def setUp(self) -> None: self.tester = TestRL() self.rl_config = srl.rl.rainbow.Config( epsilon=0.5, gamma=0.9, lr=0.001, batch_size=16, hidden_layer_sizes=(4, 4, 4, 4), window_length=1, enable_double_dqn=False, enable_dueling_network=False, enable_noisy_dense=False, multisteps=1, memory_name="ReplayMemory", ) def test_verify_Grid_naive(self): self.tester.play_verify_singleplay("Grid", self.rl_config, 10000, 100) def test_verify_Grid_ddqn(self): self.rl_config.enable_double_dqn = True self.tester.play_verify_singleplay("Grid", self.rl_config, 10000, 100) def test_verify_Grid_dueling(self): self.rl_config.batch_size = 16 self.rl_config.lr = 0.001 self.rl_config.enable_dueling_network = True self.tester.play_verify_singleplay("Grid", self.rl_config, 7000, 100) def test_verify_Grid_noisy(self): self.rl_config.enable_noisy_dense = True self.tester.play_verify_singleplay("Grid", self.rl_config, 8000, 100) def test_verify_Grid_multistep(self): self.rl_config.multisteps = 5 self.tester.play_verify_singleplay("Grid", self.rl_config, 10000, 100) def test_verify_Grid_rankbase(self): self.rl_config.memory_name = "RankBaseMemory" self.rl_config.memory_alpha = 1.0 self.rl_config.memory_beta_initial = 1.0 self.tester.play_verify_singleplay("Grid", self.rl_config, 6000, 100) def test_verify_Grid_proportional(self): self.rl_config.memory_name = "ProportionalMemory" self.rl_config.memory_alpha = 0.6 self.rl_config.memory_beta_initial = 1.0 self.tester.play_verify_singleplay("Grid", self.rl_config, 8000, 100) def test_verify_Grid_all(self): self.rl_config.enable_double_dqn = True self.rl_config.lr = 0.001 self.rl_config.batch_size = 8 self.rl_config.enable_dueling_network = True # self.rl_config.enable_noisy_dense = True self.rl_config.multisteps = 5 self.rl_config.memory_name = "RankBaseMemory" self.rl_config.memory_alpha = 1.0 self.rl_config.memory_beta_initial = 1.0 self.tester.play_verify_singleplay("Grid", self.rl_config, 10000, 100) if __name__ == "__main__": unittest.main(module=__name__, defaultTest="Test.test_verify_Pendulum", verbosity=2) # unittest.main(module=__name__, defaultTest="TestGrid.test_verify_Grid_naive", verbosity=2)
36.521368
101
0.670723
4,022
0.935566
0
0
0
0
0
0
621
0.144452
1955c95ee465de712840c70524c29d14aa03188f
353
py
Python
challenge_3/python/bryantpq/find_majority.py
rchicoli/2017-challenges
44f0b672e5dea34de1dde131b6df837d462f8e29
[ "Apache-2.0" ]
271
2017-01-01T22:58:36.000Z
2021-11-28T23:05:29.000Z
challenge_3/python/bryantpq/find_majority.py
AakashOfficial/2017Challenges
a8f556f1d5b43c099a0394384c8bc2d826f9d287
[ "Apache-2.0" ]
283
2017-01-01T23:26:05.000Z
2018-03-23T00:48:55.000Z
challenge_3/python/bryantpq/find_majority.py
AakashOfficial/2017Challenges
a8f556f1d5b43c099a0394384c8bc2d826f9d287
[ "Apache-2.0" ]
311
2017-01-01T22:59:23.000Z
2021-09-23T00:29:12.000Z
def find_majority(a): d = {} l = len(a) for i in a: if i in d: d[i] += 1 if d[i] > l / 2: return i else: d[i] = 1 return if __name__ == "__main__": a = [2,2,3,7,5,7,7,7,4,7,2,7,4,5,6,7,7,8,6,7,7,8,10,12,29,30,19,10,7,7,7,7,7,7,7,7,7] print(find_majority(a))
19.611111
89
0.413598
0
0
0
0
0
0
0
0
10
0.028329
1956211e1137a8ec3efab729e58887fd70b0e317
7,307
py
Python
data-structures/double-list.py
costincaraivan/cs-refresher
008fdb2af661310c65f656f017ec34e5df004424
[ "MIT" ]
1
2018-06-12T12:00:33.000Z
2018-06-12T12:00:33.000Z
data-structures/double-list.py
costincaraivan/cs-refresher
008fdb2af661310c65f656f017ec34e5df004424
[ "MIT" ]
null
null
null
data-structures/double-list.py
costincaraivan/cs-refresher
008fdb2af661310c65f656f017ec34e5df004424
[ "MIT" ]
null
null
null
# Completely silly exercises, in real life use: # Python lists: https://docs.python.org/3/tutorial/datastructures.html import unittest import logging logging.basicConfig(level=logging.INFO) # - DoublyLinkedListNode class. class DoublyLinkedListNode: value = None previousNode = None nextNode = None def __init__(self, value, previousNode, nextNode): self.value = value self.previousNode = previousNode self.nextNode = nextNode def __str__(self): return str(self.value) def __eq__(self, other): return isinstance(other, self.__class__) \ and self.value == other.value #-## # - DoublyLinkedList class. # Search method not included, has its own category. class DoublyLinkedList: # - Create. O(1). def __init__(self): self.head = None #-## # - Delete. O(n) (sort of: garbage collection). def delete(self): self.head = None #-## # - Insert at start. O(1). def insert_start(self, element): tempNode = DoublyLinkedListNode(element, None, self.head) self.head = tempNode #-## # - Set at start. O(1). def set_start(self, element): self.head.value = element #-## # - Insert at arbitrary position. O(n). def insert_position(self, position, element): if(self.head is None): self.insert_start(element) return tempNode = DoublyLinkedListNode(element, None, None) current = self.head count = 0 while((current.nextNode is not None) and (count < position)): count += 1 current = current.nextNode tempNode.nextNode = current.nextNode tempNode.previousNode = current.previousNode current.nextNode.previousNode = tempNode current.nextNode = tempNode #-## # - Set at arbitrary position. O(n). def set_position(self, position, element): if(self.head is None): return current = self.head count = 0 while((current.nextNode is not None) and (count < position)): count += 1 current = current.nextNode current.value = element #-## # - Insert at end. O(n). def insert_end(self, element): if(self.head is None): self.insert_start(element) return tempNode = DoublyLinkedListNode(element, None, None) current = self.head count = 0 while(current.nextNode is not None): count += 1 current = current.nextNode tempNode.previousNode = current current.nextNode = tempNode #-## # - Set at end. O(n). def set_end(self, element): if(self.head is None): return current = self.head count = 0 while(current.nextNode is None): count += 1 current = current.nextNode current.value = element #-## # - Join. O(n). def join(self, other): if(self.head is None): self.insert_start(other) return current = self.head count = 0 while(current.nextNode is not None): count += 1 current = current.nextNode other.head.previousNode = current current.nextNode = other.head #-## # - Utility methods. def __str__(self): if(self.head is None): return "" listString = str(self.head) current = self.head.nextNode while(current is not None): listString += ", {}".format(str(current)) current = current.nextNode return listString def __eq__(self, other): if(not isinstance(other, self.__class__)): return False currentSelf = self.head currentOther = other.head while(currentSelf is not None): if(currentOther is not None): # Different nodes. if(currentSelf.value != currentOther.value): return False currentSelf = currentSelf.nextNode currentOther = currentOther.nextNode # We ran out of nodes in the other list. elif(currentOther is None): return False # We ran out of nodes in the self list. if(currentOther is not None): return False # Full comparison, everything the same. return True #-## #-## # - TestDoublyLinkedList class. class TestDoublyLinkedList(unittest.TestCase): sut = None def setUp(self): self.sut = DoublyLinkedList() # Since we're inserting from the start, the values are reversed. # So the actual list is [ 1, 2, 3 ]. for i in range(3, 0, -1): self.sut.insert_start(i) def test_create(self): self.assertTrue(hasattr(self, "sut")) def test_delete(self): sut = DoublyLinkedList() sut.head = True sut.delete() self.assertEqual(sut.head, None) def test_insert_start(self): # Make an expected list of [ 0, 1, 2, 3 ]. expectedList = DoublyLinkedList() for i in range(3, -1, -1): expectedList.insert_start(i) self.sut.insert_start(0) self.assertEqual(self.sut, expectedList) def test_set_start(self): # Make an expected list of [ 0, 2, 3 ]. expectedList = DoublyLinkedList() for i in range(3, 1, -1): expectedList.insert_start(i) expectedList.insert_start(0) self.sut.set_start(0) self.assertEqual(self.sut, expectedList) def test_insert_position(self): expectedList = DoublyLinkedList() expectedList.insert_start(3) expectedList.insert_start(6) expectedList.insert_start(2) expectedList.insert_start(1) self.sut.insert_position(1, 6) self.assertEqual(self.sut, expectedList) def test_set_position(self): expectedList = DoublyLinkedList() expectedList.insert_start(6) expectedList.insert_start(2) expectedList.insert_start(1) self.sut.set_position(2, 6) def test_insert_end(self): expectedList = DoublyLinkedList() expectedList.insert_start(6) expectedList.insert_start(3) expectedList.insert_start(2) expectedList.insert_start(1) self.sut.insert_end(6) self.assertEqual(self.sut, expectedList) def test_set_end(self): expectedList = DoublyLinkedList() expectedList.insert_start(6) expectedList.insert_start(2) expectedList.insert_start(1) self.sut.set_end(6) self.assertEqual(self.sut, expectedList) def test_join(self): expectedList = DoublyLinkedList() expectedList.insert_start(5) expectedList.insert_start(4) expectedList.insert_start(3) expectedList.insert_start(2) expectedList.insert_start(1) otherList = DoublyLinkedList() otherList.insert_start(5) otherList.insert_start(4) self.sut.join(otherList) self.assertEqual(self.sut, expectedList) self.assertEqual(self.sut, expectedList) #-## if __name__ == "__main__": unittest.main(verbosity=2)
26.765568
72
0.596141
6,885
0.942247
0
0
0
0
0
0
917
0.125496
19580f1da14543fc46625b13a2d4fdf6ece370dd
888
py
Python
Ch. 2/tcp_server.py
Kediel/BHP
b0cd2aa82c95eef58f50d9d7d137fddcb70644cb
[ "MIT" ]
null
null
null
Ch. 2/tcp_server.py
Kediel/BHP
b0cd2aa82c95eef58f50d9d7d137fddcb70644cb
[ "MIT" ]
4
2017-07-27T17:34:24.000Z
2017-07-31T23:13:03.000Z
Ch. 2/tcp_server.py
Kediel/BHP
b0cd2aa82c95eef58f50d9d7d137fddcb70644cb
[ "MIT" ]
null
null
null
import socket import threading bind_ip = "0.0.0.0" bind_port = 9999 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((bind_ip, bind_port)) server.listen(5) print "[*] Listening on %s:%d" % (bind_ip, bind_port) # This is our client-handling thread def handle_client(client_socket): # Print out what the client sends request = client_socket.recv(1024) print "[*] Received: %s" % request # Send back a packet client_socket.send("ACK!") client_socket.close() while True: client, addr = server.accept() print "[*] Accepted connection from: %s:%d" % (addr[0], addr[1]) # Spin up our client thread to handle incoming data client_handler = threading.Thread(target = handle_client, args = (client,)) client_handler.start()
23.368421
79
0.614865
0
0
0
0
0
0
0
0
234
0.263514
195b152f91cd032e891708e898116a34b190d47e
210
py
Python
setup.py
nycz/ishu
6596b6e330c3439516dbd6cafe48d99388874aba
[ "MIT" ]
null
null
null
setup.py
nycz/ishu
6596b6e330c3439516dbd6cafe48d99388874aba
[ "MIT" ]
40
2015-08-14T23:11:08.000Z
2019-11-11T22:27:29.000Z
setup.py
nycz/ishu
6596b6e330c3439516dbd6cafe48d99388874aba
[ "MIT" ]
null
null
null
import setuptools import site import sys # This is a workaround to allow --user and -e combined # See https://github.com/pypa/pip/issues/7953 site.ENABLE_USER_SITE = "--user" in sys.argv[1:] setuptools.setup()
26.25
54
0.752381
0
0
0
0
0
0
0
0
107
0.509524
195cbcd5dccdd7c73a9db51970b9798eb35a32b9
466
py
Python
Python Programs/guess the number.py
sayanpoddar123/RTU-DigitalLibrary
658500ce3ee089d622cea0f6b49dfb8b485d0be6
[ "MIT" ]
null
null
null
Python Programs/guess the number.py
sayanpoddar123/RTU-DigitalLibrary
658500ce3ee089d622cea0f6b49dfb8b485d0be6
[ "MIT" ]
null
null
null
Python Programs/guess the number.py
sayanpoddar123/RTU-DigitalLibrary
658500ce3ee089d622cea0f6b49dfb8b485d0be6
[ "MIT" ]
null
null
null
#Guess program n=18 a=0 y = 1 print("Number of guesses is limited to only 4 times") while a<=3: z=int(input("Enter your choice=")) if z>n: print("Please less your number") a+=1 elif z<n: print("Please increase your number") a += 1 else: print("You win") print(y,"Number of guesses you take to finish the game") break print(4-y,"Guesses left") y+=1 if(a>3): print("Game over")
16.642857
64
0.555794
0
0
0
0
0
0
0
0
215
0.461373
195cc099346d6a0faa355accfa24ab213925cda9
8,019
py
Python
src/soundsystem.py
WinterLicht/Chaos-Projectile
3fffb788b241b7baa4247c1e630d83a7210ddc2e
[ "CC-BY-4.0" ]
59
2015-03-25T21:29:06.000Z
2022-01-17T22:48:05.000Z
src/soundsystem.py
WinterLicht/Chaos-Projectile
3fffb788b241b7baa4247c1e630d83a7210ddc2e
[ "CC-BY-4.0" ]
11
2015-07-07T07:10:42.000Z
2021-11-21T12:47:42.000Z
src/soundsystem.py
WinterLicht/Chaos-Projectile
3fffb788b241b7baa4247c1e630d83a7210ddc2e
[ "CC-BY-4.0" ]
19
2015-07-13T06:44:44.000Z
2022-02-05T03:09:27.000Z
""" .. module:: soundsystem :Platform: Unix, Windows :Synopsis: Sound system """ import os import pygame import events import ai class SoundSystem(object): """Render system. :Attributes: - *evManager*: event manager - *world*: game world - *screen*: game screen """ def __init__(self, event_manager, world): """ :param event_manager: event Manager :type event_manager: events.EventManager :param world: game world :type world: gameWorld.GameWorld """ self.world = world self.event_manager = event_manager self.event_manager.register_listener(self) #Load all sounds filename = self.get_sound_file('BG_loop1.ogg') self.bg_no_enemy = pygame.mixer.Sound(filename) self.bg_no_enemy.play(-1) filename = self.get_sound_file('BG_loop2.ogg') self.bg_enemy_near = pygame.mixer.Sound(filename) filename = self.get_sound_file('BG_loop3.ogg') self.bg_boss = pygame.mixer.Sound(filename) self.bg_enemy_near_running = False self.bg_boss_running = False #Player Sounds filename = self.get_sound_file('Shot1.ogg') self.shot_1_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Shot2.ogg') self.shot_2_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Shot 3.ogg') self.shot_3_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Hit Female 1.ogg') self.hit_female_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Jump.ogg') self.jump_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Landing.ogg') self.landing_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Aim Short.ogg') self.aim_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Footsteps_loop.ogg') self.footsteps_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Collect Item.ogg') self.collect_item_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Portal.ogg') self.portal_enter_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Appear and Fly 1.ogg') self.fly_appear_1_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Appear and Fly 2.ogg') self.fly_appear_2_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Appear and Fly 3.ogg') self.fly_appear_3_sound = pygame.mixer.Sound(filename) filename = self.get_sound_file('Disappear.ogg') self.fly_disappear_sound = pygame.mixer.Sound(filename) #Helper self.helper_player_jump = True self.helper_player_walk = False self.player_footsteps_playing = False #Green Curse sounds filename = self.get_sound_file('Die.ogg') self.player_dies_sound = pygame.mixer.Sound(filename) def notify(self, event): """Notify, when event occurs and stop CPUSpinner when it's quit event. :param event: occurred event :type event: events.Event """ fade_out_time = 1200 if isinstance(event, events.TickEvent): pass elif isinstance(event, events.EnemyNear): if isinstance(self.world.ai[event.entity_ID], ai.AI_Boss_2): if not self.bg_boss_running: self.bg_no_enemy.fadeout(fade_out_time) self.bg_boss.play(-1) self.bg_boss_running = True if self.bg_enemy_near_running: self.bg_enemy_near.fadeout(fade_out_time) self.bg_enemy_near_running = False else: if not self.bg_enemy_near_running: self.bg_no_enemy.fadeout(fade_out_time) self.bg_enemy_near.play(-1) self.bg_enemy_near_running = True if self.bg_boss_running: self.bg_boss.fadeout(fade_out_time) self.bg_boss_running = False elif isinstance(event, events.NoEnemysNear): if self.bg_enemy_near_running: self.bg_enemy_near.fadeout(fade_out_time) self.bg_no_enemy.play(-1) self.bg_enemy_near_running = False if self.bg_boss_running: self.bg_boss.fadeout(fade_out_time) self.bg_no_enemy.play(-1) self.bg_boss_running = False elif isinstance(event, events.EntityAttacks): entity_ID = event.entity_ID if entity_ID == self.world.player: self.footsteps_sound.stop() random_nr = ai.random_(3) if random_nr == 0: self.shot_1_sound.play() elif random_nr == 1: self.shot_2_sound.play() else: self.shot_3_sound.play() elif entity_ID in self.world.ai: ai_ = self.world.ai[entity_ID] if isinstance(ai_, ai.Level1_curse): random_nr = ai.random_(3) if random_nr == 0: self.fly_appear_1_sound.play() elif random_nr == 1: self.fly_appear_2_sound.play() else: self.fly_appear_3_sound.play() elif isinstance(event, events.EntityStunned): entity_ID = event.entity_ID if entity_ID == self.world.player: self.footsteps_sound.stop() self.hit_female_sound.play() elif isinstance(event, events.EntityJump): entity_ID = event.entity_ID if entity_ID == self.world.player and self.helper_player_jump: self.footsteps_sound.stop() self.player_footsteps_playing = False self.jump_sound.play() self.helper_player_jump = False elif isinstance(event, events.EntityGrounded): entity_ID = event.entity_ID if entity_ID == self.world.player and not self.helper_player_jump: self.landing_sound.play() self.helper_player_jump = True elif isinstance(event, events.PlayerAims): self.aim_sound.play() elif isinstance(event, events.EntityMovesRight) or isinstance(event, events.EntityMovesLeft): player_vel_x = self.world.velocity[self.world.player].x if player_vel_x == 0: self.footsteps_sound.stop() self.player_footsteps_playing = False else: if not self.player_footsteps_playing and self.helper_player_jump: self.footsteps_sound.play(-1) self.player_footsteps_playing = True elif isinstance(event, events.EntityStopMovingRight) or isinstance(event, events.EntityStopMovingLeft): entity_ID = event.entity_ID if entity_ID == self.world.player: self.footsteps_sound.stop() self.player_footsteps_playing = False elif isinstance(event, events.PortalEntered): self.portal_enter_sound.play() elif isinstance(event, events.CollectedItem): self.collect_item_sound.play() elif isinstance(event, events.EntityDies): entity_ID = event.entity_ID if entity_ID == self.world.player: self.player_dies_sound.play() def get_sound_file(self, filename): """Simple helper function to merge the file name and the directory name. :param filename: file name of TMX file :type filename: string """ return os.path.join('data', os.path.join('sounds', filename) )
43.819672
111
0.60419
7,881
0.982791
0
0
0
0
0
0
1,090
0.135927
195d27bed09f6f47effd9b2ab9128a9b8b6d2db2
2,227
py
Python
hammer/django_bulk/bulk_create_test.py
awolfly9/hammer
03add3037461154fd764bb3340e68393e16f015f
[ "MIT" ]
null
null
null
hammer/django_bulk/bulk_create_test.py
awolfly9/hammer
03add3037461154fd764bb3340e68393e16f015f
[ "MIT" ]
null
null
null
hammer/django_bulk/bulk_create_test.py
awolfly9/hammer
03add3037461154fd764bb3340e68393e16f015f
[ "MIT" ]
null
null
null
# -*- coding=utf-8 -*- import django import os import sys import datetime import random import time os.environ['DJANGO_SETTINGS_MODULE'] = 'web.settings' django.setup() from web.other.models import BilibiliPlay from .helper import bulk_create def test_once_get(): start = time.time() for i in range(0, 1000): info = { 'insert_date': datetime.datetime.today(), 'season_id': i, 'pub_time': datetime.datetime.today(), } BilibiliPlay.objects.get_or_create(season_id=i, insert_date=datetime.datetime.today(), defaults=info) print('test_once_get use time:%s' % (time.time() - start)) def test_once_update(): start = time.time() for i in range(1000, 2000): info = { 'insert_date': datetime.datetime.today(), 'season_id': i, 'pub_time': datetime.datetime.today(), } BilibiliPlay.objects.update_or_create(season_id=i, insert_date=datetime.datetime.today(), defaults=info) print('test_once_update use time:%s' % (time.time() - start)) def test_default_bulk(): start = time.time() objs = [] for i in range(2000, 3000): info = { 'insert_date': datetime.datetime.today(), 'season_id': i, 'pub_time': datetime.datetime.today(), } objs.append(BilibiliPlay(**info)) BilibiliPlay.objects.bulk_create(objs) print('test_default use time:%s' % (time.time() - start)) def test_custom_bulk(): start = time.time() objs = [] for i in range(3000, 4000): info = { 'insert_date': datetime.datetime.today(), 'season_id': i, 'pub_time': datetime.datetime.today(), } objs.append(BilibiliPlay(**info)) bulk_create(objs) print('test_custom use time:%s' % (time.time() - start)) if __name__ == '__main__': BilibiliPlay.objects.all().delete() # test_once_get() # test_once_update() # test_default_bulk() test_custom_bulk() ''' 'UPDATE `other_bilibili_play` SET `name` = (CASE `id` WHEN %s THEN %s WHEN %s THEN %s WHEN %s THEN %s WHEN %s THEN %s WHEN %s THEN %s ELSE `name` END) WHERE `id` in (%s, %s, %s, %s, %s)' '''
26.511905
186
0.606646
0
0
0
0
0
0
0
0
567
0.254603
195d837e267b2d3b0b05977370db15211b8d4942
37,304
py
Python
tests/rnacentral/search_export/exporter_test.py
RNAcentral/rnacentral-import-pipeline
238e573440c72581a051b16c15f56fcd25bece74
[ "Apache-2.0" ]
1
2018-08-09T14:41:16.000Z
2018-08-09T14:41:16.000Z
tests/rnacentral/search_export/exporter_test.py
RNAcentral/rnacentral-import-pipeline
238e573440c72581a051b16c15f56fcd25bece74
[ "Apache-2.0" ]
60
2015-02-04T16:43:53.000Z
2022-01-27T10:28:43.000Z
tests/rnacentral/search_export/exporter_test.py
RNAcentral/rnacentral-import-pipeline
238e573440c72581a051b16c15f56fcd25bece74
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- """ Copyright [2009-2017] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from __future__ import print_function import json import operator as op import os import re import subprocess import tempfile import xml.etree.ElementTree as ET from functools import lru_cache from xml.dom import minidom import pytest import six from rnacentral_pipeline.rnacentral.search_export import exporter from tests.helpers import run_range_as_single, run_with_replacements # Parse out all UPIs # Create temp table of UPI to get metadata for # Run queries generating all metadata for those UPIs # Delete UPI table METADATA = None META_REPLACEMENTS = { "crs.sql": ( "WHERE", "WHERE features.upi || '_' || features.taxid IN ({urs})\nAND", ), "feedback.sql": ( "FROM rnc_feedback_overlap overlap", "FROM rnc_feedback_overlap overlap\n WHERE overlap.upi_taxid IN ({urs})", ), "go_annotations.sql": ( "GROUP BY anno.rna_id", "WHERE anno.rna_id IN ({urs})\nGROUP BY anno.rna_id", ), "interacting-proteins.sql": ( "WHERE", "WHERE related.source_urs_taxid in ({urs})\n AND", ), "interacting-rnas.sql": ( "WHERE", "WHERE related.source_urs_taxid in ({urs})\n AND", ), "secondary-structure.sql": ("WHERE", "WHERE pre.id in ({urs})\n AND"), } @lru_cache() def load_metadata(): # I am using this parse the test file and pull out all URS ids that are in a # test. We then use this list to only extract metadata for the selected # sequences. This is much faster and easier on the memory requiremens # than trying to get all data. with open(__file__, "r") as raw: urs = re.findall("URS\w+", raw.read()) print(len(urs)) urs_string = ", ".join("'%s'" % u for u in urs) metapath = os.path.join("files", "search-export", "metadata") buf = six.moves.cStringIO() for filename in os.listdir(metapath): path = os.path.join(metapath, filename) raw, replace = META_REPLACEMENTS[filename] replacements = (raw, replace.format(urs=urs_string)) data = run_with_replacements(path, replacements, take_all=True) for entry in data: buf.write(json.dumps(entry)) buf.write("\n") buf.seek(0) return exporter.parse_additions(buf) def load_data(upi): path = os.path.join("files", "search-export", "query.sql") entry = run_range_as_single(upi, path) data = exporter.builder(load_metadata(), entry) return data def as_xml_dict(element): return {"attrib": element.attrib, "text": element.text} def load_and_findall(upi, selector): data = load_data(upi) return [as_xml_dict(d) for d in data.findall(selector)] def load_and_get_additional(upi, field_name): selector = "./additional_fields/field[@name='%s']" % field_name return load_and_findall(upi, selector) def load_and_get_cross_references(upi, db_name): selector = "./cross_references/ref[@dbname='%s']" % db_name results = load_and_findall(upi, selector) assert results return results def pretty_xml(data): ugly = ET.tostring(data) flattened = ugly.decode() flattened = flattened.replace("\n", "") parsed = minidom.parseString(flattened) return parsed.toprettyxml().lower() @pytest.mark.parametrize( "filename", ["data/export/search/" + f for f in os.listdir("data/export/search/")] ) def test_it_builds_correct_xml_entries(filename): result = ET.parse(filename) upi = os.path.basename(filename).replace(".xml", "") print(pretty_xml(load_data(upi))) print(pretty_xml(result.getroot())) assert pretty_xml(load_data(upi)) == pretty_xml(result.getroot()) @pytest.mark.parametrize( "upi,ans", [ # pylint: disable=E1101 ("URS0000730885_9606", "Homo sapiens"), ("URS00008CC2A4_43179", "Ictidomys tridecemlineatus"), # ('URS0000713CBE_408172', 'marine metagenome'), # ('URS000047774B_77133', 'uncultured bacterium'), ], ) def test_assigns_species_correctly(upi, ans): """ Assigns species names correctly. """ assert load_and_get_additional(upi, "species") == [ {"attrib": {"name": "species"}, "text": ans} ] @pytest.mark.skip() # pylint: disable=E1101 def test_assigns_product_correctly(upi, ans): assert load_data(upi).additional_fields.product == ans @pytest.mark.parametrize( "upi,name", [ ("URS0000730885_9606", "human"), ("URS000074C6E6_7227", "fruit fly"), ("URS00003164BE_77133", None), ], ) def test_assigns_common_name_correctly(upi, name): ans = [] if name: ans = [{"attrib": {"name": "common_name"}, "text": name}] assert load_and_get_additional(upi, "common_name") == ans @pytest.mark.parametrize( "upi,function", [ ("URS000000079A_87230", []), ("URS0000044908_2242", ["tRNA-Arg"]), ], ) def test_assigns_function_correctly(upi, function): ans = [{"attrib": {"name": "function"}, "text": f} for f in function] assert load_and_get_additional(upi, "function") == ans @pytest.mark.parametrize( "upi,ans", [ ("URS00004A23F2_559292", ["tRNA-Ser-GCT-1-1", "tRNA-Ser-GCT-1-2"]), ("URS0000547AAD_7227", ["EG:EG0002.2"]), ("URS00006DCF2F_387344", ["rrn"]), ("URS00006B19C2_77133", []), ("URS0000D5E5D0_7227", ["FBgn0286039"]), ], ) def test_assigns_gene_correctly(upi, ans): assert sorted(d["text"] for d in load_and_get_additional(upi, "gene")) == ans @pytest.mark.parametrize( "upi,genes", [ ("URS00006B19C2_77133", set([])), ("URS0000547AAD_7227", {"FBgn0019661", "roX1"}), ("URS0000D5E40F_7227", {"CR46362"}), ( "URS0000773F8D_7227", { "CR46280", "dme-mir-9384", r"Dmel\CR46280", }, ), ( "URS0000602386_7227", { "276a", "CR33584", "CR33585", "CR43001", r"Dmel\CR43001", "MIR-276", "MiR-276a", "dme-miR-276a", "dme-miR-276a-3p", "dme-mir-276", "dme-mir-276a", "miR-276", "miR-276a", "miR-276aS", "mir-276", "mir-276aS", "rosa", }, ), ( "URS000060F735_9606", { "ASMTL-AS", "ASMTL-AS1", "ASMTLAS", "CXYorf2", # 'ENSG00000236017.2', # 'ENSG00000236017.3', # 'ENSG00000236017.8', "ENSGR0000236017.2", "NCRNA00105", "OTTHUMG00000021056.2", }, ), ], ) def test_assigns_gene_synonym_correctly(upi, genes): val = {a["text"] for a in load_and_get_additional(upi, "gene_synonym")} assert val == genes @pytest.mark.parametrize( "upi,transcript_ids", [ ("URS0000D5E5D0_7227", {"FBtr0473389"}), ], ) def test_can_search_using_flybase_transcript_ids(upi, transcript_ids): val = {c["attrib"]["dbkey"] for c in load_and_get_cross_references(upi, "FLYBASE")} assert val == transcript_ids @pytest.mark.parametrize( "upi,gene,symbol", [ pytest.param( "URS000013BC78_4896", "SPSNORNA.29", "sno52", marks=pytest.mark.xfail ), ], ) def test_can_search_for_pombase_ids(upi, gene, symbol): val = {x["text"] for x in load_and_get_additional(upi, "gene")} assert gene in val val = {x["text"] for x in load_and_get_additional(upi, "gene_synonym")} assert symbol in val @pytest.mark.parametrize( "upi,ans", [ # pylint: disable=E1101 ("URS000047774B_77133", 594), ("URS0000000559_77133", 525), ("URS000000055B_479808", 163), # ('URS0000000635_283360', 166), ("URS0000000647_77133", 1431), ("URS000087608D_77133", 1378), ("URS0000000658_317513", 119), ("URS0000000651_1005506", 73), ("URS0000000651_1128969", 73), # ('URS0000000653_502127', 173), ], ) def test_assigns_length_correctly(upi, ans): assert load_and_get_additional(upi, "length") == [ {"attrib": {"name": "length"}, "text": str(ans)} ] @pytest.mark.parametrize( "upi,ans", [ # pylint: disable=E1101 ("URS00006C4604_1094186", "294dd04c4468af596c2bc963108c94d5"), ("URS00000000A8_77133", "1fe472d874a850b4a6ea11f665531637"), ("URS0000753F51_77133", "c141e8f137bf1060aa10817a1ac30bb1"), ("URS0000000004_77133", "030c78be0f492872b95219d172e0c658"), # ('URS000000000E_175245', '030ca7ba056f2fb0bd660cacdb95b726'), ("URS00000000CC_29466", "1fe49d2a685ee4ce305685cd597fb64c"), ("URS0000000024_77133", "6bba748d0b52b67d685a7dc4b07908fa"), # ('URS00006F54ED_10020', 'e1bc9ef45f3953a364b251f65e5dd3bc'), # May no longer have active xrefs ("URS0000000041_199602", "030d4da42d219341ad1d1ab592cf77a2"), ("URS0000000065_77133", "030d80f6335df3316afdb54fc1ba1756"), ], ) def test_assigns_md5_correctly(upi, ans): assert load_and_get_additional(upi, "md5") == [ {"attrib": {"name": "md5"}, "text": str(ans)} ] @pytest.mark.parametrize( "upi,ans", [ # pylint: disable=E1101 ( "URS0000062D2A_77133", "uncultured bacterium partial contains 16S ribosomal RNA, 16S-23S ribosomal RNA intergenic spacer, and 23S ribosomal RNA", ), ("URS00000936FF_9606", "Homo sapiens (human) piR-56608"), ("URS00000C45DB_10090", "Mus musculus (house mouse) piR-101106"), ("URS0000003085_7460", "Apis mellifera (honey bee) ame-miR-279a-3p"), ( "URS00000C6428_980671", "Lophanthus lipskyanus partial external transcribed spacer", ), ("URS00007268A2_9483", "Callithrix jacchus microRNA mir-1255"), ( "URS0000A9662A_10020", "Dipodomys ordii (Ord's kangaroo rat) misc RNA 7SK RNA (RF00100)", ), ("URS00000F8376_10090", "Mus musculus (house mouse) piR-6392"), ("URS00000F880C_9606", "Homo sapiens (human) partial ncRNA"), ( "URS00000054D5_6239", "Caenorhabditis elegans piwi-interacting RNA 21ur-14894", ), ( "URS0000157781_6239", "Caenorhabditis elegans piwi-interacting RNA 21ur-13325", ), ("URS0000005F8E_9685", "Felis catus mir-103/107 microRNA precursor"), ("URS000058FFCF_7729", u"Halocynthia roretzi tRNA Gly ÊCU"), ], ) def test_assigns_description_correctly_to_randomly_chosen_examples(upi, ans): assert [e["text"] for e in load_and_findall(upi, "./description")] == [ans] @pytest.mark.parametrize( "upi,ans", [ # pylint: disable=E1101 ("URS0000409697_3702", "tRNA"), ("URS0000ABD7EF_9606", "rRNA"), ("URS00001E2C22_3702", "rRNA"), ("URS00005F2C2D_4932", "rRNA"), ("URS000019E0CD_9606", "lncRNA"), ("URS00007FD8A3_7227", "lncRNA"), ("URS0000086133_9606", "misc RNA"), ("URS00007A9FDC_6239", "misc RNA"), ("URS000025C52E_9606", "other"), ("URS000075C290_9606", "precursor RNA"), ("URS0000130A6B_3702", "precursor RNA"), ("URS0000734D8F_9606", "snRNA"), ("URS000032B6B6_9606", "snRNA"), ("URS000075EF5D_9606", "snRNA"), ("URS0000569A4A_9606", "snoRNA"), ("URS00008E398A_9606", "snoRNA"), ("URS00006BA413_9606", "snoRNA"), ("URS0000A8F612_9371", "snoRNA"), ("URS000092FF0A_9371", "snoRNA"), ("URS00005D0BAB_9606", "piRNA"), ("URS00002AE808_10090", "miRNA"), ("URS00003054F4_6239", "piRNA"), ("URS00000478B7_9606", "SRP RNA"), ("URS000024083D_9606", "SRP RNA"), ("URS00002963C4_4565", "SRP RNA"), ("URS000040F7EF_4577", "siRNA"), ("URS00000DA486_3702", "other"), # ('URS00006B14E9_6183', 'hammerhead ribozyme'), ("URS0000808D19_644", "hammerhead ribozyme"), ("URS000080DFDA_32630", "hammerhead ribozyme"), ("URS000086852D_32630", "hammerhead ribozyme"), ("URS00006C670E_30608", "hammerhead ribozyme"), ("URS000045EBF2_9606", "lncRNA"), ("URS0000157BA2_4896", "antisense RNA"), ("URS00002F216C_36329", "antisense RNA"), ("URS000075A336_9606", "miRNA"), # ('URS0000175007_7227', 'miRNA'), ("URS000015995E_4615", "miRNA"), ("URS0000564CC6_224308", "tmRNA"), ("URS000059EA49_32644", "tmRNA"), ("URS0000764CCC_1415657", "RNase P RNA"), ("URS00005CDD41_352472", "RNase P RNA"), # ('URS000072A167_10141', 'Y RNA'), ("URS00004A2461_9606", "Y RNA"), ("URS00005CF03F_9606", "Y RNA"), ("URS000021515D_322710", "autocatalytically spliced intron"), ("URS000012DE89_9606", "autocatalytically spliced intron"), ("URS000061DECF_1235461", "autocatalytically spliced intron"), ("URS00006233F9_9606", "ribozyme"), ("URS000080DD33_32630", "ribozyme"), ("URS00006A938C_10090", "ribozyme"), ("URS0000193C7E_9606", "scRNA"), ("URS00004B11CA_223283", "scRNA"), # ('URS000060C682_9606', 'vault RNA'), # Not active ("URS000064A09E_13616", "vault RNA"), ("URS00003EE18C_9544", "vault RNA"), ("URS000059A8B2_7227", "rasiRNA"), ("URS00000B3045_7227", "guide RNA"), ("URS000082AF7D_5699", "guide RNA"), ("URS000077FBEB_9606", "lncRNA"), ("URS00000101E5_9606", "lncRNA"), ("URS0000A994FE_9606", "other"), ("URS0000714027_9031", "other"), ("URS000065BB41_7955", "other"), ("URS000049E122_9606", "misc RNA"), ("URS000013F331_9606", "RNase P RNA"), ("URS00005EF0FF_4577", "siRNA"), ], ) def test_assigns_rna_type_correctly(upi, ans): assert load_and_get_additional(upi, "rna_type") == [ {"attrib": {"name": "rna_type"}, "text": str(ans)} ] @pytest.mark.parametrize( "upi,ans", [ # pylint: disable=E1101 ( "URS00004AFF8D_9544", [ "ENA", "RefSeq", "miRBase", ], ), ("URS00001DA281_9606", ["ENA", "GtRNAdb", "HGNC", "PDBe"]), ], ) def test_correctly_gets_expert_db(upi, ans): data = sorted(d["text"] for d in load_and_get_additional(upi, "expert_db")) assert data == ans @pytest.mark.parametrize( "upi,ans", [ # pylint: disable=E1101 ( "URS00004AFF8D_9544", { "MIRLET7G", "mml-let-7g-5p", "mml-let-7g", "let-7g-5p", "let-7g", "let-7", }, ), ( "URS00001F1DA8_9606", { "MIR126", "hsa-miR-126", "hsa-miR-126-3p", "miR-126", "miR-126-3p", }, ), ], ) def test_correctly_assigns_mirbase_gene_using_product(upi, ans): data = load_and_get_additional(upi, "gene") val = set(d["text"] for d in data) print(val) print(ans) assert val == ans @pytest.mark.skip() # pylint: disable=E1101 def test_correctly_assigns_active(upi, ans): assert load_data(upi).additional_fields.is_active == ans # Test that this assigns authors from > 1 publications to a single set @pytest.mark.skip() # pylint: disable=E1101 def test_assigns_authors_correctly(upi, ans): assert load_data(upi).additional_fields.authors == ans @pytest.mark.parametrize( "upi,ans", [ # Very slow on test, but ok on production # ('URS000036D40A_9606', 'mitochondrion'), ("URS00001A9410_109965", "mitochondrion"), ("URS0000257A1C_10090", "plastid"), ("URS00002A6263_3702", "plastid:chloroplast"), ("URS0000476A1C_3702", "plastid:chloroplast"), ], ) def test_assigns_organelle_correctly(upi, ans): assert load_and_get_additional(upi, "organelle") == [ {"attrib": {"name": "organelle"}, "text": str(ans)} ] @pytest.mark.parametrize( "upi,ans", [ ( "URS000000079A_87230", [ {"attrib": {"dbname": "ENA", "dbkey": "AM233399.1"}, "text": None}, { "attrib": {"dbkey": "87230", "dbname": "ncbi_taxonomy_id"}, "text": None, }, ], ) ], ) def test_can_assign_correct_cross_references(upi, ans): data = load_data(upi) results = data.findall("./cross_references/ref") assert [as_xml_dict(r) for r in results] == ans def test_can_create_document_with_unicode(): key = op.itemgetter("text") val = sorted(load_and_get_additional("URS000009EE82_562", "product"), key=key) assert val == sorted( [ {"attrib": {"name": "product"}, "text": u"tRNA-Asp(gtc)"}, {"attrib": {"name": "product"}, "text": u"P-site tRNA Aspartate"}, {"attrib": {"name": "product"}, "text": u"transfer RNA-Asp"}, {"attrib": {"name": "product"}, "text": u"tRNA_Asp_GTC"}, {"attrib": {"name": "product"}, "text": u"tRNA-asp"}, {"attrib": {"name": "product"}, "text": u"tRNA Asp ⊄UC"}, {"attrib": {"name": "product"}, "text": u"tRNA-Asp"}, {"attrib": {"name": "product"}, "text": u"tRNA-Asp-GTC"}, {"attrib": {"name": "product"}, "text": u"ASPARTYL TRNA"}, {"attrib": {"name": "product"}, "text": u"tRNA-Asp (GTC)"}, ], key=key, ) def test_it_can_handle_a_list_in_ontology(): data = load_data("URS00003B5CA5_559292") results = data.findall("./cross_references/ref") xrefs = {as_xml_dict(r)["attrib"]["dbkey"] for r in results} assert {"ECO:0000202", u"GO:0030533", "SO:0000253"} & xrefs # @pytest.mark.skip() # def test_produces_correct_count(): # entries = exporter.range(db(), 1, 100) # with tempfile.NamedTemporaryFile() as out: # exporter.write(out, entries) # out.flush() # with open(out.name, 'r') as raw: # parsed = ET.parse(raw) # count = parsed.find('./entry_count') # assert count.text == '105' @pytest.mark.parametrize( "upi,ans", [ # pylint: disable=E1101 ("URS0000759CF4_9606", 9606), ("URS0000724ACA_7955", 7955), ("URS000015E0AD_10090", 10090), ("URS00005B8078_3702", 3702), ("URS0000669249_6239", 6239), ("URS0000377114_7227", 7227), ("URS000006F31F_559292", 559292), ("URS0000614AD9_4896", 4896), ("URS0000AB68F4_511145", 511145), ("URS0000775421_224308", 224308), ("URS00009C1EFD_9595", None), ("URS0000BC697F_885580", None), ], ) def test_correctly_assigns_popular_species(upi, ans): result = [] if ans: result = [{"attrib": {"name": "popular_species"}, "text": str(ans)}] assert load_and_get_additional(upi, "popular_species") == result @pytest.mark.parametrize( "upi,problems", [ # pylint: disable=E1101 ("URS0000001EB3_9595", ["none"]), ("URS000014C3B0_7227", ["possible_contamination"]), ("URS0000010837_7227", ["incomplete_sequence", "possible_contamination"]), ("URS000052E2E9_289219", ["possible_contamination"]), ("URS00002411EE_10090", ["missing_rfam_match"]), ], ) def test_it_correctly_build_qc_warnings(upi, problems): # ans = [{'attrib': {'name': 'qc_warning'}, 'text': p} for p in problems] val = [a["text"] for a in load_and_get_additional(upi, "qc_warning")] assert sorted(val) == sorted(problems) @pytest.mark.parametrize( "upi,status", [ # pylint: disable=E1101 ("URS0000000006_1317357", False), ("URS000075D95B_9606", False), ("URS00008C5577_77133", False), ("URS0000001EB3_9595", False), ("URS000014C3B0_7227", True), ("URS0000010837_7227", True), ("URS000052E2E9_289219", True), ], ) def test_it_correctly_assigns_qc_warning_found(upi, status): assert load_and_get_additional(upi, "qc_warning_found") == [ {"attrib": {"name": "qc_warning_found"}, "text": str(status)}, ] @pytest.mark.parametrize( "upi,status", [ # pylint: disable=E1101 # ('URS0000A77400_9606', True), ("URS0000444F9B_559292", True), ("URS0000592212_7227", False), # ('URS000071F071_7955', True), # ('URS000071F4D6_7955', True), ("URS000075EAAC_9606", True), ("URS00007F81F8_511145", False), ("URS0000A16E25_198431", False), ("URS0000A7ED87_7955", True), ("URS0000A81C5E_9606", True), ("URS0000ABD87F_9606", True), ("URS0000D47880_3702", True), ], ) def test_can_correctly_assign_coordinates(upi, status): assert load_and_get_additional(upi, "has_genomic_coordinates") == [ {"attrib": {"name": "has_genomic_coordinates"}, "text": str(status)}, ] @pytest.mark.parametrize( "upi", [ # pylint: disable=E1101 "URS00004B0F34_562", "URS00000ABFE9_562", "URS0000049E57_562", ], ) def test_does_not_produce_empty_rfam_warnings(upi): assert load_and_get_additional(upi, "qc_warning") == [ {"attrib": {"name": "qc_warning"}, "text": "none"}, ] @pytest.mark.parametrize( "upi,boost", [ # pylint: disable=E1101 ("URS0000B5D04E_1457030", 1), ("URS0000803319_904691", 1), ("URS00009ADB88_9606", 3), ("URS000049E122_9606", 2.5), ("URS000047450F_1286640", 0.0), ("URS0000143578_77133", 0.5), ("URS000074C6E6_7227", 2), ("URS00007B5259_3702", 2), ("URS00007E35EF_9606", 4), ("URS00003AF3ED_3702", 1.5), ], ) def test_computes_valid_boost(upi, boost): assert load_and_get_additional(upi, "boost") == [ {"attrib": {"name": "boost"}, "text": str(boost)} ] @pytest.mark.parametrize( "upi,pub_ids", [ # pylint: disable=E1101 ("URS0000BB15D5_9606", [512936, 527789]), ("URS000019E0CD_9606", [238832, 538386, 164929, 491042, 491041]), ], ) def test_computes_pub_ids(upi, pub_ids): val = sorted(int(a["text"]) for a in load_and_get_additional(upi, "pub_id")) assert val == sorted(pub_ids) @pytest.mark.xfail(reason="Changed how publications are fetched for now") @pytest.mark.parametrize( "upi,pmid", [ # pylint: disable=E1101 ("URS000026261D_9606", 27021683), ("URS0000614A9B_9606", 28111633), ], ) def test_can_add_publications_from_go_annotations(upi, pmid): val = {c["attrib"]["dbkey"] for c in load_and_get_cross_references(upi, "PUBMED")} assert str(pmid) in val @pytest.mark.parametrize( "upi,qualifier,ans", [ # pylint: disable=E1101 ("URS000026261D_9606", "part_of", ["GO:0005615", "extracellular space"]), ( "URS0000614A9B_9606", "involved_in", [ "GO:0010628", "GO:0010629", "GO:0035195", "GO:0060045", "positive regulation of gene expression", "negative regulation of gene expression", "gene silencing by miRNA", "positive regulation of cardiac muscle cell proliferation", ], ), ], ) def test_can_assign_go_annotations(upi, qualifier, ans): val = {a["text"] for a in load_and_get_additional(upi, qualifier)} assert sorted(val) == sorted(ans) @pytest.mark.parametrize( "upi,has", [ # pylint: disable=E1101 ("URS000026261D_9606", True), ("URS0000614A9B_9606", True), ("URS000019E0CD_9606", False), ("URS0000003085_7460", False), ], ) def test_it_can_add_valid_annotations_flag(upi, has): assert load_and_get_additional(upi, "has_go_annotations") == [ {"attrib": {"name": "has_go_annotations"}, "text": str(has)}, ] @pytest.mark.parametrize( "upi,expected", [ # pylint: disable=E1101 ("URS0000160683_10090", ["BHF-UCL", "MGI"]), ("URS00002075FA_10116", ["BHF-UCL", "GOC"]), ("URS00001FCFC1_559292", ["SGD"]), ("URS0000759CF4_9606", ["Not Available"]), ], ) def test_adds_field_for_source_of_go_annotations(upi, expected): data = load_and_get_additional(upi, "go_annotation_source") assert [d["text"] for d in data] == expected @pytest.mark.parametrize( "upi,expected", [ # pylint: disable=E1101 ("URS0000CABCE0_1970608", ["RF00005"]), ("URS0000C9A3EE_384", ["RF02541", "RF00005"]), ], ) def test_assigns_rfam_ids_to_hits(upi, expected): data = load_and_get_additional(upi, "rfam_id") assert sorted(d["text"] for d in data) == sorted(expected) @pytest.mark.parametrize( "upi,expected", [ # pylint: disable=E1101 ("URS000020CEC2_9606", True), ("URS000026261D_9606", True), ("URS0000759CF4_9606", False), ("URS0000759CF4_9606", False), ], ) def test_can_detect_if_has_interacting_proteins(upi, expected): assert load_and_get_additional(upi, "has_interacting_proteins") == [ {"attrib": {"name": "has_interacting_proteins"}, "text": str(expected)} ] @pytest.mark.parametrize( "upi,expected", [ # pylint: disable=E1101 ( "URS000075E072_9606", { "ENSG00000026025", "ENSG00000074706", "ENSG00000108064", "ENSG00000108839", "ENSG00000124593", "ENSG00000135334", "ENSG00000164330", "ENSG00000174839", "ENSG00000177189", "ENSG00000183283", "ENSG00000197646", "12S-LOX", "AFI1A", "AKIRIN2", "AL365205.1", "ALOX12", "B7-DC", "Btdc", "C6orf166", "CD273", "CLS", "COE1", "DAZAP2", "DENND6A", "EBF", "EBF1", "FAM116A", "FLJ10342", "FLJ34969", "HU-3", "IPCEF1", "KIAA0058", "KIAA0403", "MRX19", "OLF1", "PD-L2", "PDCD1LG2", "PDL2", "PIP3-E", "RPS6KA3", "RSK2", "TCF6", "TCF6L2", "TFAM", "VIM", "bA574F11.2", "dJ486L4.2", }, ), ("URS0000759CF4_9606", set()), ], ) def test_can_protein_information_for_related_proteins(upi, expected): data = load_and_get_additional(upi, "interacting_protein") proteins = set(d["text"] for d in data) assert proteins == expected @pytest.mark.parametrize( "upi,expected", [ # pylint: disable=E1101 ("URS000075E072_9606", {"PAR-CLIP"}), ("URS0000759CF4_9606", set()), ], ) def test_can_methods_for_interactions(upi, expected): data = load_and_get_additional(upi, "evidence_for_interaction") evidence = set(d["text"] for d in data) assert evidence == expected @pytest.mark.parametrize( "upi,flag", [ # pylint: disable=E1101 ("URS00009BEE76_9606", True), ("URS000019E0CD_9606", True), ("URS0000ABD7E8_9606", False), ], ) def test_knows_has_crs(upi, flag): data = load_and_get_additional(upi, "has_conserved_structure") value = [d["text"] for d in data] assert value == [str(flag)] @pytest.mark.parametrize( "upi,crs_ids", [ # pylint: disable=E1101 ( "URS00009BEE76_9606", { "M1412625", "M2510292", "M0554312", "M2543977", "M2513462", "M1849371", "M1849369", "M0554307", }, ), ("URS0000ABD7E8_9606", set([])), ], ) def test_assigns_correct_crs_ids(upi, crs_ids): data = load_and_get_additional(upi, "conserved_structure") value = {d["text"] for d in data} assert value == crs_ids @pytest.mark.parametrize( "upi,expected", [ # pylint: disable=E1101 ("URS0000A59F5E_7227", set()), ("URS0000014447_7240", {"ENA", "FlyBase", "miRBase", "Rfam"}), ("URS0000ABD7E8_9606", set()), ], ) def test_assigns_correct_overlaps(upi, expected): data = load_and_get_additional(upi, "overlaps_with") value = {d["text"] for d in data} assert value == expected @pytest.mark.parametrize( "upi,expected", [ # pylint: disable=E1101 ( "URS0000A59F5E_7227", { "FlyBase", "miRBase", "Modomics", "PDBe", "RefSeq", "Rfam", "SILVA", "snOPY", "SRPDB", }, ), ("URS0000014447_7240", set()), ("URS0000ABD7E8_9606", set()), ], ) def test_assigns_correct_no_overlaps(upi, expected): data = load_and_get_additional(upi, "no_overlaps_with") value = {d["text"] for d in data} assert value == expected @pytest.mark.parametrize( "upi,expected", [ # pylint: disable=E1101 ( "URS000026261D_9606", { "URS00005EB21E_9606", "URS0000142654_9606", "URS0000A91D1A_9606", "URS000029E633_9606", "URS00001D61C5_9606", "URS00007D759B_9606", "URS00002C6CC0_9606", "URS00008BBA89_9606", "URS000008C8EB_9606", "URS0000A887DA_9606", "URS000002964A_9606", "URS0000304D5D_9606", "URS00009C5E9B_9606", "URS00000F38DD_9606", "URS0000141778_9606", "URS000044954E_9606", "URS0000D61BD6_9606", "URS0000AA0D63_9606", "URS000035AC9C_9606", "URS00007BF182_9606", "URS000077BE2A_9606", "URS0000543B4D_9606", "URS0000D63D56_9606", "URS00004E64F9_9606", "URS0000264D7F_9606", "URS00008C22F5_9606", "URS00004CDF42_9606", "URS00001ED6BE_9606", "URS00002989CF_9606", "URS000076891D_9606", "URS00002F49FD_9606", "URS000017366C_9606", "URS0000783AD8_9606", "URS00007716E5_9606", "URS00004DBD55_9606", "URS0000499E31_9606", "URS0000318782_9606", "URS00001118C6_9606", "URS000009D1B1_9606", "URS00000CE0D1_9606", "URS0000784209_9606", "URS000040AD32_9606", "URS00001F136D_9606", "URS00004942CA_9606", "URS00001A182D_9606", "URS00007836D4_9606", "URS000077EF2F_9606", "ENSG00000157306", "ENSG00000177822", "ENSG00000196756", "ENSG00000204584", "ENSG00000206337", "ENSG00000214106", "ENSG00000214548", "ENSG00000225138", "ENSG00000225733", "ENSG00000229807", "ENSG00000231074", "ENSG00000233937", "ENSG00000234456", "ENSG00000235423", "ENSG00000235499", "ENSG00000244300", "ENSG00000245532", "ENSG00000247556", "ENSG00000248092", "ENSG00000249087", "ENSG00000251209", "ENSG00000251562", "ENSG00000253352", "ENSG00000255108", "ENSG00000255175", "ENSG00000255717", "ENSG00000256732", "ENSG00000257698", "ENSG00000260032", "ENSG00000260276", "ENSG00000260423", "ENSG00000261409", "ENSG00000261428", "ENSG00000262877", "ENSG00000266896", "ENSG00000267078", "ENSG00000267263", "ENSG00000267322", "ENSG00000268027", "ENSG00000269821", "ENSG00000270006", "ENSG00000270066", "ENSG00000272512", "ENSG00000272918", "ENSG00000273001", "ENSG00000274895", "ENSG00000275413", "ENSG00000214297", "ENSG00000218980", "ENSG00000219507", "ENSG00000224631", "ENSG00000225093", "ENSG00000225674", "ENSG00000225972", "ENSG00000226564", "ENSG00000226752", "ENSG00000227081", "ENSG00000227347", "ENSG00000227777", "ENSG00000228232", "ENSG00000228834", "ENSG00000229473", "ENSG00000231752", "ENSG00000232282", "ENSG00000232573", "ENSG00000234975", "ENSG00000235095", "ENSG00000237264", "ENSG00000237350", "ENSG00000237999", "ENSG00000239218", "ENSG00000242294", "ENSG00000242299", "ENSG00000243265", "ENSG00000244535", "ENSG00000247627", "ENSG00000256211", "ENSG00000257199", "ENSG00000257307", "ENSG00000257379", "ENSG00000259751", "ENSG00000259758", "ENSG00000261864", "ENSG00000264772", "ENSG00000267482", "ENSG00000269374", "ENSG00000269378", "ENSG00000271525", "ENSG00000272578", "ENSG00000277358", "ENSG00000279978", "ENSG00000142396", "ENSG00000152117", "ENSG00000172974", "ENSG00000175841", "ENSG00000182310", "ENSG00000183298", "ENSG00000188460", "ENSG00000196204", "ENSG00000198744", "ENSG00000204623", }, ), ("URS0000759CF4_9606", set()), ], ) def test_assigns_correct_interacting_rnas(upi, expected): data = load_and_get_additional(upi, "interacting_rna") value = {d["text"] for d in data} assert value == expected @pytest.mark.parametrize( "upi,flag", [ ("URS000047BD19_77133", True), ("URS00005B9F86_77133", True), ("URS0000239F73_77133", True), ("URS0000DF5B98_34613", False), ], ) def test_knows_if_has_secondary_structure(upi, flag): assert load_and_get_additional(upi, "has_secondary_structure") == [ {"attrib": {"name": "has_secondary_structure"}, "text": str(flag)} ] @pytest.mark.parametrize( "upi,models", [ ("URS000047BD19_77133", ["d.16.b.S.aureus.GEN"]), ("URS00005B9F86_77133", ["d.16.b.S.pneumoniae"]), ("URS0000239F73_77133", ["d.16.b.O.agardhii"]), ("URS0000DF5B98_34613", []), ], ) def test_sets_valid_model_name(upi, models): ans = [{"attrib": {"name": "secondary_structure_model"}, "text": m} for m in models] data = load_and_get_additional(upi, "secondary_structure_model") assert data == ans @pytest.mark.parametrize( "upi,url", [ ( "URS000075A546_9606", "http://www.mirbase.org/cgi-bin/mirna_entry.pl?acc=MI0031512", ), ], ) def test_computes_correct_urls(upi, url): data = load_and_get_additional(upi, "secondary_structure_model") expected = [{"attrib": {"name": "url"}, "text": url}] assert data == expected
31.829352
134
0.562781
0
0
0
0
32,642
0.874956
0
0
16,853
0.451738
195f3150d0257121a8dd90bf3f90e35c01b0fa1c
1,921
py
Python
misago/threads/tests/test_thread_poll_api.py
HenryChenV/iJiangNan
68f156d264014939f0302222e16e3125119dd3e3
[ "MIT" ]
1
2017-07-25T03:04:36.000Z
2017-07-25T03:04:36.000Z
misago/threads/tests/test_thread_poll_api.py
HenryChenV/iJiangNan
68f156d264014939f0302222e16e3125119dd3e3
[ "MIT" ]
null
null
null
misago/threads/tests/test_thread_poll_api.py
HenryChenV/iJiangNan
68f156d264014939f0302222e16e3125119dd3e3
[ "MIT" ]
null
null
null
import json from django.urls import reverse from misago.acl.testutils import override_acl from misago.categories.models import Category from misago.threads import testutils from misago.users.testutils import AuthenticatedUserTestCase class ThreadPollApiTestCase(AuthenticatedUserTestCase): def setUp(self): super(ThreadPollApiTestCase, self).setUp() self.category = Category.objects.get(slug='first-category') self.thread = testutils.post_thread(self.category, poster=self.user) self.override_acl() self.api_link = reverse( 'misago:api:thread-poll-list', kwargs={ 'thread_pk': self.thread.pk, } ) def post(self, url, data=None): return self.client.post(url, json.dumps(data or {}), content_type='application/json') def put(self, url, data=None): return self.client.put(url, json.dumps(data or {}), content_type='application/json') def override_acl(self, user=None, category=None): new_acl = self.user.acl_cache new_acl['categories'][self.category.pk].update({ 'can_see': 1, 'can_browse': 1, 'can_close_threads': 0, }) new_acl.update({ 'can_start_polls': 1, 'can_edit_polls': 1, 'can_delete_polls': 1, 'poll_edit_time': 0, 'can_always_see_poll_voters': 0, }) if user: new_acl.update(user) if category: new_acl['categories'][self.category.pk].update(category) override_acl(self.user, new_acl) def mock_poll(self): self.poll = self.thread.poll = testutils.post_poll(self.thread, self.user) self.api_link = reverse( 'misago:api:thread-poll-detail', kwargs={ 'thread_pk': self.thread.pk, 'pk': self.poll.pk, } )
30.015625
93
0.605934
1,682
0.875586
0
0
0
0
0
0
297
0.154607
19618fa1e0fd69bf4ce89b6dd9ce0cf4d5bdf4a2
33
py
Python
PosPy/__init__.py
richierh/PointofSalePy
54fc11b5f167d361c75b6b1cb890c7020393d46c
[ "Apache-2.0" ]
null
null
null
PosPy/__init__.py
richierh/PointofSalePy
54fc11b5f167d361c75b6b1cb890c7020393d46c
[ "Apache-2.0" ]
null
null
null
PosPy/__init__.py
richierh/PointofSalePy
54fc11b5f167d361c75b6b1cb890c7020393d46c
[ "Apache-2.0" ]
null
null
null
#!usr/bin/python import __main__
11
16
0.787879
0
0
0
0
0
0
0
0
16
0.484848
196257af7109744f1d324ddf851e3f43ec9a1048
457
py
Python
__init__.py
patilaja/sqlalchemy-challenge
96e210106d31beb74d4ec5e42b20f5fd2d60db05
[ "ADSL" ]
null
null
null
__init__.py
patilaja/sqlalchemy-challenge
96e210106d31beb74d4ec5e42b20f5fd2d60db05
[ "ADSL" ]
null
null
null
__init__.py
patilaja/sqlalchemy-challenge
96e210106d31beb74d4ec5e42b20f5fd2d60db05
[ "ADSL" ]
null
null
null
#Helper method that implements the logic to look up an application. def get_app(self, reference_app=None): if reference_app is not None: return reference_app if self.app is not None: return self.app if current_app: return current_app._get_current_object() raise RuntimeError( 'No application found.See' ' http://flask-sqlalchemy.pocoo.org/contexts/.' )
30.466667
68
0.617068
0
0
0
0
0
0
0
0
140
0.306346
196317379bcca4ea114372256f94af6d980d0618
9,717
py
Python
demisto_sdk/commands/run_test_playbook/test_playbook_runner.py
SergeBakharev/demisto-sdk
17d00942a1bd33039a8aba9ddffecfd81008d275
[ "MIT" ]
null
null
null
demisto_sdk/commands/run_test_playbook/test_playbook_runner.py
SergeBakharev/demisto-sdk
17d00942a1bd33039a8aba9ddffecfd81008d275
[ "MIT" ]
null
null
null
demisto_sdk/commands/run_test_playbook/test_playbook_runner.py
SergeBakharev/demisto-sdk
17d00942a1bd33039a8aba9ddffecfd81008d275
[ "MIT" ]
null
null
null
import os import re import time import demisto_client from demisto_client.demisto_api.rest import ApiException from demisto_sdk.commands.common.tools import LOG_COLORS, get_yaml, print_color from demisto_sdk.commands.upload.uploader import Uploader SUCCESS_RETURN_CODE = 0 ERROR_RETURN_CODE = 1 ENTRY_TYPE_ERROR = 4 class TestPlaybookRunner: """TestPlaybookRunner is a class that's designed to run a test playbook in a given XSOAR instance. Attributes: test_playbook_path (str): the input of the test playbook to run all (bool): whether to wait until the playbook run is completed or not. should_wait (bool): whether to wait until the test playbook run is completed or not. timeout (int): timeout for the command. The test playbook will continue to run in your xsoar instance. demisto_client (DefaultApi): Demisto-SDK client object. base_link_to_workplan (str): the base link to see the full test playbook run in your xsoar instance. """ def __init__(self, test_playbook_path: str = '', all: bool = False, wait: bool = True, timeout: int = 90, insecure: bool = False): self.test_playbook_path = test_playbook_path self.all_test_playbooks = all self.should_wait = wait self.timeout = timeout # we set to None so demisto_client will use env var DEMISTO_VERIFY_SSL self.verify = (not insecure) if insecure else None self.demisto_client = demisto_client.configure(verify_ssl=self.verify) self.base_link_to_workplan = self.get_base_link_to_workplan() def manage_and_run_test_playbooks(self): """ Manages all ru-test-playbook command flows return The exit code of each flow """ status_code = SUCCESS_RETURN_CODE test_playbooks: list = [] if not self.validate_tpb_path(): status_code = ERROR_RETURN_CODE test_playbooks.extend(self.collect_all_tpb_files_paths()) for tpb in test_playbooks: self.upload_tpb(tpb_file=tpb) test_playbook_id = self.get_test_playbook_id(tpb) status_code = self.run_test_playbook_by_id(test_playbook_id) return status_code def collect_all_tpb_files_paths(self): test_playbooks: list = [] # Run all repo test playbooks if self.all_test_playbooks: test_playbooks.extend(self.get_all_test_playbooks()) # Run all pack test playbooks elif os.path.isdir(self.test_playbook_path): test_playbooks.extend(self.get_test_playbooks_from_folder(self.test_playbook_path)) # Run specific test playbook elif os.path.isfile(self.test_playbook_path): test_playbooks.append(self.test_playbook_path) return test_playbooks def validate_tpb_path(self) -> bool: """ Verifies that the input path configuration given by the user is correct :return: The verification result """ is_path_valid = True if not self.all_test_playbooks: if not self.test_playbook_path: print_color("Error: Missing option '-tpb' / '--test-playbook-path'.", LOG_COLORS.RED) is_path_valid = False elif not os.path.exists(self.test_playbook_path): print_color(f'Error: Given input path: {self.test_playbook_path} does not exist', LOG_COLORS.RED) is_path_valid = False return is_path_valid def get_test_playbook_id(self, file_path): """ Get test playbook ID from test playbook file name """ test_playbook_data = get_yaml(file_path=file_path) return test_playbook_data.get('id') def get_test_playbooks_from_folder(self, folder_path): """ Get all pack test playbooks """ full_path = f'{folder_path}/TestPlaybooks' list_test_playbooks_files = os.listdir(full_path) list_test_playbooks_files = [f'{full_path}/{tpb}' for tpb in list_test_playbooks_files] return list_test_playbooks_files def get_all_test_playbooks(self): """ Get all the repo test playbooks """ tpb_list: list = [] packs_list = os.listdir('Packs') for pack in packs_list: if os.path.isdir(f'Packs/{pack}'): tpb_list.extend(self.get_test_playbooks_from_folder(f'Packs/{pack}')) return tpb_list def run_test_playbook_by_id(self, test_playbook_id): """Run a test playbook in your xsoar instance. Returns: int. 0 in success, 1 in a failure. """ status_code: int = SUCCESS_RETURN_CODE # create an incident with the given playbook try: incident_id = self.create_incident_with_test_playbook( incident_name=f'inc_{test_playbook_id}', test_playbook_id=test_playbook_id) except ApiException as a: print_color(str(a), LOG_COLORS.RED) status_code = ERROR_RETURN_CODE work_plan_link = self.base_link_to_workplan + str(incident_id) if self.should_wait: status_code = self.run_and_check_tpb_status(test_playbook_id, work_plan_link, incident_id) else: print_color(f'To see results please go to : {work_plan_link}', LOG_COLORS.NATIVE) return status_code def run_and_check_tpb_status(self, test_playbook_id, work_plan_link, incident_id): status_code = SUCCESS_RETURN_CODE print_color(f'Waiting for the test playbook to finish running.. \n' f'To see the test playbook run in real-time please go to : {work_plan_link}', LOG_COLORS.GREEN) elapsed_time = 0 start_time = time.time() while elapsed_time < self.timeout: test_playbook_result = self.get_test_playbook_results_dict(incident_id) if test_playbook_result['state'] == "inprogress": time.sleep(10) elapsed_time = int(time.time() - start_time) else: # the test playbook has finished running break # Ended the loop because of timeout if elapsed_time >= self.timeout: print_color(f'The command had timed out while the playbook is in progress.\n' f'To keep tracking the test playbook please go to : {work_plan_link}', LOG_COLORS.RED) else: if test_playbook_result['state'] == "failed": self.print_tpb_error_details(test_playbook_result, test_playbook_id) print_color("The test playbook finished running with status: FAILED", LOG_COLORS.RED) status_code = ERROR_RETURN_CODE else: print_color("The test playbook has completed its run successfully", LOG_COLORS.GREEN) return status_code def create_incident_with_test_playbook(self, incident_name, test_playbook_id): # type: (str, str) -> int """Create an incident in your xsoar instance with the given incident_name and the given test_playbook_id Args: incident_name (str): The name of the incident test_playbook_id (str): The id of the playbook Raises: ApiException: if the client has failed to create an incident Returns: int. The new incident's ID. """ create_incident_request = demisto_client.demisto_api.CreateIncidentRequest() create_incident_request.create_investigation = True create_incident_request.playbook_id = test_playbook_id create_incident_request.name = incident_name try: response = self.demisto_client.create_incident(create_incident_request=create_incident_request) except ApiException as e: print_color(f'Failed to create incident with playbook id : "{test_playbook_id}", ' 'possible reasons are:\n' '1. This playbook name does not exist \n' '2. Schema problems in the playbook \n' '3. Unauthorized api key', LOG_COLORS.RED) raise e print_color(f'The test playbook: {self.test_playbook_path} was triggered successfully.', LOG_COLORS.GREEN) return response.id def get_test_playbook_results_dict(self, inc_id): test_playbook_results = self.demisto_client.generic_request(method='GET', path=f'/inv-playbook/{inc_id}') return eval(test_playbook_results[0]) def print_tpb_error_details(self, tpb_res, tpb_id): entries = tpb_res.get('entries') if entries: print_color(f'Test Playbook {tpb_id} has failed:', LOG_COLORS.RED) for entry in entries: if entry['type'] == ENTRY_TYPE_ERROR and entry['parentContent']: print_color(f'- Task ID: {entry["taskId"]}', LOG_COLORS.RED) # Checks for passwords and replaces them with "******" parent_content = re.sub(r' (P|p)assword="[^";]*"', ' password=******', entry['parentContent']) print_color(f' Command: {parent_content}', LOG_COLORS.RED) print_color(f' Body:\n{entry["contents"]}', LOG_COLORS.RED) def get_base_link_to_workplan(self): """Create a base link to the workplan in the specified xsoar instance Returns: str: The link to the workplan """ base_url = os.environ.get('DEMISTO_BASE_URL') return f'{base_url}/#/WorkPlan/' def upload_tpb(self, tpb_file): uploader = Uploader(input=tpb_file, insecure=self.verify) # type: ignore uploader.upload()
41.348936
115
0.653185
9,395
0.966862
0
0
0
0
0
0
3,367
0.346506
19646232e69c582660ce7e5151741a5f639b0987
871
py
Python
procurement_portal/records/migrations/0017_auto_20201024_1438.py
rikusv/procurement-portal-backend
a00eb1d9d9da7737a84d9c495db0f59b26839157
[ "MIT" ]
null
null
null
procurement_portal/records/migrations/0017_auto_20201024_1438.py
rikusv/procurement-portal-backend
a00eb1d9d9da7737a84d9c495db0f59b26839157
[ "MIT" ]
19
2020-09-18T17:10:55.000Z
2020-10-18T09:54:16.000Z
procurement_portal/records/migrations/0017_auto_20201024_1438.py
rikusv/procurement-portal-backend
a00eb1d9d9da7737a84d9c495db0f59b26839157
[ "MIT" ]
2
2020-10-21T17:58:44.000Z
2022-02-13T17:21:22.000Z
# Generated by Django 3.1.1 on 2020-10-24 14:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('records', '0016_auto_20201012_0943'), ] operations = [ migrations.AddField( model_name='purchaserecord', name='implementation_status', field=models.CharField(blank=True, db_index=True, default='', max_length=500), ), migrations.AddField( model_name='purchaserecord', name='reporting_period', field=models.CharField(blank=True, db_index=True, default='', max_length=500), ), migrations.AddField( model_name='purchaserecord', name='supplier_numbers_other', field=models.CharField(blank=True, db_index=True, default='', max_length=500), ), ]
30.034483
90
0.61194
778
0.893226
0
0
0
0
0
0
200
0.229621
19646d9adaadbd2e2fc9af7b3104bea3fb1c2bae
1,030
py
Python
docs/examples/template_query.py
Fourcast/flycs_sdk
4bf206c26f59726d0ce0caa51bd3a893a34fed2a
[ "MIT" ]
7
2020-12-15T13:25:43.000Z
2021-08-31T14:35:06.000Z
docs/examples/template_query.py
Fourcast/flycs_sdk
4bf206c26f59726d0ce0caa51bd3a893a34fed2a
[ "MIT" ]
2
2020-11-12T12:46:28.000Z
2021-12-21T07:26:28.000Z
docs/examples/template_query.py
Fourcast/flycs_sdk
4bf206c26f59726d0ce0caa51bd3a893a34fed2a
[ "MIT" ]
null
null
null
from datetime import datetime, timezone from flycs_sdk.entities import Entity from flycs_sdk.pipelines import Pipeline, PipelineKind from flycs_sdk.transformations import Transformation # Define your transformation SQL query using jinja template for the table name and define the list of table on which this transformation should be applied query = Transformation( name="my_query", query="SELECT * FROM {table_name}", version="1.0.0", tables=["tables1", "tables2"], ) # Then define your entity and pipeline as usual stage_config = { "raw": {"my_query": "1.0.0"}, "staging": {"my_query": "1.0.0"}, } entity1 = Entity("entity1", "1.0.0", stage_config) entity1.transformations = { "raw": {"my_query": query}, "staging": {"my_query": query}, } p1 = Pipeline( name="my_pipeline", version="1.0.0", schedule="* 12 * * *", entities=[entity1], kind=PipelineKind.VANILLA, start_time=datetime.now(tz=timezone.utc), ) # expose the pipeline to the module as usual pipelines = [p1]
27.105263
154
0.694175
0
0
0
0
0
0
0
0
438
0.425243
1965469fd09240b19440049eb433930a5143a25d
13,252
py
Python
try/run_eval.py
CleverShovel/AIJ2020-digital-peter
baf07200e607cd39398fc0db1ba699c7af5cea77
[ "MIT" ]
null
null
null
try/run_eval.py
CleverShovel/AIJ2020-digital-peter
baf07200e607cd39398fc0db1ba699c7af5cea77
[ "MIT" ]
null
null
null
try/run_eval.py
CleverShovel/AIJ2020-digital-peter
baf07200e607cd39398fc0db1ba699c7af5cea77
[ "MIT" ]
null
null
null
import torch.nn.functional as F import torch.nn as nn import torch import torchvision.transforms.functional as VF from PIL import Image import numpy as np import os from os.path import join from collections import Counter # device = torch.device("cuda" if torch.cuda.is_available() else "cpu") import math from ctcdecode import CTCBeamDecoder import multiprocessing n_cpus = multiprocessing.cpu_count() # letters = [' ', ')', '+', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '[', ']', 'i', 'k', 'l', '|', '×', 'ǂ', # 'а', 'б', 'в', 'г', 'д', 'е', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', # 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я', 'і', 'ѣ', '–', '…', '⊕', '⊗'] letters = list(' ()+/0123456789[]abdefghiklmnoprstu|×ǂабвгдежзийклмнопрстуфхцчшщъыьэюяѣ–⊕⊗') std, mean = (0.3847, 0.3815, 0.3763), (0.6519, 0.6352, 0.5940) def process_image(img): img = VF.resize(img, 128) img = VF.pad(img, (0, 0, max(1024 - img.size[0], 0), max(128 - img.size[1], 0))) img = VF.resize(img, (128, 1024)) img = VF.to_tensor(img) img = VF.normalize(img, mean, std) return img # CNN-BLSTM class CNNBLSTM(nn.Module): def __init__(self, conv_drop=0.2, lstm_drop=0.5): super().__init__() self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1) self.norm1 = nn.BatchNorm2d(16) self.lelu1 = nn.LeakyReLU() self.pool1 = nn.MaxPool2d(2) self.conv2 = nn.Conv2d(16, 32, kernel_size=3, padding=1) self.norm2 = nn.BatchNorm2d(32) self.lelu2 = nn.LeakyReLU() self.pool2 = nn.MaxPool2d(2) self.dropout3 = nn.Dropout2d(conv_drop) self.conv3 = nn.Conv2d(32, 48, kernel_size=3, padding=1) self.norm3 = nn.BatchNorm2d(48) self.lelu3 = nn.LeakyReLU() self.pool3 = nn.MaxPool2d(2) self.dropout4 = nn.Dropout2d(conv_drop) self.conv4 = nn.Conv2d(48, 64, kernel_size=3, padding=1) self.norm4 = nn.BatchNorm2d(64) self.lelu4 = nn.LeakyReLU() self.dropout5 = nn.Dropout2d(conv_drop) self.conv5 = nn.Conv2d(64, 80, kernel_size=3, padding=1) self.norm5 = nn.BatchNorm2d(80) self.lelu5 = nn.LeakyReLU() self.flatten1 = nn.Flatten(1, 2) self.dropout6 = nn.Dropout(lstm_drop) self.lstm6 = nn.LSTM(80*16, hidden_size=256, num_layers=3, dropout=lstm_drop, bidirectional=True, batch_first=True) self.dropout7 = nn.Dropout(lstm_drop) self.linear = nn.Linear(2*256, len(letters) + 1) def forward(self, x): x = self.pool1(self.lelu1(self.norm1(self.conv1(x)))) x = self.pool2(self.lelu2(self.norm2(self.conv2(x)))) x = self.pool3(self.lelu3(self.norm3(self.conv3(self.dropout3(x))))) x = self.lelu4(self.norm4(self.conv4(self.dropout4(x)))) x = self.lelu5(self.norm5(self.conv5(self.dropout5(x)))) x = self.flatten1(x) x = x.transpose(1, 2) x, _ = self.lstm6(x) x = self.dropout7(x) x = self.linear(x) return x def init_weights(m): if type(m) == nn.Conv2d or type(m) == FullGatedConv2d: nn.init.kaiming_uniform_(m.weight) # # https://github.com/mf1024/Batch-Renormalization-PyTorch/blob/master/batch_renormalization.py # # Batch Renormalization for convolutional neural nets (2D) implementation based # # on https://arxiv.org/abs/1702.03275 # class BatchNormalization2D(nn.Module): # def __init__(self, num_features, eps=1e-05, momentum = 0.1): # super().__init__() # self.eps = eps # self.momentum = torch.tensor( (momentum), requires_grad = False) # self.gamma = nn.Parameter(torch.ones((1, num_features, 1, 1), requires_grad=True)) # self.beta = nn.Parameter(torch.zeros((1, num_features, 1, 1), requires_grad=True)) # self.running_avg_mean = torch.ones((1, num_features, 1, 1), requires_grad=False) # self.running_avg_std = torch.zeros((1, num_features, 1, 1), requires_grad=False) # def forward(self, x): # device = self.gamma.device # batch_ch_mean = torch.mean(x, dim=(0,2,3), keepdim=True).to(device) # batch_ch_std = torch.clamp(torch.std(x, dim=(0,2,3), keepdim=True), self.eps, 1e10).to(device) # self.running_avg_std = self.running_avg_std.to(device) # self.running_avg_mean = self.running_avg_mean.to(device) # self.momentum = self.momentum.to(device) # if self.training: # x = (x - batch_ch_mean) / batch_ch_std # x = x * self.gamma + self.beta # else: # x = (x - self.running_avg_mean) / self.running_avg_std # x = self.gamma * x + self.beta # self.running_avg_mean = self.running_avg_mean + self.momentum * (batch_ch_mean.data.to(device) - self.running_avg_mean) # self.running_avg_std = self.running_avg_std + self.momentum * (batch_ch_std.data.to(device) - self.running_avg_std) # return x # class BatchRenormalization2D(nn.Module): # def __init__(self, num_features, eps=1e-05, momentum=0.01, r_d_max_inc_step = 0.0001): # super().__init__() # self.eps = eps # self.momentum = torch.tensor( (momentum), requires_grad = False) # self.gamma = nn.Parameter(torch.ones((1, num_features, 1, 1)), requires_grad=True) # self.beta = nn.Parameter(torch.zeros((1, num_features, 1, 1)), requires_grad=True) # self.running_avg_mean = torch.ones((1, num_features, 1, 1), requires_grad=False) # self.running_avg_std = torch.zeros((1, num_features, 1, 1), requires_grad=False) # self.max_r_max = 3.0 # self.max_d_max = 5.0 # self.r_max_inc_step = r_d_max_inc_step # self.d_max_inc_step = r_d_max_inc_step # self.r_max = torch.tensor( (1.0), requires_grad = False) # self.d_max = torch.tensor( (0.0), requires_grad = False) # def forward(self, x): # device = self.gamma.device # batch_ch_mean = torch.mean(x, dim=(0,2,3), keepdim=True).to(device) # batch_ch_std = torch.clamp(torch.std(x, dim=(0,2,3), keepdim=True), self.eps, 1e10).to(device) # self.running_avg_std = self.running_avg_std.to(device) # self.running_avg_mean = self.running_avg_mean.to(device) # self.momentum = self.momentum.to(device) # self.r_max = self.r_max.to(device) # self.d_max = self.d_max.to(device) # if self.training: # r = torch.clamp(batch_ch_std / self.running_avg_std, 1.0 / self.r_max, self.r_max).to(device).data.to(device) # d = torch.clamp((batch_ch_mean - self.running_avg_mean) / self.running_avg_std, -self.d_max, self.d_max).to(device).data.to(device) # x = ((x - batch_ch_mean) * r )/ batch_ch_std + d # x = self.gamma * x + self.beta # if self.r_max < self.max_r_max: # self.r_max += self.r_max_inc_step * x.shape[0] # if self.d_max < self.max_d_max: # self.d_max += self.d_max_inc_step * x.shape[0] # else: # x = (x - self.running_avg_mean) / self.running_avg_std # x = self.gamma * x + self.beta # self.running_avg_mean = self.running_avg_mean + self.momentum * (batch_ch_mean.data.to(device) - self.running_avg_mean) # self.running_avg_std = self.running_avg_std + self.momentum * (batch_ch_std.data.to(device) - self.running_avg_std) # return x # class FullGatedConv2d(nn.Conv2d): # def __init__(self, in_channels, **kwargs): # super().__init__(in_channels, in_channels * 2, **kwargs) # self.channels = in_channels # self.sigm = nn.Sigmoid() # def forward(self, x): # x = super().forward(x) # gated_x = self.sigm(x[:, self.channels:, :, :]) # return x[:, :self.channels, :, :] * gated_x # class HTRFlorConvBlock(nn.Module): # def __init__(self, in_channels, out_channels, kernel_size): # super().__init__() # self.conv = nn.Conv2d(in_channels, out_channels, kernel_size) # self.prelu = nn.PReLU() # self.br = nn.BatchNorm2d(out_channels) # def forward(self, x): # x = self.br(self.prelu(self.conv(x))) # return x # class HTRFlor(nn.Module): # def __init__(self, htr_dropout=0.2, gru_dropout=0.5): # super().__init__() # self.conv_block1 = HTRFlorConvBlock(3, 16, kernel_size=(3, 3)) # self.gconv1 = FullGatedConv2d(16, kernel_size=(3, 3), padding=1) # self.pool1 = nn.MaxPool2d((2, 2)) # self.conv_block2 = HTRFlorConvBlock(16, 32, kernel_size=(3, 3)) # self.gconv2 = FullGatedConv2d(32, kernel_size=(3, 3), padding=1) # self.pool2 = nn.MaxPool2d((2, 2)) # self.conv_block3 = HTRFlorConvBlock(32, 40, kernel_size=(2, 4)) # self.gconv3 = FullGatedConv2d(40, kernel_size=(3, 3), padding=1) # self.drop3 = nn.Dropout2d(htr_dropout) # self.conv_block4 = HTRFlorConvBlock(40, 48, kernel_size=(3, 3)) # self.gconv4 = FullGatedConv2d(48, kernel_size=(3, 3), padding=1) # self.drop4 = nn.Dropout2d(htr_dropout) # self.conv_block5 = HTRFlorConvBlock(48, 56, kernel_size=(2, 4)) # self.gconv5 = FullGatedConv2d(56, kernel_size=(3, 3), padding=1) # self.drop5 = nn.Dropout2d(htr_dropout) # self.conv_block6 = HTRFlorConvBlock(56, 64, kernel_size=(3, 3)) # # self.pool = nn.MaxPool2d((1, 2)) # self.flatten = nn.Flatten(1, 2) # self.drop7 = nn.Dropout(gru_dropout) # self.lstm7 = nn.LSTM(64*24, 128, num_layers=3, dropout=gru_dropout, bidirectional=True, batch_first=True) # # self.lstm7 = nn.LSTM(64*24, 128, bidirectional=True, batch_first=True) # # self.linear7 = nn.Linear(2*128, 256) # # self.drop8 = nn.Dropout(gru_dropout) # # self.lstm8 = nn.LSTM(256, 128, bidirectional=True, batch_first=True) # self.linear8 = nn.Linear(2*128, len(letters) + 1) # def forward(self, x): # x = self.conv_block1(x) # x = self.pool1(self.gconv1(x)) # x = self.conv_block2(x) # x = self.pool2(self.gconv2(x)) # x = self.conv_block3(x) # x = self.drop3(self.gconv3(x)) # x = self.conv_block4(x) # x = self.drop4(self.gconv4(x)) # x = self.conv_block5(x) # x = self.drop5(self.gconv5(x)) # x = self.flatten(self.conv_block6(x)) # x = x.transpose(1, 2) # x, _ = self.lstm7(self.drop7(x)) # # x = self.linear7(x) # # x, _ = self.lstm8(self.drop8(x)) # x = self.linear8(x) # return x # def init_weights(m): # if type(m) == nn.Conv2d or type(m) == FullGatedConv2d: # nn.init.kaiming_uniform_(m.weight) # # nn.init.kaiming_uniform_(m.weight) def create_model(): model = CNNBLSTM() # model.apply(init_weights) return model model_path = 'language_model/train.binary' decoder = CTCBeamDecoder([*letters, '~'], model_path=None, alpha=0.01, blank_id=len(letters), beam_width=100, num_processes=n_cpus) # decoder = CTCBeamDecoder([*letters, '~'], # model_path=model_path, # alpha=0.1, # blank_id=len(letters), # beam_width=100, # num_processes=n_cpus) def get_prediction(act_model, test_images): act_model.eval() with torch.no_grad(): output = F.softmax(act_model(test_images), dim=-1) beam_results, _, _, out_lens = decoder.decode(output) prediction = [] for i in range(len(beam_results)): pred = "".join(letters[n] for n in beam_results[i][0][:out_lens[i][0]]) prediction.append(pred) return prediction def write_prediction(names_test, prediction, output_dir): os.makedirs(output_dir, exist_ok=True) for _, (name, line) in enumerate(zip(names_test, prediction)): with open(os.path.join(output_dir, name.replace('.jpg', '.txt')), 'w') as file: file.write(line) def load_test_images(test_image_dir): test_images = [] names_test = [] for name in os.listdir(test_image_dir): img = Image.open(test_image_dir + '/' + name) img = process_image(img).unsqueeze(0) test_images.append(img) names_test.append(name) test_images = torch.cat(test_images, dim=0) return names_test, test_images def main(): test_image_dir = '/data' filepath = 'checkpoint/model.pth' pred_path = '/output' print('Creating model...', end=' ') act_model = create_model() print('Success') print(f'Loading weights from {filepath}...', end=' ') act_model.load_state_dict(torch.load(filepath)) print('Success') print(f'Loading test images from {test_image_dir}...', end=' ') names_test, test_images = load_test_images(test_image_dir) print('Success') print('Running inference...') prediction = get_prediction(act_model, test_images) print('Writing predictions...') write_prediction(names_test, prediction, pred_path) if __name__ == '__main__': main()
34.066838
145
0.60821
1,922
0.14411
0
0
0
0
0
0
7,972
0.597736
1966ed8573024a45a35bef1db87d4c67dcc7b5bc
496
py
Python
phr/ciudadano/migrations/0002_ciudadano_fecha_nacimiento.py
richardqa/django-ex
e5b8585f28a97477150ac5daf5e55c74b70d87da
[ "CC0-1.0" ]
null
null
null
phr/ciudadano/migrations/0002_ciudadano_fecha_nacimiento.py
richardqa/django-ex
e5b8585f28a97477150ac5daf5e55c74b70d87da
[ "CC0-1.0" ]
null
null
null
phr/ciudadano/migrations/0002_ciudadano_fecha_nacimiento.py
richardqa/django-ex
e5b8585f28a97477150ac5daf5e55c74b70d87da
[ "CC0-1.0" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2017-01-09 09:43 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ciudadano', '0001_initial'), ] operations = [ migrations.AddField( model_name='ciudadano', name='fecha_nacimiento', field=models.DateField(blank=True, null=True, verbose_name='Fecha de nacimiento'), ), ]
24.8
94
0.633065
338
0.681452
0
0
0
0
0
0
146
0.294355
1967b5cbe9cc4d8e1820eb5ee22aea8355578e45
8,306
py
Python
experiments/track_deep_trial.py
tcstewar/davis_tracking
4813eeaf66bdfad7b90f17831f6b0946daa8cbdf
[ "MIT" ]
5
2019-06-13T02:38:51.000Z
2021-07-29T03:32:41.000Z
experiments/track_deep_trial.py
tcstewar/davis_tracking
4813eeaf66bdfad7b90f17831f6b0946daa8cbdf
[ "MIT" ]
1
2019-08-05T17:30:31.000Z
2019-08-05T17:30:31.000Z
experiments/track_deep_trial.py
tcstewar/davis_tracking
4813eeaf66bdfad7b90f17831f6b0946daa8cbdf
[ "MIT" ]
3
2019-06-05T18:42:14.000Z
2019-06-19T19:36:02.000Z
import pytry import os import random import nengo import nengo_extras import numpy as np import nengo_dl import tensorflow as tf import davis_tracking class TrackingTrial(pytry.PlotTrial): def params(self): self.param('number of data sets to use', n_data=-1) self.param('data directory', dataset_dir=r'../dataset') self.param('dt', dt=0.1) self.param('dt_test', dt_test=0.001) self.param('decay time (input synapse)', decay_time=0.01) self.param('test set (odd|one)', test_set='one') self.param('augment training set with flips', augment=False) self.param('miniback size', minibatch_size=200) self.param('learning rate', learning_rate=1e-3) self.param('number of epochs', n_epochs=5) self.param('saturation', saturation=5) self.param('separate positive and negative channels', separate_channels=True) self.param('number of features in layer 1', n_features_1=28) self.param('number of features in layer 2', n_features_2=64) self.param('kernel size layer 1', kernel_size_1=5) self.param('stride layer 1', stride_1=3) self.param('kernel size layer 2', kernel_size_2=3) self.param('stride layer 2', stride_2=1) self.param('split spatial configuration', split_spatial=True) self.param('spatial stride', spatial_stride=10) self.param('spatial kernel size', spatial_size=20) self.param('number of parallel ensembles', n_parallel=2) self.param('merge pixels (to make a smaller image)', merge=3) self.param('normalize inputs', normalize=False) def evaluate(self, p, plt): files = [] sets = [] for f in os.listdir(p.dataset_dir): if f.endswith('events'): files.append(os.path.join(p.dataset_dir, f)) if p.test_set == 'one': test_file = random.sample(files, 1)[0] files.remove(test_file) if p.n_data != -1: files = random.sample(files, p.n_data) inputs = [] targets = [] for f in files: times, imgs, targs = davis_tracking.load_data(f, dt=p.dt, decay_time=p.decay_time, separate_channels=p.separate_channels, saturation=p.saturation, merge=p.merge) inputs.append(imgs) targets.append(targs[:,:2]) inputs_all = np.vstack(inputs) targets_all = np.vstack(targets) if p.test_set == 'odd': inputs_train = inputs_all[::2] inputs_test = inputs_all[1::2] targets_train = targets_all[::2] targets_test = targets_all[1::2] dt_test = p.dt*2 elif p.test_set == 'one': times, imgs, targs = davis_tracking.load_data(test_file, dt=p.dt_test, decay_time=p.decay_time, separate_channels=p.separate_channels, saturation=p.saturation, merge=p.merge) inputs_test = imgs targets_test = targs[:, :2] inputs_train = inputs_all targets_train = targets_all dt_test = p.dt_test if p.augment: inputs_train, targets_train = davis_tracking.augment(inputs_train, targets_train, separate_channels=p.separate_channels) if p.separate_channels: shape = (2, 180//p.merge, 240//p.merge) else: shape = (1, 180//p.merge, 240//p.merge) dimensions = shape[0]*shape[1]*shape[2] if p.normalize: magnitude = np.linalg.norm(inputs_train.reshape(-1, dimensions), axis=1) inputs_train = inputs_train*(1.0/magnitude[:,None,None]) magnitude = np.linalg.norm(inputs_test.reshape(-1, dimensions), axis=1) inputs_test = inputs_test*(1.0/magnitude[:,None,None]) max_rate = 100 amp = 1 / max_rate model = nengo.Network() with model: model.config[nengo.Ensemble].neuron_type = nengo.RectifiedLinear(amplitude=amp) model.config[nengo.Ensemble].max_rates = nengo.dists.Choice([max_rate]) model.config[nengo.Ensemble].intercepts = nengo.dists.Choice([0]) model.config[nengo.Connection].synapse = None inp = nengo.Node( nengo.processes.PresentInput(inputs_test.reshape(-1, dimensions), dt_test), size_out=dimensions, ) out = nengo.Node(None, size_in=2) if not p.split_spatial: # do a standard convnet conv1 = nengo.Convolution(p.n_features_1, shape, channels_last=False, strides=(p.stride_1,p.stride_1), kernel_size=(p.kernel_size_1, p.kernel_size_1)) layer1 = nengo.Ensemble(conv1.output_shape.size, dimensions=1) nengo.Connection(inp, layer1.neurons, transform=conv1) conv2 = nengo.Convolution(p.n_features_2, conv1.output_shape, channels_last=False, strides=(p.stride_2,p.stride_2), kernel_size=(p.kernel_size_2, p.kernel_size_2)) layer2 = nengo.Ensemble(conv2.output_shape.size, dimensions=1) nengo.Connection(layer1.neurons, layer2.neurons, transform=conv2) nengo.Connection(layer2.neurons, out, transform=nengo_dl.dists.Glorot()) else: # do the weird spatially split convnet convnet = davis_tracking.ConvNet(nengo.Network()) convnet.make_input_layer( shape, spatial_stride=(p.spatial_stride, p.spatial_stride), spatial_size=(p.spatial_size,p.spatial_size)) nengo.Connection(inp, convnet.input) convnet.make_middle_layer(n_features=p.n_features_1, n_parallel=p.n_parallel, n_local=1, kernel_stride=(p.stride_1,p.stride_1), kernel_size=(p.kernel_size_1,p.kernel_size_1)) convnet.make_middle_layer(n_features=p.n_features_2, n_parallel=p.n_parallel, n_local=1, kernel_stride=(p.stride_2,p.stride_2), kernel_size=(p.kernel_size_2,p.kernel_size_2)) convnet.make_output_layer(2) nengo.Connection(convnet.output, out) p_out = nengo.Probe(out) N = len(inputs_train) n_steps = int(np.ceil(N/p.minibatch_size)) dl_train_data = {inp: np.resize(inputs_train, (p.minibatch_size, n_steps, dimensions)), p_out: np.resize(targets_train, (p.minibatch_size, n_steps, 2))} N = len(inputs_test) n_steps = int(np.ceil(N/p.minibatch_size)) dl_test_data = {inp: np.resize(inputs_test, (p.minibatch_size, n_steps, dimensions)), p_out: np.resize(targets_test, (p.minibatch_size, n_steps, 2))} with nengo_dl.Simulator(model, minibatch_size=p.minibatch_size) as sim: #loss_pre = sim.loss(dl_test_data) if p.n_epochs > 0: sim.train(dl_train_data, tf.train.RMSPropOptimizer(learning_rate=p.learning_rate), n_epochs=p.n_epochs) loss_post = sim.loss(dl_test_data) sim.run_steps(n_steps, data=dl_test_data) data = sim.data[p_out].reshape(-1,2)[:len(targets_test)] rmse_test = np.sqrt(np.mean((targets_test-data)**2, axis=0))*p.merge if plt: plt.plot(data*p.merge) plt.plot(targets_test*p.merge, ls='--') return dict( rmse_test = rmse_test, max_n_neurons = max([ens.n_neurons for ens in model.all_ensembles]), test_targets = targets_test, test_output = data, test_loss = loss_post )
44.655914
131
0.567903
8,151
0.981339
0
0
0
0
0
0
669
0.080544
196901465c6a28bf050c45315b7c684ef13a92ea
1,337
py
Python
apps/collection/tests/public/test_public_collection_list.py
magocod/django_repository
660664ba2321499e92c3c5c23719756db2569e90
[ "MIT" ]
1
2019-10-01T01:39:29.000Z
2019-10-01T01:39:29.000Z
apps/collection/tests/public/test_public_collection_list.py
magocod/django_repository
660664ba2321499e92c3c5c23719756db2569e90
[ "MIT" ]
7
2019-12-04T21:40:40.000Z
2020-06-26T21:49:51.000Z
apps/collection/tests/public/test_public_collection_list.py
magocod/django_repository
660664ba2321499e92c3c5c23719756db2569e90
[ "MIT" ]
1
2020-04-08T02:46:31.000Z
2020-04-08T02:46:31.000Z
""" ... """ # Django from django.conf import settings # local Django from apps.collection.models import Collection from apps.collection.serializers import CollectionSlugSerializer from apps.tests.fixtures import RepositoryTestCase PAGE_SIZE = settings.REST_FRAMEWORK["PAGE_SIZE"] class CollectionPublicListTest(RepositoryTestCase): """ ... """ serializer = CollectionSlugSerializer def test_request_all_collections_without_parameters_in_the_route(self): """ ... """ response = self.public_client.get("/api/collections/slug_articles/") serializer = self.serializer(Collection.objects.all()[:PAGE_SIZE], many=True,) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.data["results"]), PAGE_SIZE) self.assertEqual(serializer.data, response.data["results"]) def test_request_all_collections_with_parameters_in_the_route(self): """ ... """ response = self.public_client.get("/api/collections/slug_articles/?page=1") serializer = self.serializer(Collection.objects.all()[:PAGE_SIZE], many=True,) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.data["results"]), PAGE_SIZE) self.assertEqual(serializer.data, response.data["results"])
31.093023
86
0.703067
1,050
0.78534
0
0
0
0
0
0
226
0.169035
196a103d422e501e45fed5d95aa6423587fcbc43
2,033
py
Python
main.py
uditarora/fashion-product-classification
686f8a6c34c54f2a09baa7fba89fe446582e8408
[ "MIT" ]
9
2020-04-28T17:26:42.000Z
2021-07-13T14:47:42.000Z
main.py
uditarora/fashion-product-classification
686f8a6c34c54f2a09baa7fba89fe446582e8408
[ "MIT" ]
2
2021-09-08T01:55:51.000Z
2022-03-12T00:25:38.000Z
main.py
uditarora/fashion-product-classification
686f8a6c34c54f2a09baa7fba89fe446582e8408
[ "MIT" ]
1
2020-08-03T15:27:05.000Z
2020-08-03T15:27:05.000Z
import argparse import logging import os from src.train import setup_top20, setup_ft, setup_bottom logging.basicConfig(level=logging.INFO) logger = logging.getLogger('fashion') def main(data_path, ckpt_path, mt, train_bottom=False): # Train on top-20 classes (train subsplit) logger.info("Training on top-20 classes") ckpt_path_top20 = os.path.join(ckpt_path, 'best_val_top20.ckpt') processor, trainer_top20, _ = setup_top20(ckpt_path=ckpt_path_top20, data_path=data_path, mt=mt) trainer_top20.train(20) acc_df = trainer_top20.get_test_accuracy() print("Test accuracy for top-20 classes:") print(acc_df) # Train on remaining classes (fine-tune subsplit) logger.info("Training on fine-tune subsplit") ckpt_path_ft = os.path.join(ckpt_path, 'best_val_ft.ckpt') processor, trainer_ft, _ = setup_ft(processor=processor, mt=mt, ckpt_path=ckpt_path_ft, model=trainer_top20.get_best_model()) trainer_ft.train(20) acc_df_ft = trainer_ft.get_test_accuracy() print("Test accuracy for fine-tune classes:") print(acc_df_ft) if train_bottom: # Train on bottom 50 classes of fine-tune subsplit # with alternate data augmentations logger.info("Training on bottom 50 classes of fine-tune subsplit") trainer_b50 = setup_bottom(processor, trainer_ft, num=50) trainer_b50.train(20) acc_df_ft2 = trainer_ft.get_test_accuracy() print("Test accuracy for fine-tune data after second round of training:") print(acc_df_ft2) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("-d", "--data", help="path to the dataset", required=True) parser.add_argument("--ckpt", help="path to checkpoint folder", default='ckpts') parser.add_argument("-m", "--multi", help="run multitask learning model", action="store_true") args = parser.parse_args() if not os.path.exists(args.ckpt): os.makedirs(args.ckpt) main(args.data, args.ckpt, args.multi)
37.648148
98
0.711264
0
0
0
0
0
0
0
0
616
0.303
196bb8f934a37aeb286c8e9a73930e525b7e413c
8,508
py
Python
src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py
BD2KGenomics/toil-scripts
f878d863defcdccaabb7fe06f991451b7a198fb7
[ "Apache-2.0" ]
33
2015-10-28T18:26:31.000Z
2021-10-10T21:19:31.000Z
src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py
BD2KGenomics/toil-scripts
f878d863defcdccaabb7fe06f991451b7a198fb7
[ "Apache-2.0" ]
464
2015-08-11T04:12:10.000Z
2018-02-21T21:29:11.000Z
src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py
BD2KGenomics/toil-scripts
f878d863defcdccaabb7fe06f991451b7a198fb7
[ "Apache-2.0" ]
21
2015-09-08T18:07:49.000Z
2020-11-24T01:02:08.000Z
#!/usr/bin/env python2.7 """ Toil script to move TCGA data into an S3 bucket. Dependencies Curl: apt-get install curl Docker: wget -qO- https://get.docker.com/ | sh Toil: pip install toil S3AM: pip install --pre s3am """ import argparse import glob import hashlib import os import shutil import subprocess import tarfile from toil.job import Job def build_parser(): parser = argparse.ArgumentParser(description=main.__doc__, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('-s', '--sra', default=None, required=True, help='Path to a file with one analysis ID per line for data hosted on CGHub.') parser.add_argument('-k', '--dbgap_key', default=None, required=True, help='Path to a CGHub key that has access to the TCGA data being requested. An exception will' 'be thrown if "-g" is set but not this argument.') parser.add_argument('--s3_dir', default=None, required=True, help='S3 Bucket. e.g. tcga-data') parser.add_argument('--ssec', default=None, required=True, help='Path to Key File for SSE-C Encryption') parser.add_argument('--single_end', default=None, action='store_true', help='Set this flag if data is single-end') parser.add_argument('--sudo', dest='sudo', default=None, action='store_true', help='Docker usually needs sudo to execute locally, but not when running Mesos or when ' 'the user is a member of a Docker group.') return parser # Convenience Functions def generate_unique_key(master_key_path, url): """ master_key_path: str Path to the BD2K Master Key (for S3 Encryption) url: str S3 URL (e.g. https://s3-us-west-2.amazonaws.com/bucket/file.txt) Returns: str 32-byte unique key generated for that URL """ with open(master_key_path, 'r') as f: master_key = f.read() assert len(master_key) == 32, 'Invalid Key! Must be 32 characters. ' \ 'Key: {}, Length: {}'.format(master_key, len(master_key)) new_key = hashlib.sha256(master_key + url).digest() assert len(new_key) == 32, 'New key is invalid and is not 32 characters: {}'.format(new_key) return new_key def docker_call(work_dir, tool_parameters, tool, java_opts=None, sudo=False, outfile=None): """ Makes subprocess call of a command to a docker container. tool_parameters: list An array of the parameters to be passed to the tool tool: str Name of the Docker image to be used (e.g. quay.io/ucsc_cgl/samtools) java_opts: str Optional commands to pass to a java jar execution. (e.g. '-Xmx15G') outfile: file Filehandle that stderr will be passed to sudo: bool If the user wants the docker command executed as sudo """ base_docker_call = 'docker run --log-driver=none --rm -v {}:/data'.format(work_dir).split() if sudo: base_docker_call = ['sudo'] + base_docker_call if java_opts: base_docker_call = base_docker_call + ['-e', 'JAVA_OPTS={}'.format(java_opts)] try: if outfile: subprocess.check_call(base_docker_call + [tool] + tool_parameters, stdout=outfile) else: subprocess.check_call(base_docker_call + [tool] + tool_parameters) except subprocess.CalledProcessError: raise RuntimeError('docker command returned a non-zero exit status: {}' ''.format(base_docker_call + [tool] + tool_parameters)) except OSError: raise RuntimeError('docker not found on system. Install on all nodes.') def parse_sra(path_to_config): """ Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ] Returns duplicate of ids to follow UUID/URL standard. """ samples = [] with open(path_to_config, 'r') as f: for line in f.readlines(): if not line.isspace(): samples.append(line.strip()) return samples def tarball_files(work_dir, tar_name, uuid=None, files=None): """ Tars a group of files together into a tarball work_dir: str Current Working Directory tar_name: str Name of tarball uuid: str UUID to stamp files with files: str(s) List of filenames to place in the tarball from working directory """ with tarfile.open(os.path.join(work_dir, tar_name), 'w:gz') as f_out: for fname in files: if uuid: f_out.add(os.path.join(work_dir, fname), arcname=uuid + '.' + fname) else: f_out.add(os.path.join(work_dir, fname), arcname=fname) # Job Functions def start_batch(job, input_args): """ This function will administer 5 jobs at a time then recursively call itself until subset is empty """ samples = parse_sra(input_args['sra']) # for analysis_id in samples: job.addChildJobFn(download_and_transfer_sample, input_args, samples, cores=1, disk='30') def download_and_transfer_sample(job, input_args, samples): """ Downloads a sample from dbGaP via SRAToolKit, then uses S3AM to transfer it to S3 input_args: dict Dictionary of input arguments analysis_id: str An analysis ID for a sample in CGHub """ if len(samples) > 1: a = samples[len(samples)/2:] b = samples[:len(samples)/2] job.addChildJobFn(download_and_transfer_sample, input_args, a, disk='30G') job.addChildJobFn(download_and_transfer_sample, input_args, b, disk='30G') else: analysis_id = samples[0] work_dir = job.fileStore.getLocalTempDir() sudo = input_args['sudo'] # Acquire dbgap_key shutil.copy(input_args['dbgap_key'], os.path.join(work_dir, 'dbgap.ngc')) # Call to fastq-dump to pull down SRA files and convert to fastq if input_args['single_end']: parameters = [analysis_id] else: parameters = ['--split-files', analysis_id] docker_call(tool='quay.io/ucsc_cgl/fastq-dump:2.5.7--4577a6c1a3c94adaa0c25dd6c03518ee610433d1', work_dir=work_dir, tool_parameters=parameters, sudo=sudo) # Collect files and encapsulate into a tarball shutil.rmtree(os.path.join(work_dir, 'sra')) sample_name = analysis_id + '.tar.gz' if input_args['single_end']: r = [os.path.basename(x) for x in glob.glob(os.path.join(work_dir, '*.f*'))] tarball_files(work_dir, tar_name=sample_name, files=r) else: r1 = [os.path.basename(x) for x in glob.glob(os.path.join(work_dir, '*_1*'))] r2 = [os.path.basename(x) for x in glob.glob(os.path.join(work_dir, '*_2*'))] tarball_files(work_dir, tar_name=sample_name, files=r1 + r2) # Parse s3_dir to get bucket and s3 path key_path = input_args['ssec'] s3_dir = input_args['s3_dir'] bucket_name = s3_dir.lstrip('/').split('/')[0] base_url = 'https://s3-us-west-2.amazonaws.com/' url = os.path.join(base_url, bucket_name, sample_name) # Generate keyfile for upload with open(os.path.join(work_dir, 'temp.key'), 'wb') as f_out: f_out.write(generate_unique_key(key_path, url)) # Upload to S3 via S3AM s3am_command = ['s3am', 'upload', '--sse-key-file', os.path.join(work_dir, 'temp.key'), 'file://{}'.format(os.path.join(work_dir, sample_name)), 's3://' + bucket_name + '/'] subprocess.check_call(s3am_command) def main(): """ Transfer gTEX data from dbGaP (NCBI) to S3 """ # Define Parser object and add to toil parser = build_parser() Job.Runner.addToilOptions(parser) args = parser.parse_args() # Store inputs from argparse inputs = {'sra': args.sra, 'dbgap_key': args.dbgap_key, 'ssec': args.ssec, 's3_dir': args.s3_dir, 'single_end': args.single_end, 'sudo': args.sudo} # Sanity checks if args.ssec: assert os.path.isfile(args.ssec) if args.sra: assert os.path.isfile(args.sra) if args.dbgap_key: assert os.path.isfile(args.dbgap_key) # Start Pipeline Job.Runner.startToil(Job.wrapJobFn(start_batch, inputs), args) if __name__ == '__main__': main()
42.328358
118
0.629525
0
0
0
0
0
0
0
0
3,442
0.40456
196bec7ed8b6cf58b1516910c7416d81061dacce
1,885
py
Python
tests/metrics/cpu_psutil_tests.py
shareablee/apm-agent-python
29f12ceb410b3c1a7f933b29dcecccf628dbbb6c
[ "BSD-3-Clause" ]
null
null
null
tests/metrics/cpu_psutil_tests.py
shareablee/apm-agent-python
29f12ceb410b3c1a7f933b29dcecccf628dbbb6c
[ "BSD-3-Clause" ]
null
null
null
tests/metrics/cpu_psutil_tests.py
shareablee/apm-agent-python
29f12ceb410b3c1a7f933b29dcecccf628dbbb6c
[ "BSD-3-Clause" ]
null
null
null
import time import pytest from elasticapm.utils import compat cpu_psutil = pytest.importorskip("elasticapm.metrics.sets.cpu_psutil") pytestmark = pytest.mark.psutil def test_cpu_mem_from_psutil(): metricset = cpu_psutil.CPUMetricSet() # do something that generates some CPU load for i in compat.irange(10 ** 6): j = i * i data = metricset.collect() # we can't really test any specific values here as it depends on the system state. # Mocking is also not really a viable choice, as we would then lose the "integration testing" # nature of this test with different versions of psutil assert 0 < data["samples"]["system.cpu.total.norm.pct"]["value"] < 1 assert 0 < data["samples"]["system.process.cpu.total.norm.pct"]["value"] < 1 assert data["samples"]["system.memory.total"]["value"] > 0 assert data["samples"]["system.memory.actual.free"]["value"] > 0 assert data["samples"]["system.process.memory.rss.bytes"]["value"] > 0 assert data["samples"]["system.process.memory.size"]["value"] > 0 cpu_linux = pytest.importorskip("elasticapm.metrics.sets.cpu_linux") def test_compare_psutil_linux_metricsets(): psutil_metricset = cpu_psutil.CPUMetricSet() linux_metricset = cpu_linux.CPUMetricSet() # do something that generates some CPU load for i in compat.irange(10 ** 6): j = i * i psutil_data = psutil_metricset.collect() linux_data = linux_metricset.collect() assert ( abs( psutil_data["samples"]["system.cpu.total.norm.pct"]["value"] - linux_data["samples"]["system.cpu.total.norm.pct"]["value"] ) < 0.02 ) assert ( abs( psutil_data["samples"]["system.process.cpu.total.norm.pct"]["value"] - linux_data["samples"]["system.process.cpu.total.norm.pct"]["value"] ) < 0.02 )
33.660714
97
0.658886
0
0
0
0
0
0
0
0
842
0.446684
196e9f2b4480f78817f1f39de8dbbca5da718152
3,785
py
Python
day11/main.py
josteinl/advent2020
f109f9c1ef4fcb14582cda6b114d7648000decc6
[ "Apache-2.0" ]
null
null
null
day11/main.py
josteinl/advent2020
f109f9c1ef4fcb14582cda6b114d7648000decc6
[ "Apache-2.0" ]
null
null
null
day11/main.py
josteinl/advent2020
f109f9c1ef4fcb14582cda6b114d7648000decc6
[ "Apache-2.0" ]
null
null
null
""" Day 11 - Seating """ from itertools import chain import collections def occupied_count(seating): return ''.join(chain.from_iterable(seating)).count('#') def adjacent_occupied(x, y, seating): occupied = 0 # Above for look_x in range(x - 1, x + 2): for look_y in range(y - 1, y + 2): if look_x == x and look_y == y: continue if seating[look_y][look_x] == '#': occupied += 1 return occupied def sit_down(seating, dim_x, dim_y): return_seating = seating.copy() for y in range(1, dim_y): for x in range(1, dim_x): occupied = adjacent_occupied(x, y, seating) if seating[y][x] == 'L' and occupied == 0: # Empty seat # and no adjacent occupied return_seating[y] = return_seating[y][:x] + '#' + return_seating[y][x + 1:] elif seating[y][x] == '#' and occupied >= 4: # Occupied and 4 or more adjecent seats, raise up return_seating[y] = return_seating[y][:x] + 'L' + return_seating[y][x + 1:] return return_seating def see_occupied_in_direction(x, y, dir_x, dir_y, seating): max_x = len(seating[0]) - 1 max_y = len(seating) - 1 cur_x = x cur_y = y cur_x += dir_x cur_y += dir_y while 0 <= cur_x <= max_x and 0 <= cur_y <= max_y: if seating[cur_y][cur_x] == '#': return 1 elif seating[cur_y][cur_x] == 'L': return 0 cur_x += dir_x cur_y += dir_y return 0 def seen_occupied(x, y, seating): occupied = 0 for look_x in range(- 1, + 2): for look_y in range(- 1, + 2): if look_x == 0 and look_y == 0: continue occupied += see_occupied_in_direction(x, y, look_x, look_y, seating) return occupied def sit_down_part_two(seating, dim_x, dim_y): return_seating = seating.copy() for y in range(0, dim_y): for x in range(0, dim_x): occupied = seen_occupied(x, y, seating) if seating[y][x] == 'L' and occupied == 0: # Empty seat # and no adjacent occupied return_seating[y] = return_seating[y][:x] + '#' + return_seating[y][x + 1:] elif seating[y][x] == '#' and occupied >= 5: # Occupied and 5 or more seen seats, raise up return_seating[y] = return_seating[y][:x] + 'L' + return_seating[y][x + 1:] return return_seating def part_two(): with open('data.txt', 'r') as f: seating = [data.strip() for data in f] dimension_x = len(seating[0]) dimension_y = len(seating) last_seating = None while collections.Counter(last_seating) != collections.Counter(seating): last_seating = seating.copy() seating = sit_down_part_two(seating, dimension_x, dimension_y) return occupied_count(last_seating) def part_one(): with open('data.txt', 'r') as f: seating = [data.strip() for data in f] dimension_x = len(seating[0]) dimension_y = len(seating) # Extend seating with empty space all around, makes it easier to count later for row_number in range(dimension_y): seating[row_number] = '.' + seating[row_number] + '.' seating = ['.' * (dimension_x + 2)] + seating + ['.' * (dimension_x + 2)] last_seating = None while collections.Counter(last_seating) != collections.Counter(seating): last_seating = seating.copy() seating = sit_down(seating, dimension_x + 1, dimension_y + 1) return occupied_count(last_seating) if __name__ == '__main__': # Part one: # result = part_one() # print(f'Result {result}') result = part_two() print(f'Result {result}')
29.115385
91
0.57675
0
0
0
0
0
0
0
0
440
0.116248
19709fd1d6df22996971f4e668193dabf3b6aadc
388
py
Python
firmware/pipelines.py
armijnhemel/FirmwareScraper
9684767bfbe076013386f6ee0b466f9282baf587
[ "MIT" ]
3
2022-02-13T09:12:57.000Z
2022-03-08T23:41:03.000Z
firmware/pipelines.py
armijnhemel/FirmwareScraper
9684767bfbe076013386f6ee0b466f9282baf587
[ "MIT" ]
4
2021-12-22T08:29:50.000Z
2022-03-02T18:48:53.000Z
firmware/pipelines.py
armijnhemel/FirmwareScraper
9684767bfbe076013386f6ee0b466f9282baf587
[ "MIT" ]
5
2019-11-19T06:26:07.000Z
2022-02-28T06:48:35.000Z
from scrapy.pipelines.files import FilesPipeline class FirmwarePipeline(FilesPipeline): def file_path(self, request, response=None, info=None): return request.url.split('/')[-1] class HpPipeline(FirmwarePipeline): pass class LinksysPipeline(FirmwarePipeline): pass class AvmPipeline(FirmwarePipeline): pass class AsusPipeline(FirmwarePipeline): pass
16.869565
59
0.747423
324
0.835052
0
0
0
0
0
0
3
0.007732
1971dea6d61ad931626506926b94703bc0412249
2,843
py
Python
research/cv/yolox/src/boxes.py
mindspore-ai/models
9127b128e2961fd698977e918861dadfad00a44c
[ "Apache-2.0" ]
77
2021-10-15T08:32:37.000Z
2022-03-30T13:09:11.000Z
research/cv/yolox/src/boxes.py
mindspore-ai/models
9127b128e2961fd698977e918861dadfad00a44c
[ "Apache-2.0" ]
3
2021-10-30T14:44:57.000Z
2022-02-14T06:57:57.000Z
research/cv/yolox/src/boxes.py
mindspore-ai/models
9127b128e2961fd698977e918861dadfad00a44c
[ "Apache-2.0" ]
24
2021-10-15T08:32:45.000Z
2022-03-24T18:45:20.000Z
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ======================================================================================= """ box iou related """ from mindspore.ops import operations as P from mindspore.ops.primitive import constexpr @constexpr def raise_bbox_error(): raise IndexError("Index error, shape of input must be 4!") def bboxes_iou(bboxes_a, bboxes_b, xyxy=True): """ calculate iou Args: bboxes_a: bboxes_b: xyxy: Returns: """ if bboxes_a.shape[1] != 4 or bboxes_b.shape[1] != 4: raise_bbox_error() if xyxy: tl = P.Maximum()(bboxes_a[:, None, :2], bboxes_b[:, :2]) br = P.Minimum()(bboxes_a[:, None, 2:], bboxes_b[:, 2:]) area_a = bboxes_a[:, 2:] - bboxes_a[:, :2] area_a = (area_a[:, 0:1] * area_a[:, 1:2]).squeeze(-1) area_b = bboxes_b[:, 2:] - bboxes_b[:, :2] area_b = (area_b[:, 0:1] * area_b[:, 1:2]).squeeze(-1) else: tl = P.Maximum()( (bboxes_a[:, None, :2] - bboxes_a[:, None, 2:] / 2), (bboxes_b[:, :2] - bboxes_b[:, 2:] / 2), ) br = P.Minimum()( (bboxes_a[:, None, :2] + bboxes_a[:, None, 2:] / 2), (bboxes_b[:, :2] + bboxes_b[:, 2:] / 2), ) area_a = (bboxes_a[:, 2:3] * bboxes_a[:, 3:4]).squeeze(-1) area_b = (bboxes_b[:, 2:3] * bboxes_b[:, 3:4]).squeeze(-1) en = (tl < br).astype(tl.dtype) en = (en[..., 0:1] * en[..., 1:2]).squeeze(-1) area_i = tl - br area_i = (area_i[:, :, 0:1] * area_i[:, :, 1:2]).squeeze(-1) * en return area_i / (area_a[:, None] + area_b - area_i) def batch_bboxes_iou(batch_bboxes_a, batch_bboxes_b, xyxy=True): """ calculate iou for one batch Args: batch_bboxes_a: batch_bboxes_b: xyxy: Returns: """ if batch_bboxes_a.shape[-1] != 4 or batch_bboxes_b.shape[-1] != 4: raise_bbox_error() ious = [] for i in range(len(batch_bboxes_a)): if xyxy: iou = bboxes_iou(batch_bboxes_a[i], batch_bboxes_b[i], True) else: iou = bboxes_iou(batch_bboxes_a[i], batch_bboxes_b[i], False) iou = P.ExpandDims()(iou, 0) ious.append(iou) ious = P.Concat(axis=0)(ious) return ious
30.569892
89
0.562082
0
0
0
0
97
0.034119
0
0
965
0.33943
19720b08a53678ae7b601ebc496e7b65a4ff6078
3,343
py
Python
main/control/welcome.py
lipis/crypto-pocket
ec40e9f49e521d7b095c9065f89b8888a871313a
[ "MIT" ]
4
2018-01-17T12:41:18.000Z
2018-01-26T18:59:57.000Z
main/control/welcome.py
lipis/crypto-pocket
ec40e9f49e521d7b095c9065f89b8888a871313a
[ "MIT" ]
43
2018-01-29T06:15:52.000Z
2018-09-19T02:14:40.000Z
main/control/welcome.py
lipis/crypto-pocket
ec40e9f49e521d7b095c9065f89b8888a871313a
[ "MIT" ]
null
null
null
# coding: utf-8 import flask from google.appengine.ext import ndb import auth import config import model from main import app ############################################################################### # Welcome ############################################################################### @app.route('/') def welcome(): if auth.is_logged_in(): currency_dbs, currency_cursor = model.Currency.get_dbs(limit=-1, order='is_crypto,name') transaction_dbs, transaction_cursor = model.Transaction.get_dbs(user_key=auth.current_user_key(), order='-date', limit=-1) total_profit = 0 total_net_worth = 0 currency_codes = [] for transaction_db in transaction_dbs: total_profit += transaction_db.profit_amount_user total_net_worth += transaction_db.net_worth_user currency_codes.append(transaction_db.acquired_currency_code) currency_codes = list(set(currency_codes)) price_dbs = [] user_currency_code = auth.current_user_db().currency_key.get().code if auth.current_user_db().currency_key else 'USD' for currency_code in currency_codes: if currency_code != user_currency_code: price_db = model.Price.get_by('code_unique', ':'.join(tuple(sorted([currency_code, user_currency_code])))) if price_db: price_dbs.append(price_db) return flask.render_template( 'welcome.html', html_class='welcome', transaction_dbs=transaction_dbs, total_profit=total_profit, total_net_worth=total_net_worth, currency_dbs=currency_dbs, price_dbs=price_dbs, user_currency_code=user_currency_code, api_url=flask.url_for('api.transaction.list'), ) return flask.render_template( 'welcome.html', html_class='welcome', ) @app.route('/prices/<code>/') @app.route('/prices/') def prices(code=None): price_qry = None code = code.upper() if code else code if code: code = code.upper() price_qry = model.Price.query(ndb.OR(model.Price.currency_from_code == code, model.Price.currency_to_code == code)) price_dbs, price_cursor = model.Price.get_dbs(query=price_qry, limit=-1) currency_dbs, currency_cursor = model.Currency.get_dbs(limit=-1, order='is_crypto,name') return flask.render_template( 'prices.html', html_class='prices', title='Current prices %s' % (' (%s)' % (code) if code else ''), price_dbs=price_dbs, currency_dbs=currency_dbs, code=code, canonical_url=flask.url_for('prices', code=code if code else None), open_graph_image='%s%s' % (flask.request.url_root[:-1], config.OG_PRICES), api_url=flask.url_for('api.price.list'), ) ############################################################################### # Sitemap stuff ############################################################################### @app.route('/sitemap.xml') def sitemap(): response = flask.make_response(flask.render_template( 'sitemap.xml', lastmod=config.CURRENT_VERSION_DATE.strftime('%Y-%m-%d'), )) response.headers['Content-Type'] = 'application/xml' return response ############################################################################### # Warmup request ############################################################################### @app.route('/_ah/warmup') def warmup(): # TODO: put your warmup code here return 'success'
33.43
126
0.608436
0
0
0
0
2,679
0.801376
0
0
889
0.265929
1973e78021509b21a44ae56187ef66052677e85e
2,029
py
Python
qa_multi_span/model.py
chunchiehy/musst
1525f917d8802d18c302720125ef9720b9c743fd
[ "MIT" ]
14
2021-02-26T15:19:21.000Z
2022-03-31T18:49:12.000Z
qa_multi_span/model.py
chunchiehy/musst
1525f917d8802d18c302720125ef9720b9c743fd
[ "MIT" ]
null
null
null
qa_multi_span/model.py
chunchiehy/musst
1525f917d8802d18c302720125ef9720b9c743fd
[ "MIT" ]
1
2021-11-16T07:20:32.000Z
2021-11-16T07:20:32.000Z
from transformers import AlbertModel from transformers import AlbertPreTrainedModel import torch.nn as nn import torch import torch.nn.functional as F class MUSTTransformerModel(AlbertPreTrainedModel): def __init__(self, config, max_num_spans, max_seq_len): super(MUSTTransformerModel, self).__init__(config) self.max_num_spans = max_num_spans self.max_seq_len = max_seq_len self.albert = AlbertModel(config) self.dropout = nn.Dropout(config.classifier_dropout_prob) self.span_outputs = nn.ModuleList( [nn.Linear(config.hidden_size, 2) for _ in range(max_num_spans)]) self.relu = nn.ReLU() self.init_weights() def forward(self, input_ids=None, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None, inputs_embeds=None): outputs = self.albert(input_ids=input_ids, attention_mask=attention_mask, token_type_ids=token_type_ids, position_ids=position_ids, head_mask=head_mask, inputs_embeds=inputs_embeds) # (batch_size, seq_len, hidden_size) transformer_output = outputs[0] transformer_output = self.dropout(transformer_output) span_start_logits = [] span_end_logits = [] for span_output_layer in self.span_outputs: # (batch_size, seq_len) logits = span_output_layer(transformer_output) # (batch_size, seq_len) start_logits, end_logits = torch.split(logits, 1, dim=-1) start_logits = start_logits.squeeze(-1) end_logits = end_logits.squeeze(-1) span_start_logits.append(start_logits) span_end_logits.append(end_logits) # (batch_size, max_num_spans, seq_len) span_start_logits = torch.stack(span_start_logits, dim=1) span_end_logits = torch.stack(span_end_logits, dim=1) return ( span_start_logits, span_end_logits, ) + outputs[2:]
33.816667
73
0.667817
1,874
0.923608
0
0
0
0
0
0
120
0.059142
19753cc35369937ec7625ed05051badbaa38c37c
1,160
py
Python
class_one/02_strings.py
nclairesays/intro-python-hackforla
65ab8584ab9d5082aaa405b40c47cbeacfff610c
[ "MIT" ]
null
null
null
class_one/02_strings.py
nclairesays/intro-python-hackforla
65ab8584ab9d5082aaa405b40c47cbeacfff610c
[ "MIT" ]
null
null
null
class_one/02_strings.py
nclairesays/intro-python-hackforla
65ab8584ab9d5082aaa405b40c47cbeacfff610c
[ "MIT" ]
null
null
null
# STRINGS # https://docs.python.org/3/tutorial/introduction.html#strings s = str(42) s # convert another data type into a string (casting) s = 'I like you' # examine a string s[0] # returns 'I' len(s) # returns 10 # string slicing like lists s[0:7] # returns 'I like ' s[6:] # returns 'you' s[-1] # returns 'u' # EXERCISE: Book Titles (Part 1) # 1) Extract the book title from the string # 2) Save each book title to a variable (ie book1_title) # 3) How many characters/elements are in each title? # Hint: {bookTitle} by {author}, {years} book1 = "Beyond the Door by Dick, Philip K., 1928-1982" book2 = "The Variable Man by Dick, Philip K., 1928-1982" book3 = "The Skull by Dick, Philip K., 1928-1982" # STRINGS - Part II # concatenate strings s3 = 'The meaning of life is' s4 = '42' s3 + ' ' + s4 # returns 'The meaning of life is 42' s3 + ' ' + str(42) # same thing # split a string into a list of substrings separated by a delimiter s = 'I like you' s.split(' ') # returns ['I','like','you'] s.split() # same thing ## Learn more with Automate the Boring Stuff: ## https://automatetheboringstuff.com/chapter1/
22.745098
67
0.655172
0
0
0
0
0
0
0
0
947
0.816379
1975eb951bcdc39a34c55d4b1e7b13067352c07a
11,809
py
Python
amqpy/transport.py
veegee/amqpy
c5346b1f6910b8553ca96769d2c88a7807f83417
[ "MIT" ]
32
2015-02-04T03:57:28.000Z
2021-01-17T13:19:02.000Z
amqpy/transport.py
veegee/amqpy
c5346b1f6910b8553ca96769d2c88a7807f83417
[ "MIT" ]
33
2015-01-12T21:17:16.000Z
2018-03-14T22:54:13.000Z
amqpy/transport.py
veegee/amqpy
c5346b1f6910b8553ca96769d2c88a7807f83417
[ "MIT" ]
9
2015-02-17T04:44:31.000Z
2021-12-09T20:36:29.000Z
from __future__ import absolute_import, division, print_function __metaclass__ = type import errno import six import socket import ssl from abc import ABCMeta, abstractmethod import logging from threading import RLock from ssl import SSLError import datetime import time from . import compat from .proto import Frame from .concurrency import synchronized from .exceptions import UnexpectedFrame from .utils import get_errno from .spec import FrameType log = logging.getLogger('amqpy') compat.patch() _UNAVAIL = {errno.EAGAIN, errno.EINTR, errno.ENOENT} AMQP_PROTOCOL_HEADER = b'AMQP\x00\x00\x09\x01' # bytes([65, 77, 81, 80, 0, 0, 9, 1]) class Transport: __metaclass__ = ABCMeta """Common superclass for TCP and SSL transports""" connected = False def __init__(self, host, port, connect_timeout, buf_size): """ :param host: hostname or IP address :param port: port :param connect_timeout: connect timeout :type host: str :type port: int :type connect_timeout: float or None """ self._rbuf = bytearray(buf_size) #: :type: datetime.datetime self.last_heartbeat_sent = None #: :type: datetime.datetime self.last_heartbeat_received = None self.last_heartbeat_sent_monotonic = 0.0 # the purpose of the frame lock is to allow no more than one thread to read/write a frame # to the connection at any time self._frame_write_lock = RLock() self._frame_read_lock = RLock() self.sock = None # try to connect last_err = None for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM, socket.IPPROTO_TCP): af, socktype, proto, canonname, sa = res try: self.sock = socket.socket(af, socktype, proto) self.sock.settimeout(connect_timeout) self.sock.connect(sa) break except socket.error as exc: self.sock.close() self.sock = None last_err = exc if not self.sock: # didn't connect, return the most recent error message raise socket.error(last_err) try: assert isinstance(self.sock, socket.socket) self.sock.settimeout(None) self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) self._setup_transport() self.write(AMQP_PROTOCOL_HEADER) except (OSError, IOError, socket.error) as exc: if get_errno(exc) not in _UNAVAIL: self.connected = False raise self.connected = True def __del__(self): try: # socket module may have been collected by gc if this is called by a thread at shutdown if socket is not None: # noinspection PyBroadException try: self.close() except: pass finally: self.sock = None def _read(self, n, initial, _errnos): """Read from socket This is the default implementation. Subclasses may implement `read()` to simply call this method, or provide their own `read()` implementation. Note: According to SSL_read(3), it can at most return 16kB of data. Thus, we use an internal read buffer like to get the exact number of bytes wanted. Note: ssl.sock.read may cause ENOENT if the operation couldn't be performed (?). :param int n: exact number of bytes to read :return: data read :rtype: memoryview """ mview = memoryview(self._rbuf) to_read = n while to_read: try: bytes_read = self.sock.recv_into(mview, to_read) mview = mview[bytes_read:] to_read -= bytes_read except socket.error as exc: if not initial and exc.errno in _errnos: continue raise if not bytes_read: raise IOError('socket closed') return memoryview(self._rbuf)[:n] @abstractmethod def read(self, n, initial=False): """Read exactly `n` bytes from the peer :param n: number of bytes to read :type n: int :return: data read :rtype: bytes """ pass @abstractmethod def write(self, s): """Completely write a string to the peer """ def _setup_transport(self): """Do any additional initialization of the class (used by the subclasses) """ pass def close(self): if self.sock is not None: # call shutdown first to make sure that pending messages reach the AMQP broker if the # program exits after calling this method self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() self.sock = None self.connected = False @synchronized('_frame_read_lock') def read_frame(self): """Read frame from connection Note that the frame may be destined for any channel. It is permitted to interleave frames from different channels. :return: frame :rtype: amqpy.proto.Frame """ frame = Frame() try: # read frame header: 7 bytes frame_header = self.read(7, True) frame.data.extend(frame_header) # read frame payload payload = self.read(frame.payload_size) frame.data.extend(payload) # read frame terminator byte frame_terminator = self.read(1) frame.data.extend(frame_terminator) if six.PY2: #: :type: int i_last_byte = six.byte2int(frame_terminator) else: # this fixes the change in memoryview in Python 3.3 (accessing an element returns the # correct type) #: :type: int i_last_byte = six.byte2int(bytes(frame_terminator)) except (OSError, IOError, socket.error) as exc: # don't disconnect for ssl read time outs (Python 3.2): # http://bugs.python.org/issue10272 if isinstance(exc, SSLError) and 'timed out' in str(exc): raise socket.timeout() if get_errno(exc) not in _UNAVAIL and not isinstance(exc, socket.timeout): self.connected = False raise if i_last_byte == FrameType.END: if frame.frame_type == FrameType.HEARTBEAT: self.last_heartbeat_received = datetime.datetime.now() return frame else: raise UnexpectedFrame('Received {} while expecting 0xce (FrameType.END)'.format(hex(i_last_byte))) @synchronized('_frame_write_lock') def write_frame(self, frame): """Write frame to connection Note that the frame may be destined for any channel. It is permitted to interleave frames from different channels. :param frame: frame :type frame: amqpy.proto.Frame """ try: self.write(frame.data) except socket.timeout: raise except (OSError, IOError, socket.error) as exc: if get_errno(exc) not in _UNAVAIL: self.connected = False raise def send_heartbeat(self): """Send a heartbeat to the server """ self.last_heartbeat_sent = datetime.datetime.now() self.last_heartbeat_sent_monotonic = time.monotonic() self.write_frame(Frame(FrameType.HEARTBEAT)) def is_alive(self): """Check if connection is alive This method is the primary way to check if the connection is alive. Side effects: This method may send a heartbeat as a last resort to check if the connection is alive. :return: True if connection is alive, else False :rtype: bool """ if not self.sock: # we don't have a valid socket, this connection is definitely not alive return False if not self.connected: # the `transport` is not connected return False # recv with MSG_PEEK to check if the connection is alive # note: if there is data still in the buffer, this will not tell us anything # if hasattr(socket, 'MSG_PEEK') and not isinstance(self.sock, ssl.SSLSocket): # prev = self.sock.gettimeout() # self.sock.settimeout(0.0001) # try: # self.sock.recv(1, socket.MSG_PEEK) # except socket.timeout: # pass # except socket.error: # # the exception is usually (always?) a ConnectionResetError in Python 3.3+ # log.debug('socket.error, connection is closed') # return False # finally: # self.sock.settimeout(prev) # send a heartbeat to check if the connection is alive try: self.send_heartbeat() except socket.error: return False return True class SSLTransport(Transport): """Transport that works over SSL """ def __init__(self, host, port, connect_timeout, frame_max, ssl_opts): self.ssl_opts = ssl_opts super(SSLTransport, self).__init__(host, port, connect_timeout, frame_max) def _setup_transport(self): """Wrap the socket in an SSL object """ self.sock = ssl.wrap_socket(self.sock, **self.ssl_opts) def read(self, n, initial=False): """Read from socket According to SSL_read(3), it can at most return 16kb of data. Thus, we use an internal read buffer like `TCPTransport.read()` to get the exact number of bytes wanted. :param int n: exact number of bytes to read :return: data read :rtype: bytes """ return self._read(n, initial, _errnos=(errno.ENOENT, errno.EAGAIN, errno.EINTR)) def write(self, s): """Write a string out to the SSL socket fully """ try: write = self.sock.write except AttributeError: # works around a bug in python socket library raise IOError('Socket closed') else: while s: n = write(s) if not n: raise IOError('Socket closed') s = s[n:] class TCPTransport(Transport): """Transport that deals directly with TCP socket """ def read(self, n, initial=False): """Read exactly n bytes from the socket :param int n: exact number of bytes to read :return: data read :rtype: bytes """ return self._read(n, initial, _errnos=(errno.EAGAIN, errno.EINTR)) def write(self, s): self.sock.sendall(s) def create_transport(host, port, connect_timeout, frame_max, ssl_opts=None): """Given a few parameters from the Connection constructor, select and create a subclass of Transport If `ssl_opts` is a dict, SSL will be used and `ssl_opts` will be passed to :func:`ssl.wrap_socket()`. In all other cases, SSL will not be used. :param host: host :param connect_timeout: connect timeout :param ssl_opts: ssl options passed to :func:`ssl.wrap_socket()` :type host: str :type connect_timeout: float or None :type ssl_opts: dict or None """ if isinstance(ssl_opts, dict): return SSLTransport(host, port, connect_timeout, frame_max, ssl_opts) else: return TCPTransport(host, port, connect_timeout, frame_max)
32.53168
110
0.597172
10,386
0.879499
0
0
2,750
0.232873
0
0
4,941
0.41841
197751283e20cfc29bc1ae41f28e04248f1f81be
2,795
py
Python
code/aditya.py
nyamako/hacktoberfest-2018
bf7939d4b0cfb57a854a1644dbbae7ddf8af3c4f
[ "MIT" ]
67
2018-09-25T21:37:23.000Z
2020-11-03T02:03:22.000Z
code/aditya.py
nyamako/hacktoberfest-2018
bf7939d4b0cfb57a854a1644dbbae7ddf8af3c4f
[ "MIT" ]
245
2018-09-18T10:07:28.000Z
2020-09-30T19:00:11.000Z
code/aditya.py
nyamako/hacktoberfest-2018
bf7939d4b0cfb57a854a1644dbbae7ddf8af3c4f
[ "MIT" ]
1,192
2018-09-18T11:27:55.000Z
2021-10-17T10:24:37.000Z
import random import time #list of words words = ("python", "india", "japan", "mother", "computer", "watch", "keyboard", "compass", "bottle", "monitor", "switch", "shoes", "chain", "mobile", "coffee", "alfredo", "mouse", "stomach", "tablet", "mojito", "halapeneos", "pizza", "nutella", "peanut", "broccoli") n = 0 #defining class player class Player: def __init__(self, name): self.name = name self.score = 0 #Function to fetch Jumbled Word! def getJumbledWord(): word = random.choice(words) origWord = word jumbledWord = ''.join(random.sample(word, len(word))) return jumbledWord, origWord #Function to show Result def showResult(player1, player2): if player1.score > player2.score: print('Player 1 {} is Winner!'.format(player1.name)) print('Player 1 Score: ', player1.score) print('Player 2 Score: ', player2.score) if player1.score < player2.score: print('Player 2 {} is Winner!'.format(player2.name)) print('Player 2 Score: ', player2.score) print('Player 1 Score: ', player1.score) else: print('The Game is Drawn!') print('Player 1: {} Player 2: {}'.format(player1.score, player2.score)) #Function for countdown timer (source: https://stackoverflow.com/questions/25189554/countdown-clock-0105) def countdown(t): while t: mins, secs = divmod(t, 60) timeformat = '{:02d}:{:02d}'.format(mins, secs) print(timeformat, end='\r') time.sleep(1) t -= 1 print('Welcome to JUmBLeD!') print('Guess the correct anwer to win points!') print('The one who scores the most out of 10 questions wins!') print('Note: Player who fails to give answer within 15 secs will loose!\n\n') print('Player1:') name1 = input('Enter your Name: ') player1 = Player(name1) print('Player2:') name2 = input('Enter your Name: ') player2 = Player(name2) while(n<=5): jumbledWord1, origWord1 = getJumbledWord() print('Question {}: \n\n'.format(n)) print('Player 1:') print('Your Jumbled word is: ', jumbledWord1) w1 = input('Player 1 Answer: ') if w1 == origWord1: player1.score += 1 print('correct!') print('Score: ', player1.score) print('\n') else: print("Incorrect!") print('Score: ', player1.score) print('\n') jumbledWord2, origWord2 = getJumbledWord() print('Player 2:') print('Your Jumbled word is: ', jumbledWord2) w2 = input('Player 2 Answer: ') if w2 == origWord2: player2.score += 1 print('correct!') print('Score: ', player2.score) print('\n') else: print("Incorrect!") print('Score: ', player2.score) print('\n') n += 1 showResult(player1, player2)
28.814433
105
0.608945
91
0.032558
0
0
0
0
0
0
1,066
0.381395
19775af3ac0af2c8563350d3a05ceb55a427a779
639
py
Python
tracking/urls.py
KolibriSolutions/BepMarketplace
c47d252fd744cde6b927e37c34d7a103c6162be5
[ "BSD-3-Clause" ]
1
2019-06-29T15:24:24.000Z
2019-06-29T15:24:24.000Z
tracking/urls.py
KolibriSolutions/BepMarketplace
c47d252fd744cde6b927e37c34d7a103c6162be5
[ "BSD-3-Clause" ]
2
2020-01-12T17:47:33.000Z
2020-01-12T17:47:45.000Z
tracking/urls.py
KolibriSolutions/BepMarketplace
c47d252fd744cde6b927e37c34d7a103c6162be5
[ "BSD-3-Clause" ]
2
2019-06-29T15:24:26.000Z
2020-01-08T15:15:03.000Z
# Bep Marketplace ELE # Copyright (c) 2016-2021 Kolibri Solutions # License: See LICENSE file or https://github.com/KolibriSolutions/BepMarketplace/blob/master/LICENSE # from django.urls import path from . import views app_name = 'tracking' urlpatterns = [ path('user/login/', views.list_user_login, name='listuserlog'), path('user/<int:pk>/', views.telemetry_user_detail, name='userdetail'), path('project/', views.list_project_status_change, name='statuslist'), path('application/', views.list_application_change, name='applicationlist'), path('download/', views.download_telemetry, name='downloadtelemetry'), ]
37.588235
102
0.744914
0
0
0
0
0
0
0
0
316
0.494523
1977d36fe2b99e051c145c78f7a06b38fad7e1e1
394
py
Python
admin_log_entries/settings.py
ataylor32/django-adminlogentries
6aa99b0444b3747369404bcaee4b50183f8194e0
[ "MIT" ]
5
2017-12-05T13:44:48.000Z
2021-07-29T14:04:57.000Z
admin_log_entries/settings.py
ataylor32/django-adminlogentries
6aa99b0444b3747369404bcaee4b50183f8194e0
[ "MIT" ]
null
null
null
admin_log_entries/settings.py
ataylor32/django-adminlogentries
6aa99b0444b3747369404bcaee4b50183f8194e0
[ "MIT" ]
null
null
null
from django.conf import settings default_settings = { 'has_module_permission_false': False, } ADMIN_LOG_ENTRIES_SETTINGS = {} def compute_settings(): for name, value in default_settings.items(): ADMIN_LOG_ENTRIES_SETTINGS[name] = value if hasattr(settings, 'ADMIN_LOG_ENTRIES'): ADMIN_LOG_ENTRIES_SETTINGS.update(settings.ADMIN_LOG_ENTRIES) compute_settings()
21.888889
69
0.756345
0
0
0
0
0
0
0
0
48
0.121827
19782f36845f0387a12cf4d653a628e8d252f1ee
205
py
Python
katas/beta/reverse_the_number.py
the-zebulan/CodeWars
1eafd1247d60955a5dfb63e4882e8ce86019f43a
[ "MIT" ]
40
2016-03-09T12:26:20.000Z
2022-03-23T08:44:51.000Z
katas/beta/reverse_the_number.py
akalynych/CodeWars
1eafd1247d60955a5dfb63e4882e8ce86019f43a
[ "MIT" ]
null
null
null
katas/beta/reverse_the_number.py
akalynych/CodeWars
1eafd1247d60955a5dfb63e4882e8ce86019f43a
[ "MIT" ]
36
2016-11-07T19:59:58.000Z
2022-03-31T11:18:27.000Z
def reverse(n): exp = 1 while n / 10 ** exp: exp += 1 return sum((n % 10 ** a / 10 ** (a - 1)) * (10 ** b) for a, b in zip(xrange(1, exp + 1), xrange(exp - 1, -1, -1)))
25.625
76
0.404878
0
0
0
0
0
0
0
0
0
0
1979aba1d17f885ed392d4535bcc74a5d8e636bc
464
py
Python
lwrl/optimizers/multistep_optimizer.py
sealday/lwrl
52bcd67751e605c38db4afa609c58938c7034e8d
[ "MIT" ]
2
2019-04-11T11:55:48.000Z
2020-05-29T18:09:51.000Z
lwrl/optimizers/multistep_optimizer.py
sealday/lwrl
52bcd67751e605c38db4afa609c58938c7034e8d
[ "MIT" ]
6
2021-06-01T22:21:00.000Z
2022-03-11T23:24:36.000Z
lwrl/optimizers/multistep_optimizer.py
sealday/lwrl
52bcd67751e605c38db4afa609c58938c7034e8d
[ "MIT" ]
1
2019-04-12T03:09:47.000Z
2019-04-12T03:09:47.000Z
from lwrl.optimizers import MetaOptimizer class MultistepOptimizer(MetaOptimizer): def __init__(self, parameters, optimizer, num_steps=10): self.num_steps = num_steps super().__init__(parameters, optimizer) def step(self, fn_loss, arguments, fn_reference, **kwargs): arguments['reference'] = fn_reference(**arguments) for _ in range(self.num_steps): self.optimizer.step(fn_loss=fn_loss, arguments=arguments)
33.142857
69
0.709052
419
0.903017
0
0
0
0
0
0
11
0.023707
197a1ef6fa46d979a05f557aa10ddfcfec221a69
5,301
py
Python
saefportal/saef/views/connection_view.py
harry-consulting/SAEF
12ef43bbcc3178b8a988e21c1bef035881cf6e6d
[ "BSD-2-Clause" ]
4
2020-12-16T13:14:26.000Z
2022-03-26T08:54:12.000Z
saefportal/saef/views/connection_view.py
harry-consulting/SAEF
12ef43bbcc3178b8a988e21c1bef035881cf6e6d
[ "BSD-2-Clause" ]
1
2022-03-26T09:09:04.000Z
2022-03-26T09:09:04.000Z
saefportal/saef/views/connection_view.py
harry-consulting/SAEF
12ef43bbcc3178b8a988e21c1bef035881cf6e6d
[ "BSD-2-Clause" ]
1
2020-12-16T13:20:17.000Z
2020-12-16T13:20:17.000Z
from saef.connections import ConnectionFormHelper from ..models import Connection from ..forms import ConnectionTypeForm from saefportal.settings import MSG_SUCCESS_CONNECTION_UPDATE, MSG_SUCCESS_CONNECTION_VALID, \ MSG_ERROR_CONNECTION_INVALID, MSG_SUCCESS_CONNECTION_SAVED, MSG_ERROR_CONNECTION_SELECT_INVALID, \ MSG_SUCCESS_CONNECTION_DELETED from django.contrib import messages from django.shortcuts import redirect, render, get_object_or_404 from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin from django.views import generic ADD_CONNECTION_TITLE = 'Add Connection' ADD_CONNECTION_TEMPLATE_NAME = "connection/add_connection.html" EDIT_CONNECTION_TEMPLATE_NAME = "connection/edit_connection_detail.html" POSTGRESQL_NAME = "PostgreSQL" class ConnectionView(LoginRequiredMixin, generic.ListView): template_name = 'connection/connection_list.html' model = Connection context_object_name = 'connections' @login_required() def update_connection(request, connection_id): helper = ConnectionFormHelper() connection = get_object_or_404(Connection, id=connection_id) if request.method == "POST": if request.POST["Operation"] == 'Delete': instance = Connection.objects.get(pk=connection_id) instance.delete() messages.success(request, MSG_SUCCESS_CONNECTION_DELETED) return redirect('connection') else: edit_method = helper.lookup_connection(connection.connection_type.name, 'edit') edit_form = edit_method(post_request=request.POST) if edit_form.is_valid(): save_edit_method = helper.lookup_connection(connection.connection_type.name, 'save_edit') save_edit_method(edit_form, connection_id) messages.success(request, MSG_SUCCESS_CONNECTION_UPDATE) return redirect("connection") else: messages.error(request, MSG_ERROR_CONNECTION_SELECT_INVALID) context = {"connection_form": edit_form} return render(request, EDIT_CONNECTION_TEMPLATE_NAME, context) edit_method = helper.lookup_connection(connection.connection_type.name, 'edit') edit_form = edit_method(connection_pk=connection.pk) context = {"connection_form": edit_form} return render(request, EDIT_CONNECTION_TEMPLATE_NAME, context) @login_required() def test_database_connection(request, form): helper = ConnectionFormHelper() connection_type = form.cleaned_data['connection_type'].name add_form_method = helper.lookup_connection(connection_type, 'add') connection_form = add_form_method(request.POST) if connection_form.is_valid(): test_connection_method = helper.lookup_connection(connection_type, 'test') result = test_connection_method(connection_form.cleaned_data, form.cleaned_data) if result is True: messages.success(request, MSG_SUCCESS_CONNECTION_VALID) else: messages.error(request, MSG_ERROR_CONNECTION_INVALID(result)) context = { 'form': form, 'connection_form': add_form_method(request.POST), 'connection_type': connection_type } return render(request, ADD_CONNECTION_TEMPLATE_NAME, context) @login_required() def save_connection(request, form): helper = ConnectionFormHelper() connection_type = form.cleaned_data['connection_type'].name add_form_method = helper.lookup_connection(connection_type, 'add') connection_form = add_form_method(request.POST) if connection_form.is_valid(): save_method = helper.lookup_connection(connection_type, 'save') save_method(connection_form.cleaned_data, form.cleaned_data) messages.success(request, MSG_SUCCESS_CONNECTION_SAVED) return redirect("connection") messages.error(request, MSG_ERROR_CONNECTION_SELECT_INVALID) connection_type = form.cleaned_data['connection_type'].name context = { "form": ConnectionTypeForm(request.POST), "connection_form": add_form_method(request.POST), "connection_type": connection_type } return render(request, ADD_CONNECTION_TEMPLATE_NAME, context) @login_required() def add_connection(request): helper = ConnectionFormHelper() if request.method == "POST": form = ConnectionTypeForm(request.POST) if form.is_valid() and form.cleaned_data['connection_type']: connection_type = form.cleaned_data['connection_type'].name if "Operation" not in request.POST: add_form_method = helper.lookup_connection(connection_type, 'add') context = { "form": form, "connection_form": add_form_method(), "connection_type": connection_type } return render(request, ADD_CONNECTION_TEMPLATE_NAME, context) elif request.POST["Operation"] == "Test": return test_database_connection(request, form) elif request.POST["Operation"] == "Save": return save_connection(request, form) else: form = ConnectionTypeForm() return render(request, ADD_CONNECTION_TEMPLATE_NAME, {'form': form})
41.414063
105
0.716469
176
0.033201
0
0
4,294
0.810036
0
0
553
0.10432
197a2e031fcb6bc8c3c7153d570a652bf400420f
6,206
py
Python
modules/niftitools.py
NeuroSainteAnne/synthFLAIR
ddb083e0ddbb5a7a3131e947c8a84809f25b93a1
[ "BSD-3-Clause" ]
2
2022-01-09T11:25:40.000Z
2022-03-24T04:00:11.000Z
modules/niftitools.py
yunfei920406/synthFLAIR
ddb083e0ddbb5a7a3131e947c8a84809f25b93a1
[ "BSD-3-Clause" ]
null
null
null
modules/niftitools.py
yunfei920406/synthFLAIR
ddb083e0ddbb5a7a3131e947c8a84809f25b93a1
[ "BSD-3-Clause" ]
2
2022-03-24T04:00:17.000Z
2022-03-25T00:36:13.000Z
import os import pydicom import glob import numpy as np import nibabel as nib from skimage import filters, morphology from scipy.ndimage.morphology import binary_fill_holes from scipy.ndimage import label from dipy.segment.mask import median_otsu def padvolume(volume): "Applies a padding/cropping to a volume in order to hav 256x256 size" padx1 = padx2 = pady1 = pady2 = 0 orig_shape = volume.shape if orig_shape[0] < 256 or orig_shape[1] < 256: if orig_shape[0] < 256: padx1 = int((256.0 - orig_shape[0])/2) padx2 = 256 - orig_shape[0] - padx1 if orig_shape[1] < 256: pady1 = int((256.0 - orig_shape[1])/2) pady2 = 256 - orig_shape[1] - pady1 volume = np.pad(volume, ((padx1, padx2),(pady1,pady2),(0,0)), mode="edge") cutx1 = cutx2 = cuty1 = cuty2 = 0 if orig_shape[0] > 256 or orig_shape[1] > 256: if orig_shape[0] > 256: cutx1 = int((orig_shape[0]-256.0)/2) cutx2 = orig_shape[0] - 256 - cutx1 volume = volume[cutx1:-cutx2,:,:] if orig_shape[1] > 256: cuty1 = int((orig_shape[1]-256.0)/2) cuty2 = orig_shape[1] - 256 - cuty1 volume = volume[:,cuty1:-cuty2,:] return volume, (padx1, padx2, pady1, pady2, cutx1, cutx2, cuty1, cuty2) def zpadding(volume, zpad): orig_shape = volume.shape if orig_shape[2] < zpad: padz1 = int((zpad - orig_shape[2])/2) padz2 = zpad - orig_shape[2] - padz1 volume = np.pad(volume, ((0,0),(0,0),(padz1,padz2)), mode="minimum") elif orig_shape[2] > zpad: cutz1 = int((orig_shape[2] - zpad)/2) cutz2 = orig_shape[2] - zpad - cutz2 volume = volume[:,:,cutz1:cutz2] return volume def reversepad(volume, padspecs): "Reserves a previously applied padding" padx1 = padspecs[0] padx2 = padspecs[1] pady1 = padspecs[2] pady2 = padspecs[3] cutx1 = padspecs[4] cutx2 = padspecs[5] cuty1 = padspecs[6] cuty2 = padspecs[7] if cutx1>0 or cutx2>0: volume = np.pad(volume, ((cutx1, cutx2),(0,0),(0,0)), mode="edge") if cuty1>0 or cuty2>0: volume = np.pad(volume, ((0,0),(cuty1,cuty2),(0,0)), mode="edge") if padx1>0 or padx2>0: volume = volume[padx1:-padx2,:,:] if pady1>0 or pady2>0: volume = volume[:,pady1:-pady2,:] return volume def brain_component(vol): "Select the largest component in a mask (brain)" label_im, nb_labels = label(vol) label_count = np.bincount(label_im.ravel().astype(np.int)) label_count[0] = 0 return label_im == label_count.argmax() def normalize(vol, mask): "Normalization of a volume" masked_vol = vol[mask] mean_val, sd_val = np.mean(masked_vol), np.std(masked_vol) vol = (vol - mean_val) / sd_val return vol def adccompute(b0, b1000): "Computes ADC map" crudemask = (b0 >= 1) & (b1000 >= 1) # exclude zeros for ADC calculation adc = np.zeros(b0.shape, b1000.dtype) adc[crudemask] = -1. * float(1000) * np.log(b1000[crudemask] / b0[crudemask]) adc[adc < 0] = 0 return adc def maskcompute(b0, b1000): "Computes a brain mask using otsu method" b0_mask, mask0 = median_otsu(b0, 1, 1) b1000_mask, mask1000 = median_otsu(b1000, 1, 1) mask = binary_fill_holes(morphology.binary_dilation(brain_component(mask0 & mask1000))) mask = mask & (b0 >= 1) & (b1000 >= 1) return mask def splitdiffusion(diffdata): "Splits b0 and b1000 based on value mean" vol1 = diffdata[...,0] vol2 = diffdata[...,1] if vol1.mean() > vol2.mean(): b0 = vol1 b1000 = vol2 else: b0 = vol2 b1000 = vol1 return b0, b1000 def nifti2array(diffpath): # load diffusion diffnib = nib.load(diffpath) diffdata = diffnib.get_fdata() # differenciate b1000 from b0 b0, b1000 = splitdiffusion(diffdata) stacked, mask, padspecs = splitdwi2array(b0,b1000,adjust=True,z_pad=False) stacked = stacked.transpose([3,2,1,0])[:,:,::-1,np.newaxis,:] qualarr = np.tile(2, (stacked.shape[0],1)) return stacked, qualarr, padspecs, diffnib.affine def twoniftis2array(b0path, b1000path,z_pad=None): # load niftis diff0nib = nib.load(b0path) diff0data = diff0nib.get_fdata() diff1000nib = nib.load(b1000path) diff1000data = diff1000nib.get_fdata() return splitdwi2array(diff0data,diff1000data,adjust=False,z_pad=z_pad) def flairnifti2array(flairpath, mask, z_pad=None): flairnib = nib.load(flairpath) flair = flairnib.get_fdata() # pad flair, padspecs = padvolume(flair) if z_pad is not None: flair = zpadding(flair, z_pad) # normalisation flair = normalize(flair, mask) return flair def masknifti2array(mask, z_pad=None): # load nifti masknib = nib.load(mask) mask = masknib.get_fdata() # pad mask, padspecs = padvolume(mask) if z_pad is not None: mask = zpadding(mask, z_pad) return mask def splitdwi2array(b0,b1000,adjust=False,z_pad=None): # pad/crop volumes to 256x256 b0, _ = padvolume(b0) b1000, padspecs = padvolume(b1000) #Z-pad if z_pad is not None: b0 = zpadding(b0, z_pad) b1000 = zpadding(b1000, z_pad) # ADC calculation adc = adccompute(b0, b1000) # mask computation mask = maskcompute(b0, b1000) # normalisation b0 = normalize(b0, mask) b1000 = normalize(b1000, mask) # adjust for model input if adjust: b0 = ((b0 + 5) / (12 + 5))*2-1 b1000 = ((b1000 + 5) / (12 + 5))*2-1 adc = ((adc) / (7500))*2-1 # export for model input stacked = np.stack([b0,b1000,adc]) return stacked, mask, padspecs def array2nifti(savearray, padspecs, affine, outpath): synthflair = savearray[:,:,::-1,0].transpose(2,1,0) synthflair = synthflair - synthflair.min() synthflair = 256*(synthflair / synthflair.max()) synthflair = reversepad(synthflair, padspecs) synthflairnib = nib.Nifti1Image(synthflair, affine=affine) nib.save(synthflairnib, outpath)
31.502538
91
0.618595
0
0
0
0
0
0
0
0
573
0.09233
197baac1afa4b35de9d60fc8d92a0d5870b20c39
1,937
py
Python
recognition.py
1159186649/Raspberry-Car
d1114793dd45be4e60a5d8a8da57b01ae3210f94
[ "Apache-2.0" ]
1
2020-11-04T02:28:32.000Z
2020-11-04T02:28:32.000Z
recognition.py
1159186649/Raspberry-Car
d1114793dd45be4e60a5d8a8da57b01ae3210f94
[ "Apache-2.0" ]
null
null
null
recognition.py
1159186649/Raspberry-Car
d1114793dd45be4e60a5d8a8da57b01ae3210f94
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- from aip import AipFace from picamera import PiCamera import urllib.request import RPi.GPIO as GPIO import base64 import time import Main #百度智能云人脸识别id、key APP_ID = '*****' API_KEY = '**********' SECRET_KEY ='**********' client = AipFace(APP_ID, API_KEY, SECRET_KEY)#创建一个客户端用以访问百度云 #图像编码方式 IMAGE_TYPE='BASE64' camera = PiCamera()#定义一个摄像头对象 #用户组 GROUP = 'usr1' #照相函数 # def getimage(): # camera.resolution = (1024,768)#摄像界面为1024*768 # camera.start_preview()#开始摄像 # time.sleep(1) # camera.capture('faceimage.jpg')#拍照并保存 # time.sleep(1) # camera.close() # 对图片的格式进行转换 def transimage(): f = open('faceimage.jpg','rb') img = base64.b64encode(f.read()) return img #上传到百度api进行人脸检测 def go_api(image): result = client.search(str(image, 'utf-8'), IMAGE_TYPE, GROUP);#在百度云人脸库中寻找有没有匹配的人脸 if result['error_msg'] == 'SUCCESS':#如果成功了 name = result['result']['user_list'][0]['user_id']#获取名字 score = result['result']['user_list'][0]['score']#获取相似度 if score < 80:#如果相似度大于80 print("对不起,我不认识你!") name = 'Unknow' return 0 curren_time = time.asctime(time.localtime(time.time()))#获取当前时间 #将人员出入的记录保存到Log.txt中 f = open('Log.txt','a') f.write("Person: " + name + " " + "Time:" + str(curren_time)+'\n') f.close() return 1 if result['error_msg'] == 'pic not has face': # print('检测不到人脸') time.sleep(2) return 1 else: print(result['error_code']+' ' + result['error_code']) return 0 #主函数 if __name__ == '__main__': print('准备') # getimage()#拍照 img = transimage()#转换照片格式 res = go_api(img)#将转换了格式的图片上传到百度云 if res == 1:#是人脸库中的人 print("正常") else: print("出现陌生人") print('等40s进入下一轮') time.sleep(1)
25.826667
87
0.573051
0
0
0
0
0
0
0
0
1,200
0.512601
197c315cc4fccd63e25903e81134070c4aabf0c5
2,939
py
Python
base/3base.py
chenliangold4j/MyPyDictionnary
3428333f42249f33732da71e420bdc41a412f594
[ "Apache-2.0" ]
null
null
null
base/3base.py
chenliangold4j/MyPyDictionnary
3428333f42249f33732da71e420bdc41a412f594
[ "Apache-2.0" ]
null
null
null
base/3base.py
chenliangold4j/MyPyDictionnary
3428333f42249f33732da71e420bdc41a412f594
[ "Apache-2.0" ]
null
null
null
L = ['Michael', 'Sarah', 'Tracy', 'Bob', 'Jack'] print(L[0:3]); # L[0:3]表示,从索引0开始取,直到索引3为止,但不包括索引3。即索引0,1,2,正好是3个元素。 # 如果第一个索引是0,还可以省略: print(L[:3]); # 类似的,既然Python支持L[-1]取倒数第一个元素,那么它同样支持倒数切片,试试: print(L[-2:]) L = list(range(100)) # 前10个数,每两个取一个: print(L[:10:2]) # 甚至什么都不写,只写[:]就可以原样复制一个list: # ,tuple也可以用切片操作,只是操作的结果仍是tuple: # 字符串也可以用切片操作,只是操作结果仍是字符串: print('ABCDEFG'[:3]) # 迭代 d = {'a': 1, 'b': 2, 'c': 3} for key in d: print(key) # 那么,如何判断一个对象是可迭代对象呢?方法是通过collections模块的Iterable类型判断: from collections.abc import Iterable print(isinstance('abc', Iterable)) print(isinstance([1, 2, 3], Iterable)) # Python内置的enumerate函数可以把一个list变成索引-元素对,这样就可以在for循环中同时迭代索引和元素本身: for i, value in enumerate(['A', 'B', 'C']): print(i, value) # 列表生成器 print(list(range(1, 11))); print([x * x for x in range(1, 11)]) print([m + n for m in 'ABC' for n in 'XYZ']) # 运用列表生成式,可以写出非常简洁的代码。例如,列出当前目录下的所有文件和目录名,可以通过一行代码实现: import os print([d for d in os.listdir('.')]) # for循环其实可以同时使用两个甚至多个变量,比如dict的items()可以同时迭代key和value: d = {'x': 'A', 'y': 'B', 'z': 'C'} for k, v in d.items(): print(k, '=', v) L = ['Hello', 'World', 'IBM', 'Apple'] print([s.lower() for s in L]) # 在Python中,这种一边循环一边计算的机制,称为生成器:generator L = [x * x for x in range(10)] print(L) g = (x * x for x in range(10)) print(g) # 创建L和g的区别仅在于最外层的[]和(),L是一个list,而g是一个generator。 print(next(g)) print(next(g)) print(next(g)) print(next(g)) # generator保存的是算法,每次调用next(g),就计算出g的下一个元素的值,直到计算到最后一个元素,没有更多的元素时,抛出StopIteration的错误 # 定义generator的另一种方法。如果一个函数定义中包含yield关键字,那么这个函数就不再是一个普通函数,而是一个generator: def fib(max): n, a, b = 0, 0, 1 while n < max: yield b a, b = b, a + b n = n + 1 return 'done' f = fib(6) print(f) # 。函数是顺序执行,遇到return语句或者最后一行函数语句就返回。而变成generator的函数, # 在每次调用next()的时候执行,遇到yield语句返回,再次执行时从上次返回的yield语句处继续执行。 # 用for循环调用generator时,发现拿不到generator的return语句的返回值。如果想要拿到返回值,必须捕获StopIteration错误,返回值包含在StopIteration的value中: g = fib(6) while True: try: x = next(g) print('g:', x) except StopIteration as e: print('Generator return value:', e.value) break # 迭代器 # 生成器都是Iterator对象,但list、dict、str虽然是Iterable,却不是Iterator。 # from collections.abc import Iterator print(isinstance((x for x in range(10)), Iterator)) # true print(isinstance((x for x in range(10)), Iterable)) # true print(isinstance([], Iterator)) # false print(isinstance([], Iterable)) # true print(isinstance({}, Iterator)) # false print(isinstance({}, Iterable)) # true print(isinstance('abc', Iterator)) # false print(isinstance('abc', Iterable)) # true # 把list、dict、str等Iterable变成Iterator可以使用iter() # 函数: print(isinstance(iter([]), Iterator)) print(isinstance(iter('abc'), Iterator)) # Python的Iterator对象表示的是一个数据流,Iterator对象可以被next()函数调用并不断返回下一个数据,直到没有数据时抛出StopIteration错误。 # 可以把这个数据流看做是一个有序序列,但我们却不能提前知道序列的长度,只能不断通过next()函数实现按需计算下一个数据, # 所以Iterator的计算是惰性的,只有在需要返回下一个数据时它才会计算。 # # Iterator甚至可以表示一个无限大的数据流,例如全体自然数。而使用list是永远不可能存储全体自然数的。
27.726415
106
0.697856
0
0
130
0.028844
0
0
0
0
3,058
0.6785
197f119da149ba3627c410ef123a293d7183c17e
4,986
py
Python
rssxkcd.py
bkentropy/xkcd-updater
732b60428a9fdc79c2cd847623c7416cb4b6022d
[ "MIT" ]
null
null
null
rssxkcd.py
bkentropy/xkcd-updater
732b60428a9fdc79c2cd847623c7416cb4b6022d
[ "MIT" ]
null
null
null
rssxkcd.py
bkentropy/xkcd-updater
732b60428a9fdc79c2cd847623c7416cb4b6022d
[ "MIT" ]
null
null
null
#!/usr/local/bin/python2 import argparse import requests import feedparser import time import sys import sqlite3 import datetime # Command line args parser = argparse.ArgumentParser(description='Provide HipChat integration url to post xkcd comics') parser.add_argument('url', type=str, help='(string) a special url for posting to a hipchat room') parser.add_argument('-c', '--commit', action='store_true', help='check the output, and commit if it looks right') args = parser.parse_args() class Entry: def __init__(self, title, imglink, summary, link, pubts, posted): self.title = title self.imglink = imglink self.summary = summary self.link = link # this will be the id field in db self.pubts = pubts self.posted = 0 def analyze(self): data = "Link: " + self.link + "\n" data += "Title: " + self.title + "\n" data += "Summary: " + self.summary + "\n" data += "Pubts: " + self.pubts + "\n" data += "Imglink: " + self.imglink + "\n" data += "Posted: " + str(self.posted) print(data) # Get rss feed from URL (https://xkcd.com/rss.xml) def check_rss_feed(cursor, feedurl, rssentries): row = cursor.execute("SELECT id FROM lastpub") lastts = row.fetchone() or ("",) req = requests.get(feedurl, headers={ "If-Modified-Since": lastts[0] }) if req.text: # get the rss feed data from the feedurl feed = feedparser.parse(feedurl) entries = feed.entries for i in range(len(entries)): e = Entry( entries[i]['title'], entries[i]['summary'].split('\"')[3], entries[i]['summary'].split('\"')[1], entries[i]['link'], entries[i]['published'], 0 ) rssentries.append(e) return req # Hipchat posting function def post_to_hipchat(title, src, alttext, posturl): payload = { "color": "gray", "message": "<span>" + title + "</span><br/><img src='" + src + "'/>" + "<br/><span>(Alt-text: " + alttext + ")</span>", "notify": True, "message_format": "html" } if args.commit: r = requests.post(posturl, data=payload) print(title, "Posted!", args.commit) # Database functions def insert_entry(db, cursor, e): if args.commit: cursor.execute('''INSERT INTO entries(id, title, imglink, summary, pubts, posted) VALUES(?,?,?,?,?,?)''', (e.link, e.title, e.imglink, e.summary, e.pubts, 0)) db.commit() print("Saved entry in db", args.commit) def update_to_posted(db, cursor, e): if args.commit: cursor.execute('UPDATE entries SET posted=1 WHERE id=?', (e.link,)) db.commit() print("Updated posted for:", e.link, args.commit) def check_if_in_db(db, cursor, e): rc = cursor.execute('SELECT id FROM entries WHERE id=?', (e.link,)) if rc.fetchone(): return True else: return False def check_if_posted(db, cursor, e): rc = cursor.execute('SELECT posted FROM entries WHERE id=?', (e.link,)) exists = rc.fetchone()[0] if exists is 1: return True else: return False # Primary function def check_and_post(db, cursor, ents, posturl): # TODO: lines 96-99 and 102-106 are ripe for refactor update_timestamp = False for e in ents: indb = check_if_in_db(db, cursor, e) if indb: posted = check_if_posted(db, cursor, e) if not posted: title = e.title + " (" + str(e.link) + ")" post_to_hipchat(title, e.imglink, e.summary, posturl) update_to_posted(db, cursor, e) update_timestamp = True print("in db, not posted", datetime.datetime.now()) else: insert_entry(db, cursor, e) title = e.title + " (" + str(e.link) + ")" post_to_hipchat(title, e.imglink, e.summary, posturl) update_to_posted(db, cursor, e) update_timestamp = True print("not in db at all", datetime.datetime.now()) return update_timestamp def main(): # Globals feedurl = 'https://xkcd.com/rss.xml' posturl = str(sys.argv[1]) RSSEntries = [] db = sqlite3.connect("feed.db") cursor = db.cursor() if feedurl and posturl: req = check_rss_feed(cursor, feedurl, RSSEntries) RSSEntries = sorted(RSSEntries, key=lambda e: e.link) if len(RSSEntries) > 0: need_update_timestamp = check_and_post(db, cursor, RSSEntries, posturl) if need_update_timestamp: newts = (req.headers["Last-Modified"],) if args.commit: cursor.execute("UPDATE lastpub set id=?", newts) db.commit() print('Updated lastpub date to: ', newts, args.commit) else: print("All up to date!", datetime.datetime.now()) if __name__ == "__main__": main()
33.689189
113
0.583233
606
0.12154
0
0
0
0
0
0
1,214
0.243482
197ff79f1f26876a9752bd0bf842c448b0d64426
401
py
Python
Conditional/Lista 1/Thiago/07.py
Vitor-ORB/algorithms-and-programming-1-ufms
10821e9b580b78b7f78c27e740f3ead9c6b9f0bd
[ "MIT" ]
7
2021-05-25T16:49:20.000Z
2022-02-17T11:57:32.000Z
Conditional/Lista 1/Thiago/07.py
Vitor-ORB/algorithms-and-programming-1-ufms
10821e9b580b78b7f78c27e740f3ead9c6b9f0bd
[ "MIT" ]
null
null
null
Conditional/Lista 1/Thiago/07.py
Vitor-ORB/algorithms-and-programming-1-ufms
10821e9b580b78b7f78c27e740f3ead9c6b9f0bd
[ "MIT" ]
8
2021-05-25T16:49:39.000Z
2021-09-30T18:02:07.000Z
# Leia 2 valores numéricos e um símbolo correspondente a uma das operações. # soma (+), subtração(-), divisão(/) e multiplicação(*) n1, n2, op = input().split() n1 = int(n1) n2 = int(n2) if op == "+": print(n1 + n2) elif op == "-": print(n1 - n2) elif op == "/": print(n1 / n2) elif op == "*": print(n1 * n2) else: print("Sua operação matemática não é válida.")
22.277778
76
0.55611
0
0
0
0
0
0
0
0
198
0.475962
19822fbb662c35172c55da381ed0906814ac3187
2,000
py
Python
ciphers/caeser_cipher.py
nairraghav/ron-cipher
e7cbac6cd8f0fe30e71b7d7f26fddb8af4d6a88a
[ "MIT" ]
null
null
null
ciphers/caeser_cipher.py
nairraghav/ron-cipher
e7cbac6cd8f0fe30e71b7d7f26fddb8af4d6a88a
[ "MIT" ]
2
2021-02-02T23:46:26.000Z
2021-04-20T20:09:33.000Z
ciphers/caeser_cipher.py
nairraghav/ron-cipher
e7cbac6cd8f0fe30e71b7d7f26fddb8af4d6a88a
[ "MIT" ]
null
null
null
from ciphers.cipher_helper import get_character_map, flip_dict class CaeserCipher: def __init__(self, rotation: int = None): self.default_character_map = get_character_map() self.flipped_default_character_map = flip_dict( self.default_character_map ) if rotation: self.rotation = rotation else: self.rotation = len(self.default_character_map) // 2 self.update_cipher_dicts() @property def rotation(self): return self._rotation @rotation.setter def rotation(self, rotation_value): try: rotation_value = int(rotation_value) except ValueError: raise Exception("Rotation must be an integer") self._rotation = rotation_value self.update_cipher_dicts() def update_cipher_dicts(self): # update map for new cipher character_map_length = len(self.default_character_map) self.cipher_map = { key: ((value + self._rotation) % character_map_length) for key, value in self.default_character_map.items() } self.flipped_cipher_map = flip_dict(self.cipher_map) def encrypt(self, plain_text): plain_text = plain_text.lower() encrypted = "" for character in plain_text: if character in self.default_character_map: encrypted += self.flipped_cipher_map[ self.default_character_map[character] ] else: encrypted += character return encrypted def decrypt(self, encrypted): encrypted = encrypted.lower() plain_text = "" for character in encrypted: if character in self.default_character_map: plain_text += self.flipped_default_character_map[ self.cipher_map[character] ] else: plain_text += character return plain_text
29.411765
66
0.607
1,934
0.967
0
0
343
0.1715
0
0
60
0.03
198277b32eac2b22c43af843c0ee4c66623b8afb
327
py
Python
instagram/migrations/0020_remove_profile_follow.py
01king-ori/Kings-instagram
5e3c523462883879fe33834d68bdf1ebe4b75d8d
[ "MIT" ]
3
2020-06-25T22:35:05.000Z
2022-01-11T03:50:08.000Z
instagram/migrations/0020_remove_profile_follow.py
01king-ori/Kings-instagram
5e3c523462883879fe33834d68bdf1ebe4b75d8d
[ "MIT" ]
5
2020-06-05T23:38:22.000Z
2021-06-10T19:05:02.000Z
instagram/migrations/0020_remove_profile_follow.py
01king-ori/Kings-instagram
5e3c523462883879fe33834d68bdf1ebe4b75d8d
[ "MIT" ]
5
2020-01-07T05:39:10.000Z
2021-09-14T05:31:08.000Z
# Generated by Django 2.2.6 on 2019-10-14 13:19 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('instagram', '0019_profile_follow'), ] operations = [ migrations.RemoveField( model_name='profile', name='follow', ), ]
18.166667
47
0.590214
242
0.740061
0
0
0
0
0
0
96
0.293578
1982e8dcbffc500675e9501f2db4214567aa2081
24,054
py
Python
boundaries/ca_qc_districts/definition.py
imhangoo/represent-canada-data
0d9cc818b343079f81a00c15438d79c079a10c9b
[ "OML" ]
null
null
null
boundaries/ca_qc_districts/definition.py
imhangoo/represent-canada-data
0d9cc818b343079f81a00c15438d79c079a10c9b
[ "OML" ]
null
null
null
boundaries/ca_qc_districts/definition.py
imhangoo/represent-canada-data
0d9cc818b343079f81a00c15438d79c079a10c9b
[ "OML" ]
null
null
null
# coding: utf-8 import re from datetime import date import boundaries # Noting that the "union" merge strategy fails with: # # GEOS_ERROR: TopologyException: found non-noded intersection between # LINESTRING (...) and LINESTRING (...) # # django.contrib.gis.geos.error.GEOSException: Could not initialize GEOS Geometry with given input. # # So, we instead use the "combine" merge strategy. # Generated by sets.rb and then edited. sets = { 10043: ["Rimouski", "districts"], 10070: ["Saint-Fabien", "districts"], 1023: ["Les Îles-de-la-Madeleine", "districts"], 11040: ["Trois-Pistoles", "quartiers"], 12015: ["Saint-Antonin", "districts"], 12072: ["Rivière-du-Loup", "districts"], 13073: ["Témiscouata-sur-le-Lac", "districts"], 13095: ["Pohénégamook", "quartiers"], 15013: ["La Malbaie", "districts"], 15035: ["Clermont", "districts"], 15058: ["Saint-Siméon", "districts"], 16013: ["Baie-Saint-Paul", "districts"], 16055: ["Saint-Urbain", "districts"], 17055: ["Saint-Aubert", "districts"], 18050: ["Montmagny", "districts"], 19055: ["Sainte-Claire", "districts"], 19068: ["Saint-Henri", "districts"], 19097: ["Saint-Charles-de-Bellechasse", "districts"], 19105: ["Beaumont", "districts"], 2005: ["Percé", "districts"], 2010: ["Sainte-Thérèse-de-Gaspé", "districts"], 2015: ["Grande-Rivière", "districts"], 2028: ["Chandler", "districts"], 2047: ["Port-Daniel—Gascons", "districts"], 21010: ["Saint-Ferréol-les-Neiges", "districts"], 21045: ["Boischatel", "districts"], 22005: ["Sainte-Catherine-de-la-Jacques-Cartier", "districts"], 22010: ["Fossambault-sur-le-Lac", "districts"], 22015: ["Lac-Saint-Joseph", "districts"], 22035: ["Stoneham-et-Tewkesbury", "districts"], 22040: ["Lac-Beauport", "districts"], 22045: ["Sainte-Brigitte-de-Laval", "districts"], 23027: ["Québec", "districts"], 23057: ["L'Ancienne-Lorette", "districts"], 23072: ["Saint-Augustin-de-Desmaures", "districts"], 25213: ["Lévis", "districts"], 26030: ["Sainte-Marie", "districts"], 26063: ["Saint-Isidore", "districts"], 27028: ["Beauceville", "districts"], 27043: ["Saint-Joseph-de-Beauce", "districts"], 29073: ["Saint-Georges", "districts"], 30010: ["Notre-Dame-des-Bois", "districts"], 30025: ["Frontenac", "districts"], 30030: ["Lac-Mégantic", "districts"], 30045: ["Nantes", "districts"], 3005: ["Gaspé", "quartiers"], 3010: ["Cloridorme", "districts"], 31015: ["Disraeli", "districts"], 31056: ["Adstock", "districts"], 31084: ["Thetford Mines", "districts"], 31122: ["East Broughton", "districts"], 32013: ["Saint-Ferdinand", "districts"], 32033: ["Princeville", "districts"], 32040: ["Plessisville", "districts"], 32065: ["Lyster", "districts"], 33045: ["Saint-Agapit", "districts"], 33052: ["Saint-Flavien", "districts"], 34030: ["Cap-Santé", "districts"], 34038: ["Saint-Basile", "districts"], 34120: ["Lac-Sergent", "quartiers"], 35027: ["Saint-Tite", "districts"], 36033: ["Shawinigan", "districts"], 37067: ["Trois-Rivières", "districts"], 37230: ["Saint-Maurice", "districts"], 37235: ["Notre-Dame-du-Mont-Carmel", "districts"], 39060: ["Saint-Christophe-d'Arthabaska", "districts"], 39062: ["Victoriaville", "districts"], 4037: ["Sainte-Anne-des-Monts", "districts"], 41038: ["Cookshire-Eaton", "districts"], 41098: ["Weedon", "districts"], 42020: ["Saint-François-Xavier-de-Brompton", "districts"], 42025: ["Saint-Denis-de-Brompton", "districts"], 42032: ["Racine", "districts"], 42098: ["Richmond", "districts"], 42100: ["Saint-Claude", "districts"], 42110: ["Cleveland", "districts"], 43027: ["Sherbrooke", "districts"], 44071: ["Compton", "districts"], 45060: ["Sainte-Catherine-de-Hatley", "districts"], 45072: ["Magog", "districts"], 46050: ["Dunham", "districts"], 46058: ["Sutton", "districts"], 46075: ["Lac-Brome", "districts"], 46078: ["Bromont", "districts"], 46080: ["Cowansville", "quartiers"], 46112: ["Farnham", "districts"], 47017: ["Granby", "districts"], 47025: ["Waterloo", "districts"], 47047: ["Roxton Pond", "districts"], 48028: ["Acton Vale", "districts"], 49048: ["Saint-Germain-de-Grantham", "districts"], 49058: ["Drummondville", "districts"], 49070: ["Saint-Cyrille-de-Wendover", "districts"], 50042: ["Saint-Léonard-d'Aston", "districts"], 51015: ["Louiseville", "districts"], 52007: ["Lavaltrie", "districts"], 52017: ["Lanoraie", "districts"], 52035: ["Berthierville", "districts"], 52040: ["Sainte-Geneviève-de-Berthier", "districts"], 52045: ["Saint-Ignace-de-Loyola", "districts"], 52080: ["Saint-Gabriel", "districts"], 52095: ["Mandeville", "districts"], 53040: ["Saint-Roch-de-Richelieu", "districts"], 53050: ["Saint-Joseph-de-Sorel", "quartiers"], 53052: ["Sorel-Tracy", "districts"], 53065: ["Sainte-Anne-de-Sorel", "districts"], 54008: ["Saint-Pie", "districts"], 54017: ["Saint-Damase", "districts"], 54048: ["Saint-Hyacinthe", "districts"], 54060: ["Saint-Dominique", "districts"], 55008: ["Ange-Gardien", "districts"], 55023: ["Saint-Césaire", "districts"], 55037: ["Rougemont", "districts"], 55048: ["Marieville", "districts"], 55057: ["Richelieu", "districts"], 56083: ["Saint-Jean-sur-Richelieu", "districts"], 57005: ["Chambly", "districts"], 57010: ["Carignan", "districts"], 57020: ["Saint-Basile-le-Grand", "districts"], 57025: ["McMasterville", "districts"], 57030: ["Otterburn Park", "districts"], 57033: ["Saint-Jean-Baptiste", "districts"], 57035: ["Mont-Saint-Hilaire", "districts"], 57040: ["Beloeil", "districts"], 57045: ["Saint-Mathieu-de-Beloeil", "districts"], 58007: ["Brossard", "districts"], 58012: ["Saint-Lambert", "districts"], 58033: ["Boucherville", "districts"], 58037: ["Saint-Bruno-de-Montarville", "districts"], 58227: ["Longueuil", "districts"], 59010: ["Sainte-Julie", "districts"], 59015: ["Saint-Amable", "districts"], 59020: ["Varennes", "districts"], 59025: ["Verchères", "districts"], 59035: ["Contrecoeur", "districts"], 60005: ["Charlemagne", "districts"], 60013: ["Repentigny", "districts"], 60028: ["L'Assomption", "districts"], 60035: ["L'Épiphanie", "districts"], 61025: ["Joliette", "districts"], 61027: ["Saint-Thomas", "districts"], 61030: ["Notre-Dame-des-Prairies", "districts"], 61040: ["Saint-Ambroise-de-Kildare", "districts"], 61050: ["Sainte-Mélanie", "districts"], 62007: ["Saint-Félix-de-Valois", "districts"], 62025: ["Saint-Alphonse-Rodriguez", "districts"], 62037: ["Rawdon", "districts"], 62047: ["Chertsey", "districts"], 62060: ["Saint-Donat", "districts"], 62075: ["Saint-Damien", "districts"], 63030: ["Saint-Esprit", "districts"], 63035: ["Saint-Roch-de-l'Achigan", "districts"], 63048: ["Saint-Lin—Laurentides", "districts"], 63055: ["Saint-Calixte", "districts"], 63060: ["Sainte-Julienne", "districts"], 64008: ["Terrebonne", "districts"], 64015: ["Mascouche", "districts"], 65005: ["Laval", "districts"], 66007: ["Montréal-Est", "districts"], 66023: ["Montréal", "districts"], 66032: ["Westmount", "districts"], 66058: ["Côte-Saint-Luc", "districts"], 66072: ["Mont-Royal", "districts"], 66087: ["Dorval", "districts"], 66097: ["Pointe-Claire", "districts"], 66102: ["Kirkland", "districts"], 66107: ["Beaconsfield", "districts"], 66117: ["Sainte-Anne-de-Bellevue", "districts"], 66127: ["Senneville", "districts"], 66142: ["Dollard-Des Ormeaux", "districts"], 67010: ["Saint-Philippe", "districts"], 67015: ["La Prairie", "districts"], 67020: ["Candiac", "districts"], 67025: ["Delson", "quartiers"], 67030: ["Sainte-Catherine", "districts"], 67035: ["Saint-Constant", "districts"], 67045: ["Mercier", "districts"], 67050: ["Châteauguay", "districts"], 67055: ["Léry", "districts"], 68020: ["Sainte-Clotilde", "districts"], 68050: ["Saint-Michel", "districts"], 68055: ["Saint-Rémi", "districts"], 69017: ["Saint-Chrysostome", "districts"], 69055: ["Huntingdon", "quartiers"], 69070: ["Saint-Anicet", "districts"], 70012: ["Sainte-Martine", "districts"], 70022: ["Beauharnois", "districts"], 70035: ["Saint-Louis-de-Gonzague", "districts"], 70040: ["Saint-Stanislas-de-Kostka", "districts"], 70052: ["Salaberry-de-Valleyfield", "districts"], 7018: ["Causapscal", "districts"], 7047: ["Amqui", "districts"], 7057: ["Lac-au-Saumon", "districts"], 71025: ["Saint-Zotique", "districts"], 71033: ["Les Coteaux", "districts"], 71040: ["Coteau-du-Lac", "districts"], 71050: ["Les Cèdres", "districts"], 71060: ["L'Île-Perrot", "districts"], 71065: ["Notre-Dame-de-l'Île-Perrot", "districts"], 71070: ["Pincourt", "districts"], 71083: ["Vaudreuil-Dorion", "districts"], 71100: ["Hudson", "districts"], 71105: ["Saint-Lazare", "districts"], 71133: ["Rigaud", "districts"], 72005: ["Saint-Eustache", "districts"], 72010: ["Deux-Montagnes", "districts"], 72015: ["Sainte-Marthe-sur-le-Lac", "districts"], 72020: ["Pointe-Calumet", "districts"], 72025: ["Saint-Joseph-du-Lac", "districts"], 72032: ["Oka", "districts"], 72043: ["Saint-Placide", "districts"], 73005: ["Boisbriand", "districts"], 73010: ["Sainte-Thérèse", "districts"], 73015: ["Blainville", "districts"], 73035: ["Sainte-Anne-des-Plaines", "districts"], 74005: ["Mirabel", "districts"], 75005: ["Saint-Colomban", "districts"], 75017: ["Saint-Jérôme", "districts"], 75028: ["Sainte-Sophie", "districts"], 75040: ["Prévost", "districts"], 76008: ["Saint-André-d'Argenteuil", "districts"], 76020: ["Lachute", "districts"], 76043: ["Brownsburg-Chatham", "districts"], 77022: ["Sainte-Adèle", "districts"], 77035: ["Sainte-Anne-des-Lacs", "districts"], 77055: ["Lac-des-Seize-Îles", "districts"], 77060: ["Wentworth-Nord", "districts"], 78010: ["Val-David", "districts"], 78047: ["Saint-Faustin—Lac-Carré", "districts"], 78055: ["Montcalm", "districts"], 78070: ["Amherst", "districts"], 78095: ["Lac-Supérieur", "districts"], 78102: ["Mont-Tremblant", "districts"], 79078: ["Lac-des-Écorces", "districts"], 8053: ["Matane", "districts"], 81017: ["Gatineau", "districts"], 82005: ["L'Ange-Gardien", "districts"], 82015: ["Val-des-Monts", "districts"], 82020: ["Cantley", "districts"], 82025: ["Chelsea", "districts"], 82030: ["Pontiac", "districts"], 82035: ["La Pêche", "districts"], 83065: ["Maniwaki", "quartiers"], 85045: ["Saint-Bruno-de-Guigues", "districts"], 86042: ["Rouyn-Noranda", "districts"], 87058: ["Macamic", "districts"], 87090: ["La Sarre", "quartiers"], 88022: ["Barraute", "districts"], 89008: ["Val-d'Or", "districts"], 89015: ["Malartic", "districts"], 89040: ["Senneterre", "quartiers"], 90012: ["La Tuque", "districts"], 9077: ["Mont-Joli", "districts"], 93005: ["Desbiens", "quartiers"], 93012: ["Métabetchouan—Lac-à-la-Croix", "districts"], 93020: ["Hébertville", "districts"], 93030: ["Saint-Bruno", "districts"], 93035: ["Saint-Gédéon", "districts"], 93042: ["Alma", "districts"], 93045: ["Saint-Nazaire", "districts"], 93065: ["L'Ascension-de-Notre-Seigneur", "districts"], 93070: ["Saint-Henri-de-Taillon", "districts"], 94068: ["Saguenay", "districts"], 94235: ["Saint-Fulgence", "districts"], 94240: ["Saint-Honoré", "districts"], 94245: ["Saint-David-de-Falardeau", "districts"], 94255: ["Saint-Ambroise", "districts"], 96020: ["Baie-Comeau", "districts"], 96025: ["Pointe-Lebel", "districts"], 96030: ["Pointe-aux-Outardes", "districts"], 96040: ["Ragueneau", "districts"], 97007: ["Sept-Îles", "districts"], 99060: ["Eeyou Istchee Baie-James", "quartiers"], } # Check the names with (replace `CODE`): # ogrinfo -al -geom=NO boundaries/ca_qc_districts | grep -B6 CODE | grep NM_DIS | sort def district_namer(f): import boundaries type_id = f.get('NO_DIS') code = f.get('CO_MUNCP') name = f.get('NM_DIS') # Québec if code == 23027: return { # Hyphens. 'Cap-Rouge-Laurentien': 'Cap-Rouge—Laurentien', 'Chute-Montmorency-Seigneurial': 'Chute-Montmorency—Seigneurial', 'Lac-Saint-Charles-Saint-Émile': 'Lac-Saint-Charles—Saint-Émile', 'Montcalm-Saint-Sacrement': 'Montcalm—Saint-Sacrement', 'Saint-Louis-Sillery': 'Saint-Louis—Sillery', 'Saint-Roch-Saint-Sauveur': 'Saint-Roch—Saint-Sauveur', }.get(name, name) # Sherbrooke elif code == 43027: # https://cartes.ville.sherbrooke.qc.ca/monarrondissementenligne/ return { 1.10: 'Lac Magog', 1.20: 'Rock Forest', 1.30: 'Saint-Élie', 1.40: 'Brompton', 2.10: 'Hôtel-Dieu', 2.20: 'Desranleau', 2.30: 'Quatre-Saisons', 2.40: 'Pin-Solitaire', 3.10: 'Uplands', 3.20: 'Fairview', 4.10: 'Université', 4.20: 'Ascot', 4.30: 'Lac-des-Nations', 4.40: 'Golf', 4.50: 'Carrefour', }[type_id] # Longueuil elif code == 58227: return re.sub(r"\b(?:d'|de |du |des )", '', name) # Montréal elif code == 66023: return { 'Est (Pierrefonds-Roxboro)': 'Bois-de-Liesse', 'Ouest (Pierrefonds-Roxboro)': 'Cap-Saint-Jacques', 'St-Henri-Petite-Bourgogne-Pte-St-Charles': 'Saint-Henri—Petite-Bourgogne—Pointe-Saint-Charles', 'Étienne-Desmarteaux': 'Étienne-Desmarteau', # Articles. "d'Ahuntsic": 'Ahuntsic', 'de Bordeaux-Cartierville': 'Bordeaux-Cartierville', 'de Saint-Sulpice': 'Saint-Sulpice', 'du Sault-au-Récollet': 'Sault-au-Récollet', # Hyphens. "Champlain-L'Île-des-Soeurs": "Champlain—L'Île-des-Soeurs", 'Maisonneuve-Longue-Pointe': 'Maisonneuve—Longue-Pointe', 'Saint-Paul-Émard': 'Saint-Paul—Émard', }.get(name, name) # Pointe-Claire elif code == 66097: # Check if required with: # ogrinfo -al -geom=NO boundaries/ca_qc_districts | grep '/ ' return name.replace('/ ', '/') # Gatineau elif code == 81017: return { # Hyphens. 'de Hull-Val-Tétreau': 'de Hull—Val-Tétreau', 'de Saint-Raymond-Vanier': 'de Saint-Raymond—Vanier', 'de Wright-Parc-de-la-Montagne': 'de Wright—Parc-de-la-Montagne', 'du Plateau-Manoir-des-Trembles': 'du Plateau—Manoir-des-Trembles', }.get(name, name) else: if name: # Check if required with: # ogrinfo -al -geom=NO boundaries/ca_qc_districts | grep ' no ' if 'District no ' in name: return f.get('NM_DIS').replace(' no ', ' ') # Baie-Saint-Paul else: return boundaries.clean_attr('NM_DIS')(f) elif f.get('MODE_SUFRG') == 'Q': return 'Quartier %s' % int(type_id) else: return 'District %s' % int(type_id) def borough_namer(f): import boundaries code = f.get('CO_MUNCP') name = f.get('NM_ARON') # Sherbrooke if code == 43027: return 'Arrondissement %s' % int(f.get('NO_ARON')) # Montréal elif code == 66023: return { 'Le Plateau-Mont-Royal': 'Plateau-Mont-Royal', 'Le Sud-Ouest': 'Sud-Ouest', 'Pierrefond-Roxboro': 'Pierrefonds-Roxboro', 'Rosemont--La-Petite-Patrie': 'Rosemont—La Petite-Patrie', }.get(name, boundaries.clean_attr('NM_ARON')(f)) else: return boundaries.clean_attr('NM_ARON')(f) # Check if required with: # ogrinfo -al -geom=NO boundaries/ca_qc_districts | grep -A9 ' 1\.10' def district_ider(f): if f.get('CO_MUNCP') in (43027, 66023): # Sherbrooke, Montréal return f.get('NO_DIS') # e.g. "1.10" else: return int(f.get('NO_DIS')) for geographic_code, (name, type) in sets.items(): geographic_codes = [geographic_code] boundaries.register('%s %s' % (name, type), domain='%s, QC' % name, last_updated=date(2017, 11, 30), name_func=district_namer, id_func=district_ider, authority='Directeur général des élections du Québec', licence_url='https://www.electionsquebec.qc.ca/francais/conditions-d-utilisation-de-notre-site-web.php', encoding='utf-8', extra={'division_id': 'ocd-division/country:ca/csd:24%05d' % geographic_code}, is_valid_func=lambda f, geographic_codes=geographic_codes: int(f.get('CO_MUNCP')) in geographic_codes, notes='Load the shapefile manually:\nfab alpheus update_boundaries:args="-r --merge combine -d data/shapefiles/public/boundaries/ca_qc_districts"', ) boundaries.register('Paroisse de Plessisville districts', domain='Plessisville, QC', last_updated=date(2017, 11, 30), name_func=district_namer, id_func=district_ider, authority='Directeur général des élections du Québec', licence_url='https://www.electionsquebec.qc.ca/francais/conditions-d-utilisation-de-notre-site-web.php', encoding='utf-8', extra={'division_id': 'ocd-division/country:ca/csd:2432045'}, is_valid_func=lambda f: int(f.get('CO_MUNCP')) == 32045, ) # Check the names with (replace `CODE`): # ogrinfo -al -geom=NO boundaries/ca_qc_districts | grep -B3 CODE | sort | uniq # Check the identifiers with: # ogrinfo -al -geom=NO boundaries/ca_qc_districts | grep -B4 CODE municipalities_with_boroughs = [ { 'name': 'Lévis', 'geographic_code': 25213, 'boroughs': { 'ocd-division/country:ca/csd:2425213/borough:1': 'Desjardins', 'ocd-division/country:ca/csd:2425213/borough:2': 'Les Chutes-de-la-Chaudière-Est', 'ocd-division/country:ca/csd:2425213/borough:3': 'Les Chutes-de-la-Chaudière-Ouest', }, }, { 'name': 'Longueuil', 'geographic_code': 58227, 'boroughs': { 'ocd-division/country:ca/csd:2458227/borough:1': 'Le Vieux-Longueuil', 'ocd-division/country:ca/csd:2458227/borough:2': 'Greenfield Park', 'ocd-division/country:ca/csd:2458227/borough:3': 'Saint-Hubert', }, }, { 'name': 'Montréal', 'geographic_code': 66023, 'boroughs': { 'ocd-division/country:ca/csd:2466023/borough:1': "Ahuntsic-Cartierville", 'ocd-division/country:ca/csd:2466023/borough:2': "Anjou", 'ocd-division/country:ca/csd:2466023/borough:3': "Côte-des-Neiges—Notre-Dame-de-Grâce", 'ocd-division/country:ca/csd:2466023/borough:4': "Lachine", 'ocd-division/country:ca/csd:2466023/borough:5': "LaSalle", 'ocd-division/country:ca/csd:2466023/borough:6': "L'Île-Bizard—Sainte-Geneviève", 'ocd-division/country:ca/csd:2466023/borough:7': "Mercier—Hochelaga-Maisonneuve", 'ocd-division/country:ca/csd:2466023/borough:8': "Montréal-Nord", 'ocd-division/country:ca/csd:2466023/borough:9': "Outremont", 'ocd-division/country:ca/csd:2466023/borough:10': "Pierrefonds-Roxboro", 'ocd-division/country:ca/csd:2466023/borough:11': "Plateau-Mont-Royal", 'ocd-division/country:ca/csd:2466023/borough:12': "Rivière-des-Prairies—Pointe-aux-Trembles", 'ocd-division/country:ca/csd:2466023/borough:13': "Rosemont—La Petite-Patrie", 'ocd-division/country:ca/csd:2466023/borough:14': "Saint-Laurent", 'ocd-division/country:ca/csd:2466023/borough:15': "Saint-Léonard", 'ocd-division/country:ca/csd:2466023/borough:16': "Sud-Ouest", 'ocd-division/country:ca/csd:2466023/borough:17': "Verdun", 'ocd-division/country:ca/csd:2466023/borough:18': "Ville-Marie", 'ocd-division/country:ca/csd:2466023/borough:19': "Villeray—Saint-Michel—Parc-Extension", }, }, { 'name': 'Québec', 'geographic_code': 23027, 'boroughs': { 'ocd-division/country:ca/csd:2423027/borough:1': 'La Cité-Limoilou', 'ocd-division/country:ca/csd:2423027/borough:2': 'Les Rivières', 'ocd-division/country:ca/csd:2423027/borough:3': 'Sainte-Foy—Sillery—Cap-Rouge', 'ocd-division/country:ca/csd:2423027/borough:4': 'Charlesbourg', 'ocd-division/country:ca/csd:2423027/borough:5': 'Beauport', 'ocd-division/country:ca/csd:2423027/borough:6': 'La Haute-Saint-Charles', }, }, { 'name': 'Saguenay', 'geographic_code': 94068, 'boroughs': { 'ocd-division/country:ca/csd:2494068/borough:1': 'Chicoutimi', 'ocd-division/country:ca/csd:2494068/borough:2': 'Jonquière', 'ocd-division/country:ca/csd:2494068/borough:3': 'La Baie', }, }, { 'name': 'Sherbrooke', 'geographic_code': 43027, 'boroughs': { 'ocd-division/country:ca/csd:2443027/borough:1': 'Arrondissement 1', 'ocd-division/country:ca/csd:2443027/borough:2': 'Arrondissement 2', 'ocd-division/country:ca/csd:2443027/borough:3': 'Arrondissement 3', 'ocd-division/country:ca/csd:2443027/borough:4': 'Arrondissement 4', }, }, ] # @see http://www.toponymie.gouv.qc.ca/ct/toponymie-municipale/municipalites-arrondissements/arrondissement.aspx # @see http://www.mamrot.gouv.qc.ca/repertoire-des-municipalites/fiche/arrondissement/?tx_mamrotrepertoire_pi1[order]=asc_nom_mun for municipality in municipalities_with_boroughs: geographic_code = municipality['geographic_code'] geographic_name = municipality['name'] for division_id, name in municipality['boroughs'].items(): subdivision_id = int(division_id.rsplit(':', 1)[-1]) boundaries.register('%s districts' % name, domain='%s, %s, QC' % (name, geographic_name), last_updated=date(2017, 11, 30), name_func=district_namer, id_func=district_ider, authority='Directeur général des élections du Québec', licence_url='https://www.electionsquebec.qc.ca/francais/conditions-d-utilisation-de-notre-site-web.php', encoding='utf-8', extra={'division_id': division_id}, is_valid_func=lambda f, geographic_code=geographic_code, subdivision_id=subdivision_id: int(f.get('CO_MUNCP')) == geographic_code and int(f.get('NO_ARON')) == subdivision_id, notes='Load the shapefile manually:\nfab alpheus update_boundaries:args="-r --merge combine -d data/shapefiles/public/boundaries/ca_qc_districts"', ) boundaries.register('%s boroughs' % geographic_name, domain='%s, QC' % geographic_name, last_updated=date(2017, 11, 30), name_func=borough_namer, id_func=lambda f: int(f.get('NO_ARON')), authority='Directeur général des élections du Québec', licence_url='https://www.electionsquebec.qc.ca/francais/conditions-d-utilisation-de-notre-site-web.php', encoding='utf-8', extra={'division_id': 'ocd-division/country:ca/csd:24%05d' % geographic_code}, is_valid_func=lambda f, geographic_code=geographic_code: int(f.get('CO_MUNCP')) == geographic_code, notes='Load the shapefile manually:\nfab alpheus update_boundaries:args="-r --merge combine -d data/shapefiles/public/boundaries/ca_qc_districts"', )
42.877005
186
0.61204
0
0
0
0
0
0
0
0
14,555
0.601049
198370b8aa4515542204d0344e7d286fb2f76907
1,803
py
Python
pdbfairy/commands/compare_interactions.py
dannyroberts/pdbfairy
2cefd4a5e6c40f32e6fa3974ffd595fc336c582b
[ "BSD-3-Clause" ]
null
null
null
pdbfairy/commands/compare_interactions.py
dannyroberts/pdbfairy
2cefd4a5e6c40f32e6fa3974ffd595fc336c582b
[ "BSD-3-Clause" ]
null
null
null
pdbfairy/commands/compare_interactions.py
dannyroberts/pdbfairy
2cefd4a5e6c40f32e6fa3974ffd595fc336c582b
[ "BSD-3-Clause" ]
null
null
null
import difflib import io import click from pdbfairy import utils from pdbfairy.commands import find_interactions @click.argument('pdb_file_1') @click.argument('pdb_file_2') @click.option('--max-distance', default=find_interactions.MAX_DISTANCE, help=( "The distance in Angstroms under which atoms should " "be considered to interact (default {})" .format(find_interactions.MAX_DISTANCE))) def compare_interactions(pdb_file_1, pdb_file_2, max_distance): """ Show how find-interactions differs for PDB_FILE_1 and PDB_FILE_2 """ structure_1 = utils.load_pdb_file(pdb_file_1) structure_2 = utils.load_pdb_file(pdb_file_2) with utils.capture() as (interactions_text_1, _): find_interactions.print_interactions(structure_1, max_distance) with utils.capture() as (interactions_text_2, _): find_interactions.print_interactions(structure_2, max_distance) differ = difflib.Differ() diff = list(differ.compare( interactions_text_1.getvalue().splitlines()[5:], interactions_text_2.getvalue().splitlines()[5:], )) print("PDB file name 1\t{}".format(structure_1.id)) print("PDB file name 2\t{}".format(structure_2.id)) print("Distance cutoff\t{}".format(max_distance)) print() print() print() print('File\t{}'.format(diff[0].strip())) for line in sorted(diff[1:]): marker, rest = line[:2], line[2:] if marker == '- ': print('{}\t{}'.format(structure_1.id, rest)) elif marker == '+ ': print('{}\t{}'.format(structure_2.id, rest)) elif marker == ' ': print('both\t{}'.format(rest)) elif marker in ('', '? '): pass else: raise ValueError("This should never happen: {!r}".format(marker))
33.388889
78
0.653356
0
0
0
0
1,685
0.934554
0
0
362
0.200776
1983c2bf22bdcb42a662ebdbf2a359de7f422d6f
444
py
Python
accelerator/migrations/023_alter_topics_field_office_hours.py
masschallenge/django-accelerator
8af898b574be3b8335edc8961924d1c6fa8b5fd5
[ "MIT" ]
6
2017-06-14T19:34:01.000Z
2020-03-08T07:16:59.000Z
accelerator/migrations/023_alter_topics_field_office_hours.py
masschallenge/django-accelerator
8af898b574be3b8335edc8961924d1c6fa8b5fd5
[ "MIT" ]
160
2017-06-20T17:12:13.000Z
2022-03-30T13:53:12.000Z
accelerator/migrations/023_alter_topics_field_office_hours.py
masschallenge/django-accelerator
8af898b574be3b8335edc8961924d1c6fa8b5fd5
[ "MIT" ]
null
null
null
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accelerator', '0022_add_meeting_info_on_office_hour_model'), ] operations = [ migrations.AlterField( model_name='mentorprogramofficehour', name='topics', field=models.CharField(blank=True, default='', max_length=2000), ), ]
23.368421
76
0.655405
359
0.808559
0
0
0
0
0
0
92
0.207207
198549dbef342bfbbd642fd61a76b181c129ac11
1,085
py
Python
guanabara/mundo1/ex018.py
thekilian/Python-pratica
875661addd5b8eb4364bc638832c7ab55dcefce4
[ "MIT" ]
null
null
null
guanabara/mundo1/ex018.py
thekilian/Python-pratica
875661addd5b8eb4364bc638832c7ab55dcefce4
[ "MIT" ]
null
null
null
guanabara/mundo1/ex018.py
thekilian/Python-pratica
875661addd5b8eb4364bc638832c7ab55dcefce4
[ "MIT" ]
null
null
null
# 018 - Faça um programa que leia um ângulo qualquer e mostre na tela o valor do seno, cosseno e tangente desse ângulo. ''' from math import sin, cos, tan ang = float(input('Digite um ângulo: ')) sen = sin(ang) cos = cos(ang) tan = tan(ang) print('Ângulo de {}°: \n Seno = {:.2f} \n Cosseno = {:.2f} \n Tangente = {:.2f}'.format(ang, sen, cos, tan)) ''' ''' # apenas faltou conventer para radiano: import math ang = float(input('Digite um ângulo: ')) sen = math.sin(math.radians(ang)) cos = math.cos(math.radians(ang)) tan = math.tan(math.radians(ang)) print('O ângulo de {} tem o SENO de {:.2f}'.format(ang, sen)) print('O ângulo de {} tem o COSSENO de {:.2f}'.format(ang, cos)) print('O ângulo de {} tem a TANGENTE de {:.2f}'.format(ang, tan)) ''' # importando somente o que vamos utilizar: sin, cos, tan, radians from math import sin, cos, tan, radians ang = float(input('Digite um ângulo: ')) sen = sin(radians(ang)) cos = cos(radians(ang)) tan = tan(radians(ang)) print('Ângulo de {}°: \n Seno = {:.2f} \n Cosseno = {:.2f} \n Tangente = {:.2f}'.format(ang, sen, cos, tan))
31
119
0.648848
0
0
0
0
0
0
0
0
922
0.839709
198848a18a09b75e39b55e572e9958bb26729aae
1,174
py
Python
models/basic_module.py
matsu911/CQTNet
e775f53fd91bbb9583d6640ae4e36f49031d1efd
[ "MIT" ]
25
2020-04-10T05:43:49.000Z
2022-03-28T02:25:44.000Z
models/basic_module.py
matsu911/CQTNet
e775f53fd91bbb9583d6640ae4e36f49031d1efd
[ "MIT" ]
2
2021-02-23T03:30:50.000Z
2021-06-28T09:02:38.000Z
models/basic_module.py
matsu911/CQTNet
e775f53fd91bbb9583d6640ae4e36f49031d1efd
[ "MIT" ]
7
2020-04-10T05:43:51.000Z
2021-12-23T09:34:44.000Z
import torch from torch import nn import torchvision import torch.nn.functional as F import time import os class BasicModule(torch.nn.Module): """ 封装了nn.Module,主要是提供了save和load两个方法 """ def __init__(self): super(BasicModule, self).__init__() self.model_name = str(type(self)) def load(self, path): """ 可加载指定路径的模型 """ self.load_state_dict(torch.load(path)) def save(self, name=None): """ 保存模型,默认使用“模型名字+时间”作为文件名 """ prefix = 'check_points/' + self.model_name +name+ '/' if not os.path.isdir(prefix): os.mkdir(prefix) name = time.strftime(prefix + '%m%d_%H:%M:%S.pth') print('model name', name.split('/')[-1] ) torch.save(self.state_dict(), name) torch.save(self.state_dict(), prefix+'latest.pth') return name def get_optimizer(self, lr, weight_decay): return torch.optim.Adam(self.parameters(), lr=lr, weight_decay=weight_decay) def load_latest(self, notes): path = 'check_points/' + self.model_name +notes+ '/latest.pth' self.load_state_dict(torch.load(path))
29.35
84
0.602215
1,159
0.915482
0
0
0
0
0
0
313
0.247235
1989abd5efbf0b7dfe6d6083f611454b62427f76
654
py
Python
exp1_bot_detection/Cresci/Cresci.py
GabrielHam/SATAR_Twitter_Bot_Detection_with_Self-supervised_User_Representation_Learning
ac73e5deb9d748f02d1396d1458e716408470cc9
[ "MIT" ]
5
2021-08-10T14:15:18.000Z
2022-03-09T07:06:19.000Z
exp1_bot_detection/Cresci/Cresci.py
GabrielHam/SATAR_Twitter_Bot_Detection_with_Self-supervised_User_Representation_Learning
ac73e5deb9d748f02d1396d1458e716408470cc9
[ "MIT" ]
null
null
null
exp1_bot_detection/Cresci/Cresci.py
GabrielHam/SATAR_Twitter_Bot_Detection_with_Self-supervised_User_Representation_Learning
ac73e5deb9d748f02d1396d1458e716408470cc9
[ "MIT" ]
null
null
null
import math result = [1] * 4355 list = [] flag = '' def issub(strrr): global list cnt = 0 for dna in list: if strrr in dna: cnt = cnt + 1 return cnt def tryy(strrr): num = issub(strrr) if num > 1: for tmp in range(num): result[tmp] = max(result[tmp], len(strrr)) tryy(strrr + 'A') tryy(strrr + 'C') tryy(strrr + 'T') Sigma = ['A', 'C', 'T'] f = open('./cresci_text/finalTest1.txt', 'r', encoding='UTF-8') for line in f: list.append(line[line.find(' ', 2) + 1: -1]) f.close() for substring in Sigma: tryy(substring) for i in result: print(i)
15.571429
63
0.524465
0
0
0
0
0
0
0
0
63
0.09633
198aafa829b773ab465bf52f7c98972087fa1385
3,119
py
Python
examples/smiley_face.py
Markichu/PythonAutoNifty
ab646601058297b6bfe14332f17b836ee3dfbe69
[ "MIT" ]
null
null
null
examples/smiley_face.py
Markichu/PythonAutoNifty
ab646601058297b6bfe14332f17b836ee3dfbe69
[ "MIT" ]
6
2021-11-24T00:48:57.000Z
2022-03-17T07:51:36.000Z
examples/smiley_face.py
Markichu/PythonAutoNifty
ab646601058297b6bfe14332f17b836ee3dfbe69
[ "MIT" ]
null
null
null
import random from pyautonifty.constants import DRAWING_SIZE, YELLOW, BLACK, MAGENTA, BLUE from pyautonifty.pos import Pos from pyautonifty.drawing import Drawing from pyautonifty.renderer import Renderer def smiley_face(drawing): # Set a background colour to be used for the drawing background_colour = MAGENTA # Add a blue square that is not filled in around where the smiley face will be square_position = Pos(DRAWING_SIZE / 2, DRAWING_SIZE / 2) square_width = DRAWING_SIZE / 1.5 square_colour = BLUE square_brush_radius = DRAWING_SIZE / 64 square_filled = False # Set the position of the yellow face itself in the middle of the drawing (typically 500, 500) face_position = Pos(DRAWING_SIZE / 2, DRAWING_SIZE / 2) face_radius = DRAWING_SIZE / 4 # 250 face_colour = YELLOW # Yellow in RGBA (255, 255, 0, 1) # Create the eyes eye_horizontal_offset = DRAWING_SIZE / 10 eye_vertical_offset = DRAWING_SIZE / 16 left_eye_position = face_position - Pos(eye_horizontal_offset, eye_vertical_offset) right_eye_position = face_position - Pos(-eye_horizontal_offset, eye_vertical_offset) eye_radius = DRAWING_SIZE / 32 eye_colour = BLACK # Black in RGBA (0, 0, 0, 1) # Create the curve for the smile smile_horizontal_offset = DRAWING_SIZE / 8 smile_vertical_offset = DRAWING_SIZE / 12 smile_starting_point = face_position + Pos(-smile_horizontal_offset, smile_vertical_offset) smile_control_point = face_position + Pos(0, smile_vertical_offset * 3) smile_ending_point = face_position + Pos(smile_horizontal_offset, smile_vertical_offset) smile_points = [smile_starting_point, smile_control_point, smile_ending_point] smile_brush_radius = DRAWING_SIZE / 64 smile_colour = BLACK # Black in RGBA (0, 0, 0, 1) # Put it all together in a drawing using chained methods drawing.add_background(background_colour) \ .add_rounded_square(square_position, square_width, square_colour, square_brush_radius, square_filled) \ .add_point(face_position, face_colour, face_radius) \ .add_point(left_eye_position, eye_colour, eye_radius) \ .add_point(right_eye_position, eye_colour, eye_radius) \ .add_general_bezier_curve(smile_points, smile_colour, smile_brush_radius) return drawing if __name__ == "__main__": example_drawing = smiley_face(Drawing()) output_data = example_drawing.to_nifty_import() # Replace previous canvas contents in Nifty.Ink print(f"Lines: {len(example_drawing)}, " f"Points: {sum([len(line['points']) for line in example_drawing])}, " f"Size: {(len(output_data) / 1024.0 ** 2):.2f}MB") with open("output.txt", "w") as file: file.write(output_data) # Init render class. renderer = Renderer() # Render in a very accurate (but slower) way. renderer.render(example_drawing, filename="smiley_face_%Y_%m_%d_%H-%M-%S-%f.png", simulate=True, allow_transparency=True, proper_line_thickness=True, draw_as_bezier=True, step_size=10)
43.319444
114
0.721064
0
0
0
0
0
0
0
0
750
0.240462
198b6c8bdf9c4c45a62fc10ae148a99e4911a2b1
1,074
py
Python
cumulusci/tests/test_schema.py
davisagli/CumulusCI
fd74c324ad3ff662484b159395c639879011e711
[ "BSD-3-Clause" ]
109
2015-01-20T14:28:48.000Z
2018-08-31T12:12:39.000Z
cumulusci/tests/test_schema.py
davisagli/CumulusCI
fd74c324ad3ff662484b159395c639879011e711
[ "BSD-3-Clause" ]
365
2015-01-07T19:54:25.000Z
2018-09-11T15:10:02.000Z
cumulusci/tests/test_schema.py
davisagli/CumulusCI
fd74c324ad3ff662484b159395c639879011e711
[ "BSD-3-Clause" ]
125
2015-01-17T16:05:39.000Z
2018-09-06T19:05:00.000Z
import json import yaml from jsonschema import validate from cumulusci.utils.yaml import cumulusci_yml class TestSchema: def test_schema_validates(self, cumulusci_test_repo_root): schemapath = ( cumulusci_test_repo_root / "cumulusci/schema/cumulusci.jsonschema.json" ) with open(schemapath) as f: schema = json.load(f) with open(cumulusci_test_repo_root / "cumulusci.yml") as f: data = yaml.safe_load(f) assert validate(data, schema=schema) is None def test_schema_is_current(self, cumulusci_test_repo_root): current_schema = cumulusci_yml.CumulusCIRoot.schema() schemapath = ( cumulusci_test_repo_root / "cumulusci/schema/cumulusci.jsonschema.json" ) with open(schemapath) as f: saved_schema = json.load(f) assert current_schema == saved_schema, ( "The models used to validate cumulusci.yml do not match cumulusci.jsonschema.json. " "Use `make schema` to update the jsonschema file." )
32.545455
96
0.666667
966
0.899441
0
0
0
0
0
0
237
0.22067
198b7bfde744c3980b7b517559c0d495392afa36
7,650
py
Python
luxon/core/networking/sock.py
HieronymusCrouse/luxon
b0b08c103936adcbb3dd03b1701d44a65de8f61e
[ "BSD-3-Clause" ]
7
2018-02-27T00:18:02.000Z
2019-05-16T16:57:00.000Z
luxon/core/networking/sock.py
HieronymusCrouse/luxon
b0b08c103936adcbb3dd03b1701d44a65de8f61e
[ "BSD-3-Clause" ]
47
2018-01-23T13:49:28.000Z
2019-06-06T13:14:59.000Z
luxon/core/networking/sock.py
HieronymusCrouse/luxon
b0b08c103936adcbb3dd03b1701d44a65de8f61e
[ "BSD-3-Clause" ]
14
2018-01-15T08:47:11.000Z
2019-12-27T12:05:41.000Z
# -*- coding: utf-8 -*- # Copyright (c) 2019-2020 Christiaan Frans Rademan <[email protected]>. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # * Neither the name of the copyright holders nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. import ssl import struct import socket import select import pickle from multiprocessing import Lock def recv_pickle(sock): header = sock.read(8) length = struct.unpack('!Q', header)[0] payload = sock.read(length) return pickle.loads(payload) def send_pickle(sock, data): payload = pickle.dumps(data, 4) sock.write(struct.pack('!Q', len(payload)) + payload) return True class Socket(object): def __init__(self, sock, addr=None): self._sock_lock = Lock() self._transaction_lock = Lock() self._sock = sock self._addr = addr self._closed = False def _check_closed(self): if self._closed: raise ConnectionError('Connection closed') @property def raw_socket(self): return self._sock @property def addr(self): return self._addr def setblocking(self, value): self._check_closed() try: self._sock_lock.acquire() self._sock.setblocking(bool(value)) finally: self._sock_lock.release() def settimeout(self, value): self._check_closed() try: self._sock_lock.acquire() try: self._sock.setblocking(True) self._sock.settimeout(float(value)) except ValueError: self._sock.settimeout(None) finally: self._sock_lock.release() def fileno(self): self._check_closed() try: self._sock_lock.acquire() return self._sock.fileno() finally: self._sock_lock.release() def read(self, length=2, timeout=None): self._check_closed() if timeout and float(timeout) < float(0): timeout = None self._sock_lock.acquire() try: buf = b'' while True: data = b'' try: if timeout is not None and timeout <= 0: raise socket.timeout('Socket Read Timeout') # Should be ready to read try: select.select([self._sock], [], [], timeout) except ValueError: return b'' data = self._sock.recv(length) if data: buf += data length -= len(data) else: self._close() raise ConnectionError('Connection closed') if length == 0: return buf try: select.select([self._sock], [], [], timeout) except ValueError: return b'' if timeout: timeout -= timeout except (BlockingIOError, ssl.SSLWantReadError): # Resource temporarily unavailable (errno EWOULDBLOCK) try: select.select([self._sock], [], [], timeout) except ValueError: return b'' if timeout: timeout -= timeout finally: self._sock_lock.release() def write(self, data, timeout=None): self._check_closed() totalsent = 0 data_size = len(data) if timeout and float(timeout) < float(0): timeout = None try: self._sock_lock.acquire() while True: try: while totalsent < data_size: select.select([], [self._sock], [], timeout) if timeout is not None and timeout <= 0: raise socket.timeout('Socket Write Timeout') sent = self._sock.send(data[totalsent:]) if sent == 0: raise RuntimeError("socket connection broken") totalsent += sent return totalsent except (BlockingIOError, ssl.SSLWantWriteError): # Resource temporarily unavailable (errno EWOULDBLOCK) select.select([], [self._sock], [], timeout) if timeout: timeout -= timeout except BrokenPipeError: self._close() raise ConnectionError('Connection closed') finally: self._sock_lock.release() def recv(self, max_size=64): self._check_closed() try: self._sock_lock.acquire() return self._sock.recv(max_size) finally: self._sock_lock.release() def send(self, data): self._check_closed() try: self._sock_lock.acquire() return self._sock.send(data) finally: self._sock_lock.release() def sendall(self, data): self._check_closed() try: self._sock_lock.acquire() return self._sock.sendall(data) finally: self._sock_lock.release() def _close(self): self._closed = True try: self._sock.send(b'') except Exception: pass try: return self._sock.close() except Exception: pass def close(self): try: self._sock_lock.acquire() return self._close() finally: try: self._sock_lock.release() except ValueError: pass def __enter__(self): self._check_closed() self._transaction_lock.acquire() return self def __exit__(self, exception, value, traceback): self._transaction_lock.release() def Pipe(): sock1, sock2 = socket.socketpair() sock1.setblocking(False) sock2.setblocking(False) return (Socket(sock1), Socket(sock2),)
33.116883
79
0.555817
5,490
0.717647
0
0
116
0.015163
0
0
1,858
0.242876
198cce97dd571e2e8a46ea89d848568e280efd25
739
py
Python
merge.py
Graze-Lab/SDE-of-species
c53ca05ff840e722fec3d71b5794057713d221f8
[ "MIT" ]
null
null
null
merge.py
Graze-Lab/SDE-of-species
c53ca05ff840e722fec3d71b5794057713d221f8
[ "MIT" ]
null
null
null
merge.py
Graze-Lab/SDE-of-species
c53ca05ff840e722fec3d71b5794057713d221f8
[ "MIT" ]
null
null
null
#! /usr/bin/env python3 "A script to perform the linear regression and create the plot." # Python program to # demonstrate merging of # two files # Creating a list of filenames filenames = ['A.591-search-immune-dmel-FlyBase_IDs.txt', 'B.432_search-defense-dmel-FlyBase_IDs.txt'] # Open file3 in write mode with open('C.search-immune-defense-dmel-FlyBase_IDs.txt', 'w') as outfile: # Iterate through list for names in filenames: # Open each file in read mode with open(names) as infile: # read the data from file1 and # file2 and write it in file3 outfile.write(infile.read()) # Add '\n' to enter data of file2 # from next line outfile.write("\n")
26.392857
101
0.653586
0
0
0
0
0
0
0
0
494
0.668471
198e2ea49efeb318a688dffd17a8ff15bcc42c01
13
py
Python
dmm/dmm_data/__init__.py
voghoei/Different-Models
ede4a48a7960ccb4a8519bfb77d234328f2936d1
[ "MIT" ]
11
2017-11-16T13:01:47.000Z
2021-12-26T20:07:24.000Z
optvaedatasets/__init__.py
rahulk90/inference_introspection
102b3cf72abae8d66718b945df365edd4a23a62d
[ "MIT" ]
null
null
null
optvaedatasets/__init__.py
rahulk90/inference_introspection
102b3cf72abae8d66718b945df365edd4a23a62d
[ "MIT" ]
null
null
null
all=['load']
6.5
12
0.538462
0
0
0
0
0
0
0
0
6
0.461538
19901da7c7a1960491cefcc10a95446ff706e6be
10,996
py
Python
game/sdktools/python/global/lib/site-packages/python_sfm.py
Andrej730/python-sfm
dc693b9d221fa046000a41ffdbb59b5ddca6d9dc
[ "MIT" ]
null
null
null
game/sdktools/python/global/lib/site-packages/python_sfm.py
Andrej730/python-sfm
dc693b9d221fa046000a41ffdbb59b5ddca6d9dc
[ "MIT" ]
null
null
null
game/sdktools/python/global/lib/site-packages/python_sfm.py
Andrej730/python-sfm
dc693b9d221fa046000a41ffdbb59b5ddca6d9dc
[ "MIT" ]
null
null
null
# encoding: utf-8 import os import pydoc import inspect import PySide import vs import sfm import sfmApp class SFMElement(object): def __init__(self, element): self._original = element @property def name(self): return self._original.GetName() @property def attributes(self): return list_attrs(self._original) @property def attributes_dict(self): attributes = self.attributes return {a.name: a for a in attributes} class SFMShot: def __init__(self): self._original = sfm.GetCurrentShot() self.animsets = [SFMAnimationSet(animset) for animset in self._original.animationSets] # not useful @property def attributes(self): return list_attrs(self._original) class SFMAnimationSet: def __init__(self, animset): self._original = animset def find_control_by_name(self, control_name): control = self._original.FindControl(control_name.encode('utf-8')) if control: control = SFMControl(control) return control @property def name(self): return self._original.name.GetValue() @property def game_model(self): return SFMGameModel(self._original.gameModel) @property def attributes(self): return list_attrs(self._original) class SFMControl(SFMElement): @property def channels(self): if self._original.GetTypeString()=='DmElement': if self._original.HasAttribute("rightvaluechannel"): channels = self._original.rightvaluechannel, \ self._original.leftvaluechannel else: channels = self._original.channel,None elif self._original.GetTypeString()=='DmeTransformControl': channels = self._original.positionChannel, \ self._original.orientationChannel return [SFMChannel(channel) if channel else None for channel in channels] def copy_logs_to_control(self, to_control): if not isinstance(to_control, SFMControl): raise Exception(str(to_control) + ' is not SFMControl type.') channels = zip(self.channels, to_control.channels) for from_channel, to_channel in channels: if not from_channel or not to_channel: continue to_channel.values = from_channel.values to_channel.times = from_channel.times class SFMChannel(SFMElement): @property def values(self): return list(self._original.log.GetLayer(0).values) @values.setter def values(self, values): values = list(values) log_values = self._original.log.GetLayer(0).values try: log_values.clear() except AttributeError: # for example, floatarray doesnt have clear method for i in range(log_values.Count()): del log_values[0] for value in values: log_values.append(value) @property def times(self): # actual times is CDnAttrubuteType, GetTypeString() = 'time_array' # has functions: count, insert, append, clear return list(self._original.log.GetLayer(0).times) @times.setter def times(self, times): # print(times) # log_times = self._original.log.GetLayer(0).times # print log_times.count() # self._original.log.GetLayer(0).times.clear() # print log_times.count() # print log_times.insert(1, vs.DmeTime_t(5.0)) # # times = list(times) # sfm.SetOperationMode("Record") # self._original.log.GetLayer(0).times.clear() log_times = self._original.log.GetLayer(0).times log_times.clear() for value in times: log_times.append(value) # sfm.SetOperationMode("Pass") class SFMGameModel(SFMElement): def __init__(self, gamemodel): self._original = gamemodel @property def override_materials(self): try: self._original.materials return True except AttributeError: return False @property def materials(self): try: return [SFMMaterial(mat) for mat in self._original.materials] except AttributeError: return None # not useful @property def attributes(self): return list_attrs(self._original) class SFMMaterial: def __init__(self, material): self._original = material @property def name(self): return self._original.GetValue('name') @property def attributes(self): return list_attrs(self._original) def copy_attributes_to_material(self, material): if not isinstance(material, SFMMaterial): raise Exception(str(material) + ' is not SFMMaterial type.') if not isinstance(material._original, vs.movieobjects.CDmeMaterial): raise Exception('SFMMaterial._original is not CDmeMaterial instance.') self._original.CopyAttributesTo(material._original) class SFMAttribute(object): def __init__(self, attribute): self._original = attribute @property def name(self): return self._original.GetName() @property def value(self): return self._original.GetValue() @value.setter def value(self, v): return self._original.SetValue(v) class SFMElementHandle: def __init__(self, element_handle): self._original = element_handle element = vs.g_pDataModel.GetElement(element_handle) self.element = SFMElement(element) def get_next(self): return vs.g_pDataModel.NextAllocatedElement(self._original) def list_attrs(o): current_attribute = o.FirstAttribute() attributes = [] while current_attribute is not None: attributes.append(SFMAttribute(current_attribute)) current_attribute = current_attribute.NextAttribute() return attributes def getActiveControlsList(): animset = sfm.GetCurrentAnimationSet() c = sfmApp.GetDocumentRoot().settings.graphEditorState.activeControlList return c def getAnimationSetByName(name): shot = sfm.GetCurrentShot() for animset in shot.animationSets: if animset.name.GetValue() == name: return SFMAnimationSet(animset) def getMaterialByName(name, animset = None): if not animset: animset = sfm.GetCurrentAnimationSet() for material in animset.gameModel.materials: if material.GetValue('name') == name: return SFMMaterial def save_sfm_elements(): element_handle = vs.g_pDataModel.FirstAllocatedElement() fo = open('list_of_elements.txt', 'w') while True: eh = python_sfm.SFMElementHandle(element_handle) el = eh.element print el == None try: fo.write(el.name + '\n') except AttributeError: break element_handle = eh.get_next() fo.close() def docs_save_object(o): # What i've tried to get hidden attributes that didn't worked: # inspect.getmembers, o.__dict__ if inspect.ismodule(o): name = o.__name__ else: name = type(o).__name__ f = open('help/docs/' + name + '.txt', 'w') s = pydoc.plain(pydoc.render_doc(o)) f.write(s) f.close() f = open('help/dir/' + name + '.txt', 'w') for line in sorted(dir(o)): f.write(str(line) + '\n') f.close() try: attributes = list_attrs(o) f = open('help/attr/' + name + '.txt', 'w') f.write('Listed only attributes that had a name.\n\n') for attr in attributes: if attr.name.strip(): f.write(attr.name + '\n') f.close() except AttributeError: print 'Could not find attributes for ' + str(o) def docs_create_folders(): folders = ['help/docs/', 'help/dir/', 'help/attr/'] for folder in folders: if not os.path.exists(folder): os.makedirs(folder) def motion_editor_refresh(): n = sfmApp.GetHeadTimeInSeconds() sfmApp.SetHeadTimeInSeconds(-2) sfmApp.SetHeadTimeInSeconds(n) def set_override_materials(override=True, jump=False): """Toggle override materials for current animation set by emulating clicking on "Add / Remove Override Materials" menu button""" qApp = PySide.QtGui.QApplication.instance() top = qApp.topLevelWidgets() override_status = 'Add Override Materials' if override else 'Remove Override Materials' for widget in top: if isinstance(widget, PySide.QtGui.QMenu): try: actions = widget.actions() override_action = None jump_to_ev_action = None for action in actions: if action.text() == 'Show in Element Viewer': jump_to_ev_action = action.menu().actions()[1] if action.text() == override_status: override_action = action if override_action: override_action.trigger() if jump and jump_to_ev_action: jump_to_ev_action.trigger() except RuntimeError: pass def debug_breakpoint(*kwargs): """Usable as a breakpoint for debugging animation set and dag scripts via external debugger - for example Wing IDE (can't recommend it enough). More on SFM scripts debugging: https://wingware.com/doc/howtos/sfm """ sfmApp.ProcessEvents() def main(): # Типы скриптов: #scripts\sfm\.. # global - mainmenu # animation set context menu - animset # dag context menu - dag # during sfm initialization - sfm_init.py # shot = sfm.GetCurrentShot() # camera = shot.camera # animset = shot.animationSets[0] # controls = кости animSet = sfm.GetCurrentAnimationSet() gameModel = animSet.gameModel rootGroup = animSet.GetRootControlGroup() # ControlGroupName = 'newControlName' # controlGroup = animSet.FindOrAddControlGroup(animSet.GetRootControlGroup(), 'newControlName') # print(controlGroup) materials_dict = dict() # for material in gameModel.materials: # materials_dict = for material in gameModel.materials: value = 'xxxxx' if not material.HasAttribute('$cloakcolortint'): continue print material.name print material.GetValue('$cloakcolortint') print type(material.GetValue('$cloakcolortint')) # newMat = vs.CreateElement('DmeMaterial', 'proxy script base', 0) # newMat.AddAttributeAsString('$basetexture')#, 'test') # newMat.SetValue('$basetexture', 'fake') # newMat.SetValue('mtlName', 'mtldef') #set mtlName, critical step # animSet.gameModel.materials.AddToTail(newMat) #add material to model # print animSet.CollectDagNodes() # print animSet.CollectOperators() if __name__ == '__main__': main()
29.013193
99
0.636049
5,598
0.508308
0
0
3,371
0.306093
0
0
2,373
0.215473
19918c7e3202a1fa8b8c6f798ca7ec26ed75c1a5
1,778
py
Python
waterApp/migrations/0014_gwmonitoringkobo.py
csisarep/groundwater_dashboard
4f93d7b7c9fd6b48ace54e7b62cae717decc98d2
[ "MIT" ]
null
null
null
waterApp/migrations/0014_gwmonitoringkobo.py
csisarep/groundwater_dashboard
4f93d7b7c9fd6b48ace54e7b62cae717decc98d2
[ "MIT" ]
null
null
null
waterApp/migrations/0014_gwmonitoringkobo.py
csisarep/groundwater_dashboard
4f93d7b7c9fd6b48ace54e7b62cae717decc98d2
[ "MIT" ]
null
null
null
# Generated by Django 2.2 on 2021-09-14 07:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('waterApp', '0013_gwlocationsdata_location'), ] operations = [ migrations.CreateModel( name='GwMonitoringKobo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('date', models.CharField(blank=True, max_length=150, null=True)), ('district', models.CharField(blank=True, max_length=150, null=True)), ('latitude', models.FloatField(blank=True, null=True)), ('longitude', models.FloatField(blank=True, null=True)), ('altitude', models.FloatField(blank=True, null=True)), ('precision', models.FloatField(blank=True, null=True)), ('well_type', models.CharField(blank=True, max_length=150, null=True)), ('measurement_point_cm', models.IntegerField(blank=True, null=True)), ('measurement_of_wet_point_on_tape_in_m_field', models.CharField(blank=True, db_column='measurement_of_wet_point_on_tape__in_m_', max_length=150, null=True)), ('gw_level_from_mp', models.FloatField(blank=True, null=True)), ('mp_in_m', models.FloatField(blank=True, null=True)), ('gw_level', models.FloatField(blank=True, null=True)), ('fid', models.IntegerField(blank=True, null=True)), ('well_num', models.CharField(blank=True, max_length=150, null=True)), ], options={ 'db_table': 'gw_monitoring_kobo', 'managed': False, }, ), ]
46.789474
174
0.596738
1,687
0.948819
0
0
0
0
0
0
380
0.213723
1991dc4138a00addb007b9c008442a088b976ece
255
py
Python
graphs.py
spencerparkin/ComplexFunctionGrapher
780eea1fa704d3dcf0f41e701acbe709d0e8c410
[ "MIT" ]
null
null
null
graphs.py
spencerparkin/ComplexFunctionGrapher
780eea1fa704d3dcf0f41e701acbe709d0e8c410
[ "MIT" ]
null
null
null
graphs.py
spencerparkin/ComplexFunctionGrapher
780eea1fa704d3dcf0f41e701acbe709d0e8c410
[ "MIT" ]
null
null
null
# graphs.py # TODO: Import zeta function here or assume that the calling/loading program puts it into our global scope for us? def func1(z): # This, of course, is just the identity function. return z def func2(z): return (1.0 - z)*(1.0 + z)
25.5
114
0.678431
0
0
0
0
0
0
0
0
174
0.682353
1992027ec84925790a7d6fb4bda0cd8820388c0a
2,891
py
Python
src/rhc_hqa/rhc_hqa.py
Minyus/rhc_hqa
2b9f37a8b6ddb9dd36c08764acd2dcf9cbd7c551
[ "Apache-2.0" ]
null
null
null
src/rhc_hqa/rhc_hqa.py
Minyus/rhc_hqa
2b9f37a8b6ddb9dd36c08764acd2dcf9cbd7c551
[ "Apache-2.0" ]
null
null
null
src/rhc_hqa/rhc_hqa.py
Minyus/rhc_hqa
2b9f37a8b6ddb9dd36c08764acd2dcf9cbd7c551
[ "Apache-2.0" ]
null
null
null
import pandas as pd import numpy as np from sklearn.linear_model import LogisticRegression from lightgbm import LGBMRegressor def cv_index_list_to_df(d): out_dict = {} for group, index_list in d.items(): for index in index_list: out_dict[index] = group df = pd.DataFrame.from_dict(out_dict, orient="index", columns=["split"]) df.index.name = "id" return df def estimate_cate(df, parameters): col_outcome = parameters.get("col_outcome") col_treatment = parameters.get("col_treatment") cols_feature = parameters.get("cols_feature") propensity_lower = parameters.get("propensity_lower") propensity_upper = parameters.get("propensity_upper") split_list = df["split"].drop_duplicates().to_list() split_list = sorted(split_list) ps_model_dict = {} tot_model_dict = {} np.random.seed(42) for s in split_list: ps_model = LogisticRegression(solver="liblinear", random_state=42) tot_model = LGBMRegressor( min_child_samples=400, importance_type="gain", random_state=42 ) col_propensity = "propensity_score_{}".format(s) col_trans_outcome = "transformed_outcome_{}".format(s) col_cate = "cate_{}".format(s) train_df = df.query("split != @s") ps_model.fit(train_df[cols_feature], train_df[col_treatment]) df[col_propensity] = ps_model.predict_proba(df[cols_feature])[:, 1] df[col_propensity].clip( inplace=True, lower=propensity_lower, upper=propensity_upper ) df[col_trans_outcome] = ( df[col_outcome] * (df[col_treatment] - df[col_propensity]) / (df[col_propensity] * (1 - df[col_propensity])) ) train_df = df.query("split != @s") tot_model.fit(train_df[cols_feature], train_df[col_trans_outcome]) df[col_cate] = tot_model.predict(df[cols_feature]) col_cate_if_seps_1 = "cate_if_seps_1_{}".format(s) col_cate_if_seps_0 = "cate_if_seps_0_{}".format(s) col_cate_diff_seps = "cate_diff_seps_{}".format(s) seps_1_df = df[cols_feature].copy() seps_1_df["seps_1"] = 1.0 df[col_cate_if_seps_1] = tot_model.predict(seps_1_df) seps_0_df = df[cols_feature].copy() seps_0_df["seps_1"] = 0.0 df[col_cate_if_seps_0] = tot_model.predict(seps_0_df) df[col_cate_diff_seps] = df[col_cate_if_seps_1] - df[col_cate_if_seps_0] imp_df = pd.DataFrame( { "feature": cols_feature, "propensity_model_coef": np.squeeze(ps_model.coef_), "cate_model_importances": tot_model.feature_importances_, } ) ps_model_dict[s] = ps_model tot_model_dict[s] = tot_model model_dict = dict(ps=ps_model_dict, tot=tot_model_dict) return df, imp_df, model_dict
32.852273
80
0.649256
0
0
0
0
0
0
0
0
329
0.113801
1992310a23c16a6b24ee79181f9ba76bf057b0f3
2,301
py
Python
257.py
wilbertgeng/LeetCode_exercise
f00c08e0d28ffa88d61d4262c6d1f49f1fa91ebc
[ "MIT" ]
null
null
null
257.py
wilbertgeng/LeetCode_exercise
f00c08e0d28ffa88d61d4262c6d1f49f1fa91ebc
[ "MIT" ]
null
null
null
257.py
wilbertgeng/LeetCode_exercise
f00c08e0d28ffa88d61d4262c6d1f49f1fa91ebc
[ "MIT" ]
null
null
null
"""257. Binary Tree Paths""" # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def binaryTreePaths(self, root): """ :type root: TreeNode :rtype: List[str] """ ### Practice if not root: return [] self.res = [] self.dfs(root, str(root.val)) return self.res def dfs(self, node, path): if not node.left and not node.right: self.res.append(path) return if node.left: self.dfs(node.left, path+"->"+str(node.left.val)) if node.right: self.dfs(node.right, path+"->"+str(node.right.val)) ############ if not root: return [] res = [] self.dfs_backtrack(root, "", res) return res def dfs_backtrack(self, node, path, res): if not node: return None if not node.left and not node.right: res.append(path + str(node.val)) self.dfs_backtrack(node.left, path + str(node.val) + "->", res) self.dfs_backtrack(node.right, path + str(node.val) + "->", res) # dfs + stack def binaryTreePaths1(self, root): if not root: return [] res, stack = [], [(root, "")] while stack: node, ls = stack.pop() if not node.left and not node.right: res.append(ls+str(node.val)) if node.right: stack.append((node.right, ls+str(node.val)+"->")) if node.left: stack.append((node.left, ls+str(node.val)+"->")) return res # bfs + queue def binaryTreePaths2(self, root): if not root: return [] res, queue = [], collections.deque([(root, "")]) while queue: node, ls = queue.popleft() if not node.left and not node.right: res.append(ls+str(node.val)) if node.left: queue.append((node.left, ls+str(node.val)+"->")) if node.right: queue.append((node.right, ls+str(node.val)+"->")) return res
29.883117
72
0.49761
2,070
0.899609
0
0
0
0
0
0
380
0.165146
1992ec78bc5a151f3be755b884f124a14b674536
213
py
Python
bot/tasks/__init__.py
gugarosa/botty
5d286c87716cb3ee55a58bdc560024be2276589f
[ "MIT" ]
null
null
null
bot/tasks/__init__.py
gugarosa/botty
5d286c87716cb3ee55a58bdc560024be2276589f
[ "MIT" ]
null
null
null
bot/tasks/__init__.py
gugarosa/botty
5d286c87716cb3ee55a58bdc560024be2276589f
[ "MIT" ]
null
null
null
"""A tasks package, used to support different tasks that the bot can execute. Essentialy, one can define any kind of operation that the bot can perform over a type of input data (audio, text, video and voice). """
53.25
85
0.760563
0
0
0
0
0
0
0
0
213
1
1993e0484cd76cbe8ee03395dd60ee7a00db241f
2,179
py
Python
crm/forms.py
zhangyafeii/CRM
4d93fb276c7210676590da48b18d8e72cc202ef0
[ "MIT" ]
null
null
null
crm/forms.py
zhangyafeii/CRM
4d93fb276c7210676590da48b18d8e72cc202ef0
[ "MIT" ]
null
null
null
crm/forms.py
zhangyafeii/CRM
4d93fb276c7210676590da48b18d8e72cc202ef0
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ @Datetime: 2018/10/23 @Author: Zhang Yafei """ from django.forms import ModelForm, forms from crm import models class EnrollmentForm(ModelForm): def __new__(cls, *args, **kwargs): # print('__new__',cls,args,kwargs) for field_name in cls.base_fields: file_obj = cls.base_fields[field_name] file_obj.widget.attrs.update({'class': 'form-control'}) if field_name in cls.Meta.readonly_fields: file_obj.widget.attrs.update({'disabled':True}) return ModelForm.__new__(cls) def clean(self): if not self.cleaned_data['contract_approved']: self.add_error('contract_approved','请勾选单选框') class Meta: model = models.StudentEnrollment # fields = ['name','consultant','status'] fields = '__all__' exclude = ['contract_approved_date'] readonly_fields = [] # readonly_fields = ['contract_agreed'] class CustomerForm(ModelForm): def __new__(cls, *args, **kwargs): # print('__new__',cls,args,kwargs) for field_name in cls.base_fields: file_obj = cls.base_fields[field_name] file_obj.widget.attrs.update({'class': 'form-control'}) if field_name in cls.Meta.readonly_fields: file_obj.widget.attrs.update({'disabled':True}) return ModelForm.__new__(cls) def clean(self): if self.errors: raise forms.ValidationError(('Please fix errors before re-submit')) if self.instance.id is not None: for field in self.Meta.readonly_fields: old_field_val = getattr(self.instance,field) form_val = self.cleaned_data[field] if old_field_val != form_val: self.add_error(field,'Readonly Field:field should be "{}",not "{}"'.format(old_field_val,form_val)) class Meta: model = models.CustomerInfo # fields = ['name','consultant','status'] fields = '__all__' exclude = ['consult_content','status','consult_course'] readonly_fields = ['contact_type','contact','consultant','referral_from',]
35.145161
119
0.620009
2,044
0.932907
0
0
0
0
0
0
597
0.272478
199526a23444f21fe4ced48163607211a83fd853
3,911
py
Python
api/user_api.py
HuQi2018/BiSheServer
66fd77865e131f0a06313562b5d127e530128944
[ "Apache-2.0" ]
44
2021-06-03T04:01:30.000Z
2022-03-31T15:46:00.000Z
api/user_api.py
HuQi2018/BiSheServer
66fd77865e131f0a06313562b5d127e530128944
[ "Apache-2.0" ]
1
2022-02-21T05:40:01.000Z
2022-03-17T10:50:51.000Z
api/user_api.py
HuQi2018/BiSheServer
66fd77865e131f0a06313562b5d127e530128944
[ "Apache-2.0" ]
8
2021-06-05T17:13:35.000Z
2022-03-24T05:04:30.000Z
import uuid from django.core.files.base import ContentFile from django.core.files.storage import default_storage from django.db.models import Q from BiSheServer import settings from api.model_json import queryset_to_json from user.models import UsersPerfer, UsersDetail, UserTag # 用户api class User: def __init__(self): pass # 获取用户喜欢的电影类型 @staticmethod def getUserPreferTag(user_id): user_prefer_tag_rs = UsersDetail.objects.filter(user_id_id=user_id).values_list("user_prefer", flat=True)[0] if not user_prefer_tag_rs: return "" return user_prefer_tag_rs # 获取用户的兴趣爱好 @staticmethod def getUserHobbiesTag(user_id): user_obbies_tag_rs = UsersDetail.objects.filter(user_id_id=user_id).first().values("user_hobbies") if not user_obbies_tag_rs: return "" return user_obbies_tag_rs # 获取所有的爱好标签 @staticmethod def getHobbiesTag(): hobbies_tag_rs = UsersPerfer.objects.all() return hobbies_tag_rs def getHobbiesTagJson(self): hobbies_tag_rs = queryset_to_json(self.getHobbiesTag().all()) return hobbies_tag_rs # 添加用户的标签 @staticmethod def add_user_tag(user_id, tag_type, tag_name, tag_weight): # 除评论和评分标签外,所有标签初始化创建时初始设置为5 if tag_type != "rating_movie_id" and tag_type != "comment_movie_id" and tag_type != "info_movie_tag": UserTag.objects.create(user_id=user_id, tag_type=tag_type, tag_name=tag_name, tag_weight=5) else: if tag_type == "info_movie_tag": # 电影标签默认一律为2 tag_weight = 2 UserTag.objects.create(user_id=user_id, tag_type=tag_type, tag_name=tag_name, tag_weight=tag_weight) # 修改用户的标签权重 def modify_user_tag(self, user_id, tag_type, tag_name, tag_weight): user_tag = UserTag.objects.filter(Q(user_id=user_id) & Q(tag_type=tag_type) & Q(tag_name=tag_name)) if user_tag.exists(): # 存在该标签则进行修改 if type(tag_weight) == str: # 判断其为修改标签权值,如果为数字则直接对其进行赋值 old_tag_weight = int(user_tag.first().tag_weight) try: tag_weight = int(tag_weight) except Exception as ex: print("非法权值!" + ex.__str__()) return "" if old_tag_weight != 0: # 修改标签权值 tag_weight = old_tag_weight + tag_weight else: # 第二次添加标签 tag_weight = 5 + tag_weight user_tag.update(tag_weight=str(tag_weight)) else: self.add_user_tag(user_id, tag_type, tag_name, tag_weight) # 检查用户是否登录 @staticmethod def isNotLogin(request): try: if not request.session['is_login'] or not request.session['user_id']: raise Exception except: return True # 用户头像上传 @staticmethod def userImageUpload(user_img): rs = [] imgName = uuid.uuid4().hex img_size = user_img.size img_name = user_img.name img_ext = '.' in img_name and img_name.rsplit('.', 1)[-1] # print(img_size) # 判断文件后缀是否在列表中 def allowed_file(img_ext): return img_ext in settings.default['allow_extensions'] if user_img: if not allowed_file(img_ext): rs = [False,"非图片类型上传!"] # return JsonError("非图片类型上传!") elif img_size > int(settings.default['allow_maxsize']): rs = [False, "图片大小超过5MB,上传失败!"] # return JsonError("图片大小超过5MB,上传失败!") else: img_path = default_storage.save(settings.default['avatars_upload_folder'] + imgName + "." + img_ext, ContentFile(user_img.read())) # 保存文件 # request.session['user_img'] = img_path rs = [True, img_path] return rs
35.554545
116
0.611864
4,023
0.931466
0
0
2,589
0.599444
0
0
946
0.219032
199538a4a4f978d0b56aadb122776630718bac24
1,777
py
Python
Diretide/lib.py
sleibrock/dotacli
e361fbcf787f13232fcf8994b839d4c9f08bc67a
[ "MIT" ]
null
null
null
Diretide/lib.py
sleibrock/dotacli
e361fbcf787f13232fcf8994b839d4c9f08bc67a
[ "MIT" ]
null
null
null
Diretide/lib.py
sleibrock/dotacli
e361fbcf787f13232fcf8994b839d4c9f08bc67a
[ "MIT" ]
null
null
null
#!/usr/bin/env python #-*- coding: utf-8 -*- """ lib.py """ from string import printable as printable_chrs from collections import namedtuple from requests import get as re_get from datetime import datetime # Define constants API_URL = "http://dailydota2.com/match-api" Match = namedtuple("Match", ["timediff", "series_type", "link", "starttime", "status", "starttime_unix", "comment", "viewers", "team1", "team2", "league"]) def get_url(url): return re_get(url).json() def get_longest(matches): return max([max(len(x.team1["team_name"]),len(x.team2["team_name"])) for x in matches]) def print_match(m, longest): "Do all the match info here" print("=== {} (best of {}) ===".format(m.league["name"], m.series_type)) print("{[team_name]:<{width}} vs. {[team_name]:>{width}}".format( m.team1, m.team2, width=longest)) print(display_time(m)) print() def display_time(m): """Convert unix time to readable""" x = int(m.timediff) if x <= 0: return "***Currently Running***" return "Time until: {}".format( datetime.fromtimestamp(x).strftime("%H:%M:%S")) def main(*args, **kwargs): """ Main function Retrieves, forms data, and prints out information """ print() # First retrieve the JSON data = get_url(API_URL) # Interpret results into a list of matches matches = [Match(**unpack) for unpack in data["matches"]] # Find the longest team name and create dynamic alignment longest = get_longest(matches) # Print out a list of all matches (possibly order by the Unix timestamp) for match in matches: print_match(match, longest) if __name__ == "__main__": main() # end
26.924242
78
0.621835
0
0
0
0
0
0
0
0
740
0.416432
1996ff9cbd376245bbd4ada8ffdff6a62803fa08
417
py
Python
hash-tool/vv_hash.py
amjunliang/virtualview_tools
7fcf62134b0a23a71bb8f4b54a6aac19cf858ef6
[ "MIT" ]
186
2017-12-06T09:17:07.000Z
2022-01-10T04:04:09.000Z
hash-tool/vv_hash.py
amjunliang/virtualview_tools
7fcf62134b0a23a71bb8f4b54a6aac19cf858ef6
[ "MIT" ]
16
2017-12-18T04:15:57.000Z
2021-04-15T06:50:37.000Z
hash-tool/vv_hash.py
amjunliang/virtualview_tools
7fcf62134b0a23a71bb8f4b54a6aac19cf858ef6
[ "MIT" ]
47
2018-01-12T06:23:26.000Z
2022-02-22T05:56:59.000Z
import sys if len(sys.argv) <= 1: print("python vv_hash.py property_name") exit(0) propertyName = sys.argv[1] if len(propertyName) == 0: print("empty element name") exit(0) hashCode = 0 for i in range(0, len(propertyName)): hashCode = (31 * hashCode + ord(propertyName[i])) & 0xFFFFFFFF if hashCode > 0x7FFFFFFF: hashCode = hashCode - 0x100000000 print("hash code: %d" % (hashCode))
24.529412
66
0.654676
0
0
0
0
0
0
0
0
68
0.16307
1998df4907ac93692e766bee0d9c71f2e17b5c12
237
py
Python
pycounter/test/test_jr1_tabs.py
loadbrain/pycounter
e5533d0ebe3685df0c29f8e491ea6dd1c14c6b66
[ "MIT" ]
null
null
null
pycounter/test/test_jr1_tabs.py
loadbrain/pycounter
e5533d0ebe3685df0c29f8e491ea6dd1c14c6b66
[ "MIT" ]
2
2020-08-27T14:12:44.000Z
2020-08-27T14:16:18.000Z
pycounter/test/test_jr1_tabs.py
loadbrain/pycounter
e5533d0ebe3685df0c29f8e491ea6dd1c14c6b66
[ "MIT" ]
null
null
null
"""Test COUNTER JR1 journal report (TSV)""" def test_html(tsv_jr1): assert [pub.html_total for pub in tsv_jr1.pubs] == [0, 15, 33, 0] def test_pdf(tsv_jr1): assert [pub.pdf_total for pub in tsv_jr1.pubs] == [32, 12, 855, 40]
23.7
71
0.662447
0
0
0
0
0
0
0
0
43
0.181435