Exemplo n.º 1
0
def double_damage_rune():
    __double_damage_bonus = Bonus(
        {SpellAttributes.AMOUNT: Attribute(0, 100, 0)})
    __complexity_cost_bonus = Bonus(
        {SpellAttributes.COMPLEXITY: Attribute(0, 0, 20)})

    _double_damage_rune = Rune(
        [__double_damage_bonus, __complexity_cost_bonus])
    return _double_damage_rune
Exemplo n.º 2
0
    def __init__(self, base_type: BaseType, masteries = None):
        self.str_base = Attribute.attribute_or_none(base_type.attributes[CharAttributes.STREINGTH])
        self.end_base = Attribute.attribute_or_none(base_type.attributes[CharAttributes.ENDURANCE])
        self.prc_base = Attribute.attribute_or_none(base_type.attributes[CharAttributes.PERCEPTION])
        self.agi_base = Attribute.attribute_or_none(base_type.attributes[CharAttributes.AGILITY])
        self.int_base = Attribute.attribute_or_none(base_type.attributes[CharAttributes.INTELLIGENCE])
        self.cha_base = Attribute.attribute_or_none(base_type.attributes[CharAttributes.CHARISMA])
        self.readiness = 0
        self.disabled = False
        self.masteries = masteries or Masteries(base_type.xp)

        self.type_name = base_type.type_name
        self.actives = base_type.actives

        self.unarmed_damage_type = base_type.unarmed_damage_type
        self.unarmed_chances = base_type.unarmed_chances
        self.resists = Resistances(base_type.resists)
        self.natural_armor = Armor(base_type.armor_base, base_type.armor_dict)

        self.inventory = Inventory(base_type.inventory_capacity, self)
        self.equipment :Equipment = base_type.equipment_cls(self)
        self.abilities = []
        self.buffs = []

        self.alive = True
        self.is_obstacle = False
        self.last_damaged_by = None

        self.icon = base_type.icon

        for active in std_attacks:
            self.give_active(active)

        for active in std_movements:
            self.give_active(active)
Exemplo n.º 3
0
    def __init__(self, name, school, targeting_cls,
                 complexity, cost,
                 amount, duration, precision_factor, distance, radius,
                 resolve_callback, targeting_cond=None):

        super().__init__(name, ItemTypes.SPELL_CONCEPT)
        self.school = school
        self.targeting_cls = targeting_cls
        self.targeting_cond = targeting_cond
        self.complexity_base = Attribute.attribute_or_none(complexity)

        self.mana_cost_base = Attribute.attribute_or_none(cost.mana)
        self.stamina_cost_base = Attribute.attribute_or_none(cost.stamina)
        self.health_cost_base = Attribute.attribute_or_none(cost.health)
        self.readiness_cost_base = Attribute.attribute_or_none(cost.readiness)

        self.amount_base = Attribute.attribute_or_none(amount)
        self.duration_base = Attribute.attribute_or_none(duration)
        self.precision_factor_base = Attribute.attribute_or_none(precision_factor)
        self.distance_base = Attribute.attribute_or_none(distance)
        self.radius_base = Attribute.attribute_or_none(radius)

        self.resolve_callback = resolve_callback
        self.runes = None
Exemplo n.º 4
0
def test_multiplier(hero, pirate):

    bonus = Attribute(0, 50, 0)
    bonus_hp = Bonus({CharAttributes.HEALTH: bonus})
    abil_hp = Ability([bonus_hp])

    hp_before = hero.health
    abil_hp.apply_to(hero)
    delta_hero = hero.health - hp_before

    hp_before = pirate.health
    abil_hp.apply_to(pirate)
    delta_pirate = pirate.health - hp_before

    assert delta_hero > delta_pirate
Exemplo n.º 5
0
from game_objects.spells import Rune, SpellAttributes
from game_objects.attributes import Bonus, Attribute

__double_damage_bonus = Bonus({SpellAttributes.AMOUNT: Attribute(0, 100, 0)})
__complexity_cost_bonus = Bonus(
    {SpellAttributes.COMPLEXITY: Attribute(0, 0, 20)})

double_damage_rune = Rune([__double_damage_bonus, __complexity_cost_bonus])
Exemplo n.º 6
0
 def max_health_base(self):
     return Attribute(self.str * Unit.HP_PER_STR, 100, 0)
Exemplo n.º 7
0
 def __initiative_formula(self, agi, stamina):
     return Attribute(10 * ((0.4 + agi / 14) ** (3 / 5)) * ((stamina / 100) ** (1 / 3)), 100, 0)
Exemplo n.º 8
0
 def max_stamina_base(self):
     return Attribute(self.end * Unit.STAMINA_PER_END, 100, 0)
Exemplo n.º 9
0
 def max_mana_base(self):
     return Attribute(self.int * Unit.MANA_PER_INT, 100, 0)
Exemplo n.º 10
0
def bonus_str():
    bonus = Attribute(0, 0, 50)
    bonus_hp = Bonus({CharAttributes.HEALTH: bonus})
    abil_hp = Ability([bonus_hp])

    yield abil_hp
Exemplo n.º 11
0
def inner_power(attrib):
    bonus = Attribute(2, 100, 0)
    inner_power_bonus = Bonus({attrib: bonus})
    inner_power = Ability([inner_power_bonus])

    yield inner_power