devolution

Author Topic: BE logic  (Read 10903 times)

0 Members and 1 Guest are viewing this topic.

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
BE logic
« 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.

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
This is a weird code. Not sure why you cannot just
Quote
if (t.defence < 1):
    damage = attack * 2
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)
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.
« Last Edit: November 11, 2015, 05:32:05 AM by DarkTl »

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6892
  • "It's like hunting cows"
Re: BE logic
« Reply #1 on: November 11, 2015, 06:30:42 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.

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.

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.

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

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.

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.

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.

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: [Select]
    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']

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.

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.

Your call.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: BE logic
« Reply #2 on: November 11, 2015, 08:58:31 AM »
I was actually thinking about rewriting BE in SimPy but that would have to be after the next release.
I see. Then advanced options will wait until then, I'll just balance existing ones since we can use them for calculations anyway.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6892
  • "It's like hunting cows"
Re: BE logic
« Reply #3 on: November 11, 2015, 09:25:50 AM »
I see. Then advanced options will wait until then, I'll just balance existing ones since we can use them for calculations anyway.

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.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: BE logic
« Reply #4 on: November 12, 2015, 01:51:43 AM »
What do you think about chance to hit?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6892
  • "It's like hunting cows"
Re: BE logic
« Reply #5 on: November 12, 2015, 02:06:42 AM »
What do you think about chance to hit?

Dodging might be fun, definitely something to consider, should prolly be agility based, maybe some items as well.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: BE logic
« Reply #6 on: November 13, 2015, 06:41:30 AM »
Wait a sec. Enemies never become poisoned. The poison damages them only once, without any noticeable messages in the battle log, like poison resist. Is it a bug?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6892
  • "It's like hunting cows"
Re: BE logic
« Reply #7 on: November 13, 2015, 01:40:39 PM »
Wait a sec. Enemies never become poisoned. The poison damages them only once, without any noticeable messages in the battle log, like poison resist. Is it a bug?

If that is a fact, it is definitely a bug. I've coded poison to work as an attack on application and as an event executed before the target takes his/her turn. I have tested it thoroughly before pushing the code and it was working as intended, even when characters resisted poison logic and reports were still sound.

One thing to keep in mind is that Ren'Py is changing and evolving usually for the better. As I know it's inner code, I often use modules that are not "officiilally" exposed to developers and are subject to a change (however unlikely). So there is always a chance that my old code will not function as intended in modern Ren'Py, any issues that got to be fixed will take less then one line of rewriting to have them working again. I just need to know what is failing atm...
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: BE logic
« Reply #8 on: November 14, 2015, 02:22:42 AM »
I tested it via our single BasicPoisonSpell. It damages the target only once and never gives them damage over time. It is supposed to tell "%s not skilled enough to poison %s!" when failed, but it's not (especially since testing target couldn't possibly resist it with its stats).

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6892
  • "It's like hunting cows"
Re: BE logic
« Reply #9 on: November 14, 2015, 03:11:32 AM »
Well... it was working before :)

I'll take a look at it and the BE in general tonight, maybe run it through SimPy if that is possible. I need a short break from Jobs code.
Like what we're doing?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6892
  • "It's like hunting cows"
Re: BE logic
« Reply #10 on: November 14, 2015, 05:08:31 AM »
Ok, I've restored poison effects. I'll try to put some more time into coding in a few hours, gtg now.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: BE logic
« Reply #11 on: November 14, 2015, 01:06:05 PM »
Mobs don't have a normalization, it's possible for them to have 0 stat, that sometimes forces the game to divide by zero without additional checks.
I suppose all stats should be at least 5 unless stated more in json.
« Last Edit: November 14, 2015, 01:26:43 PM by DarkTl »

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6892
  • "It's like hunting cows"
Re: BE logic
« Reply #12 on: November 14, 2015, 02:06:45 PM »
Which line of code is throwing the error. I can't see anything wrong with stats at 0...

I was busy again for the better part of the day, going to try and think a little bit if SimPy can help BE...
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4730
Re: BE logic
« Reply #13 on: November 14, 2015, 02:13:31 PM »
Damage = attack/defence, for both weapons and magic. Also amount of turns for poison is (source.intelligence/target.constitution)+2.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6892
  • "It's like hunting cows"
Re: BE logic
« Reply #14 on: November 14, 2015, 02:20:44 PM »
I was hoping for a line number/file or a line I can search for. We can add a check to prevent Zero division.
Like what we're doing?