Click Me For New Forum
This forum is now a read only archive. You can view the contents but you will not be able to make new posts and registration is closed to new members. Please visit our new forum at www.aranockonline.com/forum where our community is now based. Thank you for your patience!
Click Me For New Forum
This forum is now a read only archive. You can view the contents but you will not be able to make new posts and registration is closed to new members. Please visit our new forum at www.aranockonline.com/forum where our community is now based. Thank you for your patience!
Click Me For New Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.


....Our community has moved to a new home. Please follow the link above. This forum is read only for posperity....
 
HomePortalLatest imagesRegisterLog in

 

 Game mechanics...

Go down 
3 posters
AuthorMessage
Cyiane




Posts : 26
Join date : 2010-02-23

Game mechanics... Empty
PostSubject: Game mechanics...   Game mechanics... Icon_minitimeThu Mar 01, 2012 4:19 pm

So, Punchingbag and I started playing around trying to figure some hard math on resist and immunity.

As it turns out, immunity is one hard sucker to track down, it seems as though we nailed Resist down though.

LL, would you be able to do some digging in the code for us for a formula as to how resistance and immunity both work? And in what order they're applied - ei a resistance check is made, then immunity reduces the spell power, or vice versa?

Any and all help would be greatly appreciated Very Happy
Back to top Go down
flipper

flipper


Posts : 1077
Join date : 2009-10-15
Age : 53
Location : Oregon, US

Game mechanics... Empty
PostSubject: Re: Game mechanics...   Game mechanics... Icon_minitimeThu Mar 01, 2012 5:51 pm

Power-(Imm/2)+race bonus
Back to top Go down
Cyiane




Posts : 26
Join date : 2010-02-23

Game mechanics... Empty
PostSubject: Re: Game mechanics...   Game mechanics... Icon_minitimeThu Mar 01, 2012 6:21 pm

Sweet thanks. Have any other formulas you wouldn't mind sharing? Very Happy

-edit-

Do you know the resistance formulas?
Back to top Go down
flipper

flipper


Posts : 1077
Join date : 2009-10-15
Age : 53
Location : Oregon, US

Game mechanics... Empty
PostSubject: Re: Game mechanics...   Game mechanics... Icon_minitimeThu Mar 01, 2012 9:00 pm


I need to decipher from a conversation from ratheart a while back

Back to top Go down
Cyiane




Posts : 26
Join date : 2010-02-23

Game mechanics... Empty
PostSubject: Re: Game mechanics...   Game mechanics... Icon_minitimeFri Mar 02, 2012 7:29 am

So after some digging in the old v2 source I found the curse and stun code... But I can't quite pin it down.

Anyone competent in C able to help out?

Stun code
Code:


int spell_stun(int cn,int co,int power)
{
        int in;

        if (ch[co].flags&CF_IMMORTAL) return 0;

        in=god_create_item(1);
        if (!in) { xlog("god_create_item failed in skill_stun"); return 0; }

        power=spell_immunity(power,ch[co].skill[SK_IMMUN][5]);

   power=spell_race_mod(power,ch[cn].kindred);
        strcpy(it[in].name,"Stun");
        it[in].flags|=IF_SPELL;
        it[in].sprite[1]=91;
        it[in].duration=it[in].active=power+TICKS;
        it[in].temp=SK_STUN;
        it[in].power=power;

        if (ch[co].skill[SK_SENSE][5]+10>power)
                do_char_log(co,1,"%s cast stun on you.\n",ch[cn].reference);
        else do_char_log(co,0,"You have been stunned.\n");
        do_char_log(cn,1,"%s was stunned.\n",ch[co].reference);
        if (!IS_IGNORING_SPELLS(co)) do_notify_char(co,NT_GOTHIT,cn,0,0,0);
        do_notify_char(cn,NT_DIDHIT,co,0,0,0);
        char_play_sound(co,ch[cn].sound+7,-150,0);
        char_play_sound(cn,ch[cn].sound+1,-150,0);
        chlog(cn,"Cast Stun on %s",ch[co].name);
        if (!add_spell(co,in)) {
                do_char_log(cn,1,"Magical interference neutralised the %s's effect.\n",it[in].name);
                return 0;
        }

        fx_add_effect(5,0,ch[co].x,ch[co].y,0);

        return 1;
}

void skill_stun(int cn)
{
        int co,m,co_orig;

        if ((co=ch[cn].skill_target1)) ;
        else if (ch[cn].attack_cn!=0) co=ch[cn].attack_cn;
        else co=cn;

        if (cn==co) { do_char_log(cn,0,"You cannot stun yourself!\n"); return; }

        if (!do_char_can_see(cn,co)) {
                do_char_log(cn,0,"You cannot see your target.\n");
                return;
        }

        /* CS, 000209: Remember PvP attacks */
        remember_pvp(cn,co);
        if (is_exhausted(cn)) return;

        if (!may_attack_msg(cn,co,1)) {
                chlog(cn,"Prevented from attacking %s (%d)",ch[co].name,co);
                return;
        }

        if (spellcost(cn,20)) return;

        if (chance_base(cn,ch[cn].skill[SK_STUN][5],12,ch[co].skill[SK_RESIST][5])) {
                if (cn!=co && ch[co].skill[SK_SENSE][5]>ch[cn].skill[SK_STUN][5]+5) {
                        do_char_log(co,1,"%s tried to cast stun on you but failed.\n",ch[cn].reference);
                        if (!IS_IGNORING_SPELLS(co)) do_notify_char(co,NT_GOTMISS,cn,0,0,0);
                }
                return;
        }

        if (ch[co].flags&CF_IMMORTAL) {
                do_char_log(cn,0,"You lost your focus.\n");
                return;
        }
        spell_stun(cn,co,ch[cn].skill[SK_STUN][5]);

        co_orig=co;

        m=ch[cn].x+ch[cn].y*MAPX;
        if ((co=map[m+1].ch)!=0 && ch[co].attack_cn==cn && co_orig!=co) {
                if (ch[cn].skill[SK_STUN][5]+RANDOM(20)>ch[co].skill[SK_RESIST][5]+RANDOM(20)) spell_stun(cn,co,ch[cn].skill[SK_STUN][5]);
        }
        if ((co=map[m-1].ch)!=0 && ch[co].attack_cn==cn && co_orig!=co) {
                if (ch[cn].skill[SK_STUN][5]+RANDOM(20)>ch[co].skill[SK_RESIST][5]+RANDOM(20)) spell_stun(cn,co,ch[cn].skill[SK_STUN][5]);
        }
        if ((co=map[m+MAPX].ch)!=0 && ch[co].attack_cn==cn && co_orig!=co) {
                if (ch[cn].skill[SK_STUN][5]+RANDOM(20)>ch[co].skill[SK_RESIST][5]+RANDOM(20)) spell_stun(cn,co,ch[cn].skill[SK_STUN][5]);
        }
        if ((co=map[m-MAPX].ch)!=0 && ch[co].attack_cn==cn && co_orig!=co) {
                if (ch[cn].skill[SK_STUN][5]+RANDOM(20)>ch[co].skill[SK_RESIST][5]+RANDOM(20)) spell_stun(cn,co,ch[cn].skill[SK_STUN][5]);
        }

        fx_add_effect(7,0,ch[cn].x,ch[cn].y,0);

        add_exhaust(cn,TICKS*3);

//      ch[cn].errno=ERR_SUCCESS;

And curse

Code:


int spell_curse(int cn,int co,int power)
{
        int in,n;

        if (ch[co].flags&CF_IMMORTAL) return 0;

        in=god_create_item(1);
        if (!in) { xlog("god_create_item failed in spell_curse"); return 0; }

        power=spell_immunity(power,ch[co].skill[SK_IMMUN][5]);

   power=spell_race_mod(power,ch[cn].kindred);
        strcpy(it[in].name,"Curse");
        it[in].flags|=IF_SPELL;
        for (n=0; n<5; n++)
                it[in].attrib[n][1]=-(power/3); //(power/3+10);
        it[in].sprite[1]=89;
        it[in].duration=it[in].active=18*60*2;
        it[in].temp=SK_CURSE;
        it[in].power=power;

        if (!add_spell(co,in))  {
                do_char_log(cn,1,"Magical interference neutralised the %s's effect.\n",it[in].name);
                return 0;
        }
        if (ch[co].skill[SK_SENSE][5]+10>power)
                do_char_log(co,1,"%s cast curse on you.\n",ch[cn].reference);
        else
                do_char_log(co,0,"You have been cursed.\n");
        do_char_log(cn,1,"%s was cursed.\n",ch[co].name);
        if (!IS_IGNORING_SPELLS(co)) do_notify_char(co,NT_GOTHIT,cn,0,0,0);
        do_notify_char(cn,NT_DIDHIT,co,0,0,0);
        char_play_sound(co,ch[cn].sound+7,-150,0);
        char_play_sound(cn,ch[cn].sound+1,-150,0);
        chlog(cn,"Cast Curse on %s",ch[co].name);
        fx_add_effect(5,0,ch[co].x,ch[co].y,0);

        return 1;
}

void skill_curse(int cn)
{
        int co,co_orig,m;

        if ((co=ch[cn].skill_target1)) ;
        else if (ch[cn].attack_cn!=0) co=ch[cn].attack_cn;
        else co=cn;

        if (cn==co) { do_char_log(cn,0,"You cannot curse yourself!\n"); return; }

        if (!do_char_can_see(cn,co)) {
                do_char_log(cn,0,"You cannot see your target.\n");
                return;
        }

        /* CS, 000209: Remember PvP attacks */
        remember_pvp(cn,co);
        if (is_exhausted(cn)) return;

        if (spellcost(cn,35)) return;

        if (!may_attack_msg(cn,co,1)) {
                chlog(cn,"Prevented from attacking %s (%d)",ch[co].name,co);
                return;
        }

        if (chance_base(cn,ch[cn].skill[SK_CURSE][5],10,ch[co].skill[SK_RESIST][5])) {
                if (cn!=co && ch[co].skill[SK_SENSE][5]>ch[cn].skill[SK_CURSE][5]+5) {
                        do_char_log(co,0,"%s tried to cast curse on you but failed.\n",ch[cn].reference);
                        if (!IS_IGNORING_SPELLS(co)) do_notify_char(co,NT_GOTMISS,cn,0,0,0);
                }
                return;
        }

        if (ch[co].flags&CF_IMMORTAL) {
                do_char_log(cn,0,"You lost your focus.\n");
                return;
        }

        spell_curse(cn,co,ch[cn].skill[SK_CURSE][5]);

        co_orig=co;

        m=ch[cn].x+ch[cn].y*MAPX;
        if ((co=map[m+1].ch)!=0 && ch[co].attack_cn==cn && co_orig!=co) {
                if (ch[cn].skill[SK_CURSE][5]+RANDOM(20)>ch[co].skill[SK_RESIST][5]+RANDOM(20)) spell_curse(cn,co,ch[cn].skill[SK_CURSE][5]);
        }
        if ((co=map[m-1].ch)!=0 && ch[co].attack_cn==cn && co_orig!=co) {
                if (ch[cn].skill[SK_CURSE][5]+RANDOM(20)>ch[co].skill[SK_RESIST][5]+RANDOM(20)) spell_curse(cn,co,ch[cn].skill[SK_CURSE][5]);
        }
        if ((co=map[m+MAPX].ch)!=0 && ch[co].attack_cn==cn && co_orig!=co) {
                if (ch[cn].skill[SK_CURSE][5]+RANDOM(20)>ch[co].skill[SK_RESIST][5]+RANDOM(20)) spell_curse(cn,co,ch[cn].skill[SK_CURSE][5]);
        }
        if ((co=map[m-MAPX].ch)!=0 && ch[co].attack_cn==cn && co_orig!=co) {
                if (ch[cn].skill[SK_CURSE][5]+RANDOM(20)>ch[co].skill[SK_RESIST][5]+RANDOM(20)) spell_curse(cn,co,ch[cn].skill[SK_CURSE][5]);
        }

        fx_add_effect(7,0,ch[cn].x,ch[cn].y,0);

        add_exhaust(cn,TICKS*4);

//      ch[cn].errno=ERR_SUCCESS;
Thanks again!
Back to top Go down
Shinra




Posts : 3
Join date : 2012-02-28

Game mechanics... Empty
PostSubject: Re: Game mechanics...   Game mechanics... Icon_minitimeFri Mar 02, 2012 8:07 am

Did one testing once on curse results, confirming what flipper said.

Note: This is cast from a hara with no spell bonus.

Game mechanics... Immunity

Game mechanics... Immunity2

So 150 mod curse on you will lower your base attributes by 50, and lowering all your normal skills by 30.


Back to top Go down
Sponsored content





Game mechanics... Empty
PostSubject: Re: Game mechanics...   Game mechanics... Icon_minitime

Back to top Go down
 
Game mechanics...
Back to top 
Page 1 of 1
 Similar topics
-
» Game Mechanics List Discussion
» Bless mechanics
» Game is down
» Game is down
» Game down

Permissions in this forum:You cannot reply to topics in this forum
Click Me For New Forum  :: Game Chat :: Technical-
Jump to: