コード例 #1
0
    def test_set_value(self):
        json = self.generate_param('generic-param', 55)

        param = Param(json)
        param.value = 10

        self.assertNotEqual(55, param.value)
        self.assertEqual(10, param.value)
コード例 #2
0
ファイル: param_test.py プロジェクト: sunilbluss/Application
    def test_set_value(self):
        json = self.generate_param('generic-param', 55)

        param = Param(json)
        param.value = 10

        self.assertNotEqual(55, param.value)
        self.assertEqual(10, param.value)
コード例 #3
0
    def test__ne__(self):
        json = self.generate_param('generic-param')
        json2 = self.generate_param('generic-param-2')

        param = Param(json)
        param2 = Param(json2)

        self.assertNotEqual(param, param2)
コード例 #4
0
    def params(self):
        returned = []

        for param in self["ports"]["control"]["input"]:
            returned.append(Param(param, self))

        return returned
コード例 #5
0
    def test__getitem__(self):
        json = self.generate_param('generic-param')

        param = Param(json)

        self.assertEqual(param.json['name'], param['name'])
        self.assertEqual(param.json['value'], param['value'])
コード例 #6
0
ファイル: mechanics.py プロジェクト: zemiret/AGHtochess
def generate_unit(round: int) -> Unit:
    tank_factory = UnitFactory(attack=Param(low=10, high=20, multiplier=1.1),
                               defense=Param(low=20, high=35, multiplier=1.1),
                               magicResist=Param(low=20, high=35, multiplier=1.1),
                               criticalChance=Param(low=10, high=20, multiplier=1.02, max=100),
                               hp=Param(low=100, high=140, multiplier=1.1),
                               range=Param(low=2, high=3),
                               attackSpeed=Param(low=7, high=10, multiplier=1.05),
                               type="PHYSICAL")

    sniper_factory = UnitFactory(attack=Param(low=30, high=60, multiplier=1.1),
                                 defense=Param(low=0, high=10, multiplier=1.1),
                                 magicResist=Param(low=0, high=5, multiplier=1.1),
                                 criticalChance=Param(low=40, high=50, multiplier=1.05, max=100),
                                 hp=Param(low=40, high=60, multiplier=1.1),
                                 range=Param(low=6, high=10),
                                 attackSpeed=Param(low=4, high=5, multiplier=1.05),
                                 type="PHYSICAL")

    rogue_factory = UnitFactory(attack=Param(low=25, high=50, multiplier=1.1),
                                defense=Param(low=0, high=4, multiplier=1.1),
                                magicResist=0,
                                criticalChance=Param(low=30, high=40, multiplier=1.05, max=100),
                                hp=Param(low=30, high=50, multiplier=1.1),
                                range=Param(low=2, high=4),
                                attackSpeed=Param(low=10, high=15, multiplier=1.05),
                                type="PHYSICAL")

    magician_factory = UnitFactory(attack=Param(low=20, high=30, multiplier=1.1),
                                   defense=Param(low=10, high=20, multiplier=1.1),
                                   magicResist=Param(low=15, high=25, multiplier=1.1),
                                   criticalChance=0,
                                   hp=Param(low=70, high=90, multiplier=1.1),
                                   range=Param(low=3, high=6),
                                   attackSpeed=Param(low=8, high=12, multiplier=1.05),
                                   type="MAGICAL")

    magical_tank_factory = UnitFactory(attack=Param(low=15, high=22, multiplier=1.1),
                                       defense=Param(low=25, high=40, multiplier=1.1),
                                       magicResist=Param(low=25, high=40, multiplier=1.1),
                                       criticalChance=0,
                                       hp=Param(low=90, high=120, multiplier=1.1),
                                       range=Param(low=3, high=4),
                                       attackSpeed=Param(low=7, high=10, multiplier=1.05),
                                       type="MAGICAL")

    unit_factory = choice([
        tank_factory,
        sniper_factory,
        rogue_factory,
        magician_factory,
        magical_tank_factory
    ])
    return unit_factory.create(round=round)
コード例 #7
0
    def test_value(self):
        json = self.generate_param('generic-param', 55)

        param = Param(json)

        self.assertEqual(param.json['value'], param.value)
コード例 #8
0
    def test_json(self):
        json = self.generate_param('generic-param')

        param = Param(json)

        self.assertEqual(json, param.json)