PyTFall > PyTFall: Game design

BE logic

(1/10) > >>

DarkTl:
Alright, at the moment it works like:
1) min damage is 0.
For weapons attack power is
attack = (a.attack + self.effect) * self.multiplier
Though weapons don't have anything like that. Should I add effect and multiplier fields to jsons?

For magic it's attack = (a.magic + self.effect) * self.multiplier. Now I see why spells are so OP, I'll change spells stats  :)
However, we use pure normal defense against magic based attacks. I want to change the formula, making it based on defense, magic and intelligence.

2) Damage from weapons is based on the difference between attack and defense:

--- Quote ---         if (t.defence < 1):
                defence = 2 - t.defence
                damage = attack * defence
--- End quote ---
This is a weird code. Not sure why you cannot just

--- Quote ---if (t.defence < 1):
    damage = attack * 2
--- End quote ---
Unless you expect negative defence, which probably should not even exist.

And for normal defense damage = (attack/t.defence) + 0.5.

Then we take a random number between 0.8 and 1.2, as rand, and
damage = int(float(damage) * multiplier * 10 * rand)

It works surprisingly well. You will have 15 damage if attack=defense, and in order to have damage 200 attack should be 19 times more than defense, so you clearly don't have enough training in the case if that's the damage made by enemies.

3) Multiplier means critical hits and elemental affinities.

Critical hit:

--- Quote ---                if dice(10):
                    if (a.luck >= t.luck and dice(max(50, a.luck*2))) or dice(50)
--- End quote ---
So thanks to that "or dice(50)" the chance always will be 5% at very least. With max luck it will be 10% at best. That makes negative luck not a major issue, and makes max luck not a very big advantage. I want to change a bit crit hit chance, especially add bonuses based on occupation (warriors in general, assassin especially). Meaning a new field for traits.

Critical hit makes multiplier from the damage formula 2.5, thus makes it 2.5 times more. I want to change the damage of crit hits based on weapon type. Daggers will have more crit damage, and so on. But don't know how. I don't think we can use char.eqslots["weapon"].type inside BE, since BE doesn't know about equipment screen.

For spells it simply adds or removes % of damage based on elemental traits.

4) Poison:
- (magic + intelligence) should be more than target's
- cannot be poisoned again if already poisoned. I don't like it, it should reset the amount of turns left for poison.
- base damage = t.get_max("health") * (self.effect/1000.0). Ie based on target's max health.
- then we have a weird line damage = max(randint(18, 22), int(damage) + randint(-4, 4)). So it can never be less than 18. That's pretty high for weak chars.
Also I don't see where you control the amount of turns which the poison will work.

5) Healing:
- base amount of healed points is (effect + (char.intelligence + char.magic) * 0.25)*multiplier
It's sufficient for now, since we don't have many healing spells. In the future though I want to limit the power of weak spells, making high level ones much more useful for high levels.

Xela:

--- Quote from: DarkTl on November 11, 2015, 05:16:21 AM ---Alright, at the moment it works like:
1) min damage is 0.
For weapons attack power is
attack = (a.attack + self.effect) * self.multiplier
Though weapons don't have anything like that. Should I add effect and multiplier fields to jsons?

For magic it's attack = (a.magic + self.effect) * self.multiplier. Now I see why spells are so OP, I'll change spells stats  :)
However, we use pure normal defense against magic based attacks. I want to change the formula, making it based on defense, magic and intelligence.

--- End quote ---

Do as you wish. You can add fields to JSONs if you like, I don't remember if I had any specific ideas for BE, I always wanted special attacks bound to some items and to extend capabilities of SimpleAttack class but I left that for later, you can do whatever you can right now.


--- Quote from: DarkTl on November 11, 2015, 05:16:21 AM ---2) Damage from weapons is based on the difference between attack and defense:This is a weird code. Not sure why you cannot justUnless you expect negative defence, which probably should not even exist.

And for normal defense damage = (attack/t.defence) + 0.5.

Then we take a random number between 0.8 and 1.2, as rand, and
damage = int(float(damage) * multiplier * 10 * rand)

It works surprisingly well. You will have 15 damage if attack=defense, and in order to have damage 200 attack should be 19 times more than defense, so you clearly don't have enough training in the case if that's the damage made by enemies.

--- End quote ---

We had negative defense due to traits messing up stats, it shouldn't happen anymore.


--- Quote from: DarkTl on November 11, 2015, 05:16:21 AM ---3) Multiplier means critical hits and elemental affinities.

Critical hit:So thanks to that "or dice(50)" the chance always will be 5% at very least. With max luck it will be 10% at best. That makes negative luck not a major issue, and makes max luck not a very big advantage. I want to change a bit crit hit chance, especially add bonuses based on occupation (warriors in general, assassin especially). Meaning a new field for traits.

Critical hit makes multiplier from the damage formula 2.5, thus makes it 2.5 times more. I want to change the damage of crit hits based on weapon type. Daggers will have more crit damage, and so on. But don't know how. I don't think we can use char.eqslots["weapon"].type inside BE, since BE doesn't know about equipment screen.

For spells it simply adds or removes % of damage based on elemental traits.

--- End quote ---

Ofcourse we can use slots directly inside of the BE, there is nothing to prevent that. They will be bound to the characters object we pass around in BE, usually something like attacker/target. Those are full chars, they are exactly the same in all places of game/code, only one instance of them exists with nay amount of references to it. I wanted to add extra CS bonuses based on some weapons but never got around to that.


--- Quote from: DarkTl on November 11, 2015, 05:16:21 AM ---4) Poison:
- (magic + intelligence) should be more than target's
- cannot be poisoned again if already poisoned. I don't like it, it should reset the amount of turns left for poison.
- base damage = t.get_max("health") * (self.effect/1000.0). Ie based on target's max health.
- then we have a weird line damage = max(randint(18, 22), int(damage) + randint(-4, 4)). So it can never be less than 18. That's pretty high for weak chars.
Also I don't see where you control the amount of turns which the poison will work.

--- End quote ---

I didn't think 18 was a high number since normal health is at 100... Feel free to change it.

Turns are controlled here:


--- Code: ---    class PoisonEvent(BE_Event):
        def __init__(self, target, source, effect):
            self.target = target
            self.source = source
            self.counter = 6 # We remove the event if counter reaches 0.
            self.effect = effect / 1000.0
            self.attributes = ['status', 'poison']
--- End code ---

Event is created and added to the event handler. "counter" counts down to 0 and the event is terminated afterwards. I was actually thinking about rewriting BE in SimPy but that would have to be after the next release.


--- Quote from: DarkTl on November 11, 2015, 05:16:21 AM ---5) Healing:
- base amount of healed points is (effect + (char.intelligence + char.magic) * 0.25)*multiplier
It's sufficient for now, since we don't have many healing spells. In the future though I want to limit the power of weak spells, making high level ones much more useful for high levels.

--- End quote ---

Your call.

DarkTl:

--- Quote from: Xela on November 11, 2015, 06:30:42 AM --- I was actually thinking about rewriting BE in SimPy but that would have to be after the next release.

--- End quote ---
I see. Then advanced options will wait until then, I'll just balance existing ones since we can use them for calculations anyway.

Xela:

--- Quote from: DarkTl on November 11, 2015, 08:58:31 AM ---I see. Then advanced options will wait until then, I'll just balance existing ones since we can use them for calculations anyway.

--- End quote ---

Anything you can add will remain the same, SimPy may offer as a better loop/control over time, it doesn't have any effect on graphics or logic.

DarkTl:
What do you think about chance to hit?

Navigation

[0] Message Index

[#] Next page

Go to full version