PyTFall > PyTFall: Game design

BE logic

<< < (4/10) > >>

DarkTl:
core.rpy

--- Quote ---        def get_defense(self, target):
            """
            A method to get defence value vs current attack.
            """
            if any(list(i for i in ["melee", "ranged"] if i in self.attributes)):
                defense = round(target.defence + target.constitution*0.2)
            elif "magic" in self.attributes:
                defense = round(target.magic*0.4 + target.defence*0.4 + target.constitution*0.2 + target.intelligence*0.2)
            else:
                defense = target.defence
            return defense
--- End quote ---
content-classes.rpy

--- Quote ---    class PoisonEvent(BE_Event):
        def __init__(self, target, source, effect):
            self.target = target
            self.source = source
            if target.constitution <= 0:
                self.counter = source.intelligence+2
            else:
                self.counter = round(source.intelligence/target.constitution)+2 # We remove the event if counter reaches 0.
            self.effect = effect / 1000.0
            self.attributes = ['status', 'poison']
--- End quote ---
Assuming that you pulled.

Xela:
Should be fixed.

DarkTl:
Such a lazy workaround I could implemented by myself  :D
It still will force us to add more additional checks in BE with every division.

Xela:
What do you propose? I've already said that defense stat should be able to be 0. That method looked like something that you wanted to use to calc defense in the BE, where else are you planning to calc it?

DarkTl:
I want to add effects to every spell. The chance to resist effects will be calculated in a similar matter. Also evasion. Also who knows what.
I figured if you don't like tons of unnecessarily elif forks, you won't like tons of unnecessarily "if a <= 0: a = 1" checks too, and normalization that does not allow stats to be less than 1 (except luck) will do the trick. Oh well, not my problem then if you will want to get rid of <=0 checks one day  ::)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version