Jump to content
Sign in to follow this  
Naruto

Brandish Spear Re-work

Recommended Posts

So i had to go over my brandish spear again but figured out most of it 

Can be used a few different ways..... splash on a grid with movement is really smooth with it

 

The results of this modification is my magicalbullet and desperado is a UNT skill 

 

No idea how to explain it other then for you to try it yourself :

 

 

 

struct square {
	int val1[19];
	int val2[19];
};

This number for square should be increased as high as you can if you wanna keep using this square grid... Ill have to verify this later because re declaring it causes issues but its relative to the amount of cells were hitting

static void skill_brandishspear_first(struct square *tc, uint8 dir, int16 x, int16 y)
{
	nullpo_retv(tc);

	if(dir == 0){
		tc->val1[0]=x;
		tc->val1[1]=x+1;
		tc->val1[2]=x-1;
		tc->val1[3]=x;
		tc->val1[4]=x+1;
		tc->val1[5]=x+1;
		tc->val1[6]=x;
		tc->val1[7]=x+1;
		tc->val1[8]=x-1;
		tc->val1[9]=x;
		tc->val1[10]=x+1;
		tc->val1[11]=x-1;
		tc->val1[12]=x;
		tc->val1[13]=x+1;
		tc->val1[14]=x-1;
		tc->val1[15]=x;
		tc->val1[16]=x+1;
		tc->val1[17]=x-1;
		tc->val2[0]=y;
		tc->val2[1]=y;
		tc->val2[2]=y;
		tc->val2[3]=y-1;
		tc->val2[4]=y-1;
		tc->val2[5]=y-1;
		tc->val2[6]=y-2;
		tc->val2[7]=y-2;
		tc->val2[8]=y-2;
		tc->val2[9]=y-3;
		tc->val2[10]=y-3;
		tc->val2[11]=y-3;
		tc->val2[12]=y-4;
		tc->val2[13]=y-4;
		tc->val2[14]=y-4;
		tc->val2[15]=y+1;
		tc->val2[16]=y+1;
		tc->val2[17]=y+1;
	} else if(dir==2){
		tc->val1[0]=x+3;
		tc->val1[1]=x+3;
		tc->val1[2]=x+3;
		tc->val1[3]=x+4;
		tc->val1[4]=x+4;
		tc->val1[5]=x+4;
		tc->val1[6]=x+2;
		tc->val1[7]=x+2;
		tc->val1[8]=x+2;
		tc->val1[9]=x+1;
		tc->val1[10]=x+1;
		tc->val1[11]=x+1;
		tc->val1[12]=x-1;
		tc->val1[13]=x-1;
		tc->val1[14]=x-1;
		tc->val1[15]=x;
		tc->val1[16]=x;
		tc->val1[17]=x;
		tc->val2[0]=y;
		tc->val2[1]=y+1;
		tc->val2[2]=y-1;
		tc->val2[3]=y;
		tc->val2[4]=y+1;
		tc->val2[5]=y+1;
		tc->val2[6]=y;
		tc->val2[7]=y+1;
		tc->val2[8]=y-1;
		tc->val2[9]=y;
		tc->val2[10]=y+1;
		tc->val2[11]=y-1;
		tc->val2[12]=y;
		tc->val2[13]=y+1;
		tc->val2[14]=y-1;
		tc->val2[15]=y;
		tc->val2[16]=y+1;
		tc->val2[17]=y-1;
	} else if(dir==4){
		tc->val1[0]=x;
		tc->val1[1]=x+1;
		tc->val1[2]=x-1;
		tc->val1[3]=x;
		tc->val1[4]=x+1;
		tc->val1[5]=x+1;
		tc->val1[6]=x;
		tc->val1[7]=x+1;
		tc->val1[8]=x-1;
		tc->val1[9]=x;
		tc->val1[10]=x+1;
		tc->val1[11]=x-1;
		tc->val1[12]=x;
		tc->val1[13]=x+1;
		tc->val1[14]=x-1;
		tc->val1[15]=x;
		tc->val1[16]=x+1;
		tc->val1[17]=x-1;
		tc->val2[0]=y;
		tc->val2[1]=y;
		tc->val2[2]=y;
		tc->val2[3]=y+1;
		tc->val2[4]=y+1;
		tc->val2[5]=y+1;
		tc->val2[6]=y+2;
		tc->val2[7]=y+2;
		tc->val2[8]=y+2;
		tc->val2[9]=y+3;
		tc->val2[10]=y+3;
		tc->val2[11]=y+3;
		tc->val2[12]=y+4;
		tc->val2[13]=y+4;
		tc->val2[14]=y+4;
		tc->val2[15]=y-1;
		tc->val2[16]=y-1;
		tc->val2[17]=y-1;
	} else if(dir==6){
		tc->val1[0]=x-3;
		tc->val1[1]=x-3;
		tc->val1[2]=x-3;
		tc->val1[3]=x-4;
		tc->val1[4]=x-4;
		tc->val1[5]=x-4;
		tc->val1[6]=x-2;
		tc->val1[7]=x-2;
		tc->val1[8]=x-2;
		tc->val1[9]=x-1;
		tc->val1[10]=x-1;
		tc->val1[11]=x-1;
		tc->val1[12]=x+1;
		tc->val1[13]=x+1;
		tc->val1[14]=x+1;
		tc->val1[15]=x;
		tc->val1[16]=x;
		tc->val1[17]=x;
		tc->val2[0]=y;
		tc->val2[1]=y+1;
		tc->val2[2]=y-1;
		tc->val2[3]=y;
		tc->val2[4]=y+1;
		tc->val2[5]=y+1;
		tc->val2[6]=y;
		tc->val2[7]=y+1;
		tc->val2[8]=y-1;
		tc->val2[9]=y;
		tc->val2[10]=y+1;
		tc->val2[11]=y-1;
		tc->val2[12]=y;
		tc->val2[13]=y+1;
		tc->val2[14]=y-1;
		tc->val2[15]=y;
		tc->val2[16]=y+1;
		tc->val2[17]=y-1;
	} else if(dir==1){
		tc->val1[0]=x;
		tc->val1[1]=x+1;
		tc->val1[2]=x+2;
		tc->val1[3]=x;
		tc->val1[4]=x;
		tc->val1[5]=x+1;
		tc->val1[6]=x+2;
		tc->val1[7]=x+2;
		tc->val1[8]=x+1;
		tc->val1[9]=x+1;
		tc->val1[10]=x+2;
		tc->val1[11]=x+2;
		tc->val1[12]=x+3;		
		tc->val1[13]=x+3;
		tc->val1[14]=x+3;
		tc->val1[15]=x+4;
		tc->val1[16]=x+3;
		tc->val1[17]=x+4;
		tc->val1[18]=x+4;
		tc->val2[0]=y;
		tc->val2[1]=y;
		tc->val2[2]=y;
		tc->val2[3]=y-1;
		tc->val2[4]=y-2;
		tc->val2[5]=y-1;
		tc->val2[6]=y-1;
		tc->val2[7]=y-2;
		tc->val2[8]=y-2;
		tc->val2[9]=y-3;
		tc->val2[10]=y-3;
		tc->val2[11]=y-4;
		tc->val2[12]=y-4;
		tc->val2[13]=y-1;
		tc->val2[14]=y-2;
		tc->val2[15]=y-2;
		tc->val2[16]=y-3;
		tc->val2[17]=y-3;
		tc->val2[18]=y-4;
	} else if(dir==3){
		tc->val1[0]=x+4;
		tc->val1[1]=x+4;
		tc->val1[2]=x+4;
		tc->val1[3]=x+3;
		tc->val1[4]=x+3;
		tc->val1[5]=x+3;
		tc->val1[6]=x+3;
		tc->val1[7]=x+2;
		tc->val1[8]=x+2;
		tc->val1[9]=x+2;
		tc->val1[10]=x+2;
		tc->val1[11]=x+2;
		tc->val1[12]=x+1;
		tc->val1[13]=x+1;
		tc->val1[14]=x+1;
		tc->val1[15]=x+1;
		tc->val1[16]=x;
		tc->val1[17]=x;
		tc->val1[18]=x;
		tc->val2[0]=y+4;
		tc->val2[1]=y+3;
		tc->val2[2]=y+2;
		tc->val2[3]=y+4;
		tc->val2[4]=y+3;
		tc->val2[5]=y+2;
		tc->val2[6]=y+1;
		tc->val2[7]=y+4;
		tc->val2[8]=y+3;
		tc->val2[9]=y+2;
		tc->val2[10]=y+1;
		tc->val2[11]=y;
		tc->val2[12]=y+3;		
		tc->val2[13]=y+2;
		tc->val2[14]=y+1;
		tc->val2[15]=y;
		tc->val2[16]=y+2;
		tc->val2[17]=y+1;
		tc->val2[18]=y;	
	} else if(dir==5){
		tc->val1[0]=x-4;
		tc->val1[1]=x-3;
		tc->val1[2]=x-2;
		tc->val1[3]=x-4;
		tc->val1[4]=x-3;
		tc->val1[5]=x-2;
		tc->val1[6]=x-1;
		tc->val1[7]=x-4;
		tc->val1[8]=x-3;
		tc->val1[9]=x-2;
		tc->val1[10]=x-1;
		tc->val1[11]=x;
		tc->val1[12]=x-3;		
		tc->val1[13]=x-2;
		tc->val1[14]=x-1;
		tc->val1[15]=x;
		tc->val1[16]=x-2;
		tc->val1[17]=x-1;
		tc->val1[18]=x;
		tc->val2[0]=y+4;
		tc->val2[1]=y+4;
		tc->val2[2]=y+4;
		tc->val2[3]=y+3;
		tc->val2[4]=y+3;
		tc->val2[5]=y+3;
		tc->val2[6]=y+3;
		tc->val2[7]=y+2;
		tc->val2[8]=y+2;
		tc->val2[9]=y+2;
		tc->val2[10]=y+2;
		tc->val2[11]=y+2;
		tc->val2[12]=y+1;
		tc->val2[13]=y+1;
		tc->val2[14]=y+1;
		tc->val2[15]=y+1;
		tc->val2[16]=y;
		tc->val2[17]=y;
		tc->val2[18]=y;
	} else if(dir==7){
		tc->val1[0]=x-4;
		tc->val1[1]=x-3;
		tc->val1[2]=x-2;
		tc->val1[3]=x-4;
		tc->val1[4]=x-3;
		tc->val1[5]=x-2;
		tc->val1[6]=x-1;
		tc->val1[7]=x-4;
		tc->val1[8]=x-3;
		tc->val1[9]=x-2;
		tc->val1[10]=x-1;
		tc->val1[11]=x;
		tc->val1[12]=x-3;		
		tc->val1[13]=x-2;
		tc->val1[14]=x-1;
		tc->val1[15]=x;
		tc->val1[16]=x-2;
		tc->val1[17]=x-1;
		tc->val1[18]=x;
		tc->val2[0]=y-4;
		tc->val2[1]=y-4;
		tc->val2[2]=y-4;
		tc->val2[3]=y-3;
		tc->val2[4]=y-3;
		tc->val2[5]=y-3;
		tc->val2[6]=y-3;
		tc->val2[7]=y-2;
		tc->val2[8]=y-2;
		tc->val2[9]=y-2;
		tc->val2[10]=y-2;
		tc->val2[11]=y-2;
		tc->val2[12]=y-1;
		tc->val2[13]=y-1;
		tc->val2[14]=y-1;
		tc->val2[15]=y-1;
		tc->val2[16]=y;
		tc->val2[17]=y;
		tc->val2[18]=y;
	}

}

this is my grid 

need to make sure you mark the cell YOU ARE STANDING ON if you wanna use it with RANGED 

I cant explain the grid but hold on maybe i can draw it 

1.jpg

basically you have a slot for x and y as you look at this 

		tc->val1[17]=x;
		tc->val1[18]=x;
		tc->val2[0]=y+4;
		tc->val2[1]=y+3;
		tc->val2[2]=y+2;

you see how Y starts after 18 Xs for this direction ? 

so these two would be a pair

		tc->val1[0]=x-4;
		tc->val2[0]=y-4;

Im looking at direction 7 which is...facing the top right from center

 

 

That would be the out most cells

static void skill_brandishspear_dir(struct square *tc, uint8 dir, int are)
{
	int c;
	nullpo_retv(tc);

	for( c = 0; c < 19; c++ ) {
		switch( dir ) {
			case 0:                   tc->val2[c]+=are; break;
			case 1: tc->val1[c]-=are; tc->val2[c]+=are; break;
			case 2: tc->val1[c]-=are;                   break;
			case 3: tc->val1[c]-=are; tc->val2[c]-=are; break;
			case 4:                   tc->val2[c]-=are; break;
			case 5: tc->val1[c]+=are; tc->val2[c]-=are; break;
			case 6: tc->val1[c]+=are;                   break;
			case 7: tc->val1[c]+=are; tc->val2[c]+=are; break;
		}
	}
}

I changed this to increase the max of growth function

	for( c = 0; c < 19; c++ ) {

so now we wont get stack errors 

and finally 

static void skill_brandishspear(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag)
{
	int c,n=0;
	uint8 dir;
	struct square tc;
	int x, y;

	nullpo_retv(bl);
	x = bl->x;
	y = bl->y;
	dir = map->calc_dir(src, x, y);
	skill->brandishspear_first(&tc,dir,x,y);
	skill->brandishspear_dir(&tc,dir,4);
	skill->area_temp[1] = bl->id;

	for(c=0;c<19;c++){
		if(c==0||c==19) skill->brandishspear_dir(&tc,dir,-1);
		map->foreachincell(skill->area_sub,
			bl->m,tc.val1[c%19],tc.val2[c%19],BL_CHAR,
			src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
			skill->castend_damage_id);
	}
}

first line

	int c,n=0;

No idea what N does but to me it is useless, im pretty sure N is the amount of tiers in brandish spear.. lvl 1 3 7 and 9

 

	skill->brandishspear_dir(&tc,dir,4);

So this is why its flipped, the final number is the placement , so if you set it to 0, it would be closer to you... its weird but id leave it -4 for the same results that i get 

for(c=0;c<19;c++){
		if(c==0||c==19) skill->brandishspear_dir(&tc,dir,-1);
		map->foreachincell(skill->area_sub,
			bl->m,tc.val1[c%19],tc.val2[c%19],BL_CHAR,
			src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
			skill->castend_damage_id);
	}

finally set all these otherwise just get stack errors

 

 

 

so if you wanna re use it which ill verify, you just need to set a large struct sqaure and youll be all good

 

Edited by Naruto

Share this post


Link to post
Share on other sites
	skill->brandishspear_dir(&tc,dir,4);

2 things

correction from original post : 

Quote

 So this is why its flipped, the final number is the placement , so if you set it to 0, it would be closer to you... its weird but id leave it -4 for the same results that i get 



I wrote -4 as a test and wrote it all up with it, but -4 would be back wards and 4 would be forward

 

and 2)

setting this to 0 caused some tile error with what i posted, probably fix able but would be a waste ? weird

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.