• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Fixed Block chances being calculated wrong

Levis

Find(Rum) = false;
Staff member
Administrator
Creative Support
Programmer
Storm Modder
Code:
void LAi_ApplyCharacterBladeDamage(aref attack, aref enemy, float attackDmg, float hitDmg, bool isBlocked)
{
    //Если неубиваемый, то нетрогаем его
    if(LAi_IsImmortal(enemy)) return;
    //Применяем абилити
    float pBreak = 0.0;
    if(IsCharacterPerkOn(attack, "SwordplayProfessional"))
    {
        pBreak = pBreak + 0.25;
    }
    // Baste - critical hit check moved down
    float kDmg = 1.0;
    if(IsCharacterPerkOn(attack, "Rush"))
    {
        kDmg = 1.5;
        pBreak = pBreak + 0.5;
    }
    if(IsCharacterPerkOn(enemy, "Rush"))
    {
        pBreak = pBreak + 0.9;
    }
    isBlocked = isBlocked && CheckAttribute(enemy,"equip.blade") && GetCharacterEquipByGroup(enemy,BLADE_ITEM_TYPE) != "bladeX4";
    // PB: Disable blocking for enemies with either no sword or their fists equiped
    if(isBlocked)
    {
        //Вероятность пробивки
        float p = LAi_BladeFindPiercingProbability(attack, enemy, hitDmg);
        p = p + pBreak;

        //Если шансов пробить нет, то ненаносим провреждения
//        if(p < 0.0) return;                                        // LDH removed 06Apr09
        //Если шансов пробить нет, то ненаносим провреждения
        if(rand(10000) > p*10000)    // if block is NOT pierced
        {
            // LDH rewrite 06Apr09
            if(GetCharacterEquipByGroup(attack, BLADE_ITEM_TYPE) == "bladeX4")    // if attacker uses fists, he gets damaged instead
            {
                if(!LAi_IsImmortal(attack))
                {
                    LAi_ApplyCharacterDamage(attack, 2*rand(makeint(attack.skill.Fencing)));    // LDH 0..20
                    LAi_CheckKillCharacter(attack);
                }
//                return;        // LDH so blocked fists don't damage defender - 11Apr09
            }
            return;
        }
    }
p wont go higher then 1.0 but if you got all the perks and got rush activated you are nearly invicible. most of your blocks will work.
So I sugest moving those checks within the checking function which then clamps it below 1.0 so you will never have a higher then 100% chance of blocking.
 
You still have to time your blocks right for them to work, no?

Anyway, I'll have a look some time.

At one point I had the idea of making a block only effective for, say, two seconds after pressing the block button.
It didn't work when I tried to set that up many years ago, but could try again some time.
Could make the fighting a bit too hard though.
 
You still have to time your blocks right for them to work, no?

Anyway, I'll have a look some time.

At one point I had the idea of making a block only effective for, say, two seconds after pressing the block button.
It didn't work when I tried to set that up many years ago, but could try again some time.
Could make the fighting a bit too hard though.
didn't change any mechanics only changed the math a bit so you can't actually get over 100% of block change with different perks etc :p
 
Please check if you see any weird behavior in blocking
 
Different behaviour definitely: Tried the sword-fighting practice with Malcolm Hatcher in the Standard Storyline tutorial.
That is HARD to do now without getting below the minimum HP. Used to be a walk in the park! :shock
 
Different behaviour definitely: Tried the sword-fighting practice with Malcolm Hatcher in the Standard Storyline tutorial.
That is HARD to do now without getting below the minimum HP. Used to be a walk in the park! :shock
On level 1 (or 5) it should be hard. Especially because he is a pretty high character.
 
Should we want the tutorial to be hard?
Maybe set Malcolm to a lower character level?
 
Having Malcolm set to a higher level just means that the player will fight with him until he gets good enough to beat him and then starts off with a pretty high melee skill. Is that desirable?
 
Having Malcolm set to a higher level just means that the player will fight with him until he gets good enough to beat him and then starts off with a pretty high melee skill. Is that desirable?
The tutorial shouldn't really take all that long. Of course you can skip the fighting anyway, but I don't think the first fight you have in the game should already be one of the hardest.
All that matters is that you get to understand the buttons that you need to press and perhaps a bit of the 'rhythm' of fighting.

If you want to use the tutorial to gain more fencing skill, that should of course be allowed. But since you can't die there, that could also be a bit of a cheat.
So while I don't actively want to prevent it, it should also not be super-effective to make use of it.

The Free Play storyline already starts the player at level 5 with some skills already assigned.
The first few skill points should increase relatively quickly anyway, but I reckon players should be able to get most of their experience 'out in the world' and not while still in the tutorial.

This bug is now also much more annoying: Confirmed Bug - Tutorial: Levelling up during Sword Fight triggers end to the fight | PiratesAhoy!
 
Code:
    ch.skill.Leadership = "0";
    ch.skill.Fencing = "10";
    ch.skill.Sailing = "6";
    ch.skill.Accuracy = "3";
    ch.skill.Cannons = "3";
    ch.skill.Grappling = "4";
    ch.skill.Repair = "5";
    ch.skill.Defence = "4";
    ch.skill.Commerce = "2";
    ch.skill.Sneak = "1";
this should result in a level 14 character. Probably with most of the defense perks etc. So indeed we might want to tone him down a little bit.
Just removing all skill levels from his character init and only setting a level would be easiest. And if you put him somewhere round level 7 or 8 (what he normally is set to) that should be okay I think.
Could someone maybe test this? So just remove these lines from his character init. that should be enough.

Wait he is a questchar so he will get these skill. so just tone down the skills instead. questschars are treated a bit differently ;).
 
We could yes. It would make him level 1.
If we give him a good hp bonus you could make a lot of hits before its Done.
 
Malcolm is now a bit easier. he's still challenging but it I was able to beat him relativly easy (I believe I was trying on second difficulty, so maybe he is to hard on higher difficulty but hey he says you still need to practice more and maybe he is just right :)).
Mod Release - Levis' Stuff [Nov 17] | PiratesAhoy!

I do think we might want to add a counter in the dialog so say after 5 times for example you can't choose to practice more with him to prevent it to be an xp farm.
 
If the XP gain is slow enough, I don't mind it being a farm.
People want to use it in that boring way? Go ahead!
There is also the sword fighting practice on your ship deck which is effectively a deliberate Farm too.

As long as the fight is doable, it should be Ok. :doff
 
I had to do it 2-3 times to gain 1 level.
 
I had to do it 2-3 times to gain 1 level.
So you CAN gain levels that way, but it isn't so much of a cheat. So if you truly want to "abuse" it like that, you'll be fighting for a looong time.
Seems OK to me. :onya
 
Back
Top