summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-07 13:50:56 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-07 13:50:56 +0000
commitcef44b0916ccffb9ac8d24460b302949e7367b04 (patch)
treeea6e258b9360e37b4e5b4954498444b979a3c59e /src/map/pc.c
parentdf4acc64d0b550a5e5201de3ceae7f4c4e210670 (diff)
downloadhercules-cef44b0916ccffb9ac8d24460b302949e7367b04.tar.gz
hercules-cef44b0916ccffb9ac8d24460b302949e7367b04.tar.bz2
hercules-cef44b0916ccffb9ac8d24460b302949e7367b04.tar.xz
hercules-cef44b0916ccffb9ac8d24460b302949e7367b04.zip
* Updated Stone Curse
* Implemented Confusion (50%) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@487 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index b6e4cbbf0..d0563937a 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -685,6 +685,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars
sd->head_dir = 0;
sd->state.auth = 1;
sd->walktimer = -1;
+ sd->next_walktime = -1;
sd->attacktimer = -1;
sd->followtimer = -1; // [MouseJstr]
sd->skilltimer = -1;
@@ -4212,6 +4213,40 @@ int pc_stop_walking(struct map_session_data *sd,int type)
}
/*==========================================
+ * Random walk
+ *------------------------------------------
+ */
+int pc_randomwalk(struct map_session_data *sd,int tick)
+{
+ const int retrycount = 20;
+ nullpo_retr(0, sd);
+
+ if(DIFF_TICK(sd->next_walktime,tick)<0){
+ int i,x,y,c,d;
+ d = rand()%7+5;
+ for(i=0;i<retrycount;i++){ // Search of a movable place
+ int r=rand();
+ x=sd->bl.x+r%(d*2+1)-d;
+ y=sd->bl.y+r/(d*2+1)%(d*2+1)-d;
+ if((c=map_getcell(sd->bl.m,x,y))!=1 && c!=5 && pc_walktoxy(sd,x,y)==0){
+ break;
+ }
+ }
+ // Working on this part later [celest]
+ /*for(i=c=0;i<sd->walkpath.path_len;i++){ // The next walk start time is calculated.
+ if(sd->walkpath.path[i]&1)
+ c+=sd->speed*14/10;
+ else
+ c+=sd->speed;
+ }
+ sd->next_walktime = (d=tick+rand()%3000+c);
+ return d;*/
+ return 1;
+ }
+ return 0;
+}
+
+/*==========================================
*
*------------------------------------------
*/