Example #1
0
// checks for "bad" words in player talking and mutes them
void player_analyser(int cn,char *text)
{
	if (ch[cn].flags&CF_SHUTUP) return;

        if (is_badword(text)) {
		ch[cn].data[72]+=TICKS*50;
		if (ch[cn].data[72]>TICKS*120) {
			do_char_log(cn,0,"Don't say I didn't warn you. Now I'll shut your mouth for you!\n");
			ch[cn].flags|=CF_SHUTUP;
			chlog(cn,"Auto-Shutup for \"%s\" (%d)",text,ch[cn].data[72]/TICKS);
		} else if (ch[cn].data[72]>TICKS*80) {
			do_char_log(cn,0,"My, what a filthy mouth you have. You'd better keep it closed for a while!\n");
			chlog(cn,"Bad-Mouth warning for \"%s\" (%d)",text,ch[cn].data[72]/TICKS);
		}
	}
}
Example #2
0
/* flip a switch in Lab 9 */
int use_lab9_switch(int cn, int in)
{
        chlog(cn, "flipped a switch.");
        it[in].data[1] = !it[in].data[1];
        do_area_sound(0,0,it[in].x,it[in].y,10);
        if (lab9_check_door(it[in].data[0])) {
                do_char_log(cn, 2, "You hear a door open nearby.\n");
        }
        return 1;
}
Example #3
0
void use_labtransfer2(int cn,int co)
{
	int cc;

	if (IS_COMPANION(cn) && (cc=ch[cn].data[63])==ch[co].data[0]) {
		do_char_log(cc,0,"Your Companion killed your enemy.\n");
		finish_laby_teleport(cc,ch[co].data[1],ch[co].data[2]);
		god_transfer_char(cn,512,512);
		chlog(cc,"Labkeeper room solved by GC");
		return;
	}
        if (ch[co].data[0]!=cn) {
                do_char_log(cn,0,"Sorry, this killing does not count, as you're not the designated killer.\n");
		chlog(cn,"Sorry, this killing does not count, as you're not the designated killer");
                return;
        }
        finish_laby_teleport(cn,ch[co].data[1],ch[co].data[2]);
	chlog(cn,"Solved Labkeeper Room");

	if ((cc=ch[cn].data[64]) && IS_SANENPC(cc) && IS_COMPANION(cc)) 	// transfer GC as well
		god_transfer_char(cc,512,512);	
}
Example #4
0
void effect_tick(void)
{
	int n,cnt=0,in,m,co,fn,cn,in2,flag,z;

	for (n=1; n<MAXEFFECT; n++) {
		if (fx[n].used==USE_EMPTY) continue;
		cnt++;
		if (fx[n].used!=USE_ACTIVE) continue;

		if (fx[n].type==1) {	// remove injury flag from map
			fx[n].duration--;
			if (fx[n].duration==0) {
				fx[n].used=USE_EMPTY;
				map[fx[n].data[0]+fx[n].data[1]*MAPX].flags&=~(MF_GFX_INJURED|MF_GFX_INJURED1|MF_GFX_INJURED2);
			}
		}

		if (fx[n].type==2) {	// timer for character respawn
			if (fx[n].duration) fx[n].duration--;
			if (fx[n].duration==0 && plr_check_target(fx[n].data[0]+fx[n].data[1]*MAPX)) {
				m=fx[n].data[0]+fx[n].data[1]*MAPX;
				map[m].flags|=MF_MOVEBLOCK;
				fx[n].type=8;
			}
		}

		if (fx[n].type==3) {	// death mist
			fx[n].duration++;
			if (fx[n].duration==19) {

				fx[n].used=0;

				m=fx[n].data[0]+fx[n].data[1]*MAPX;
				map[m].flags&=~MF_GFX_DEATH;
			} else {
				m=fx[n].data[0]+fx[n].data[1]*MAPX;
				map[m].flags&=~MF_GFX_DEATH;
				map[m].flags|=((unsigned long long)fx[n].duration)<<40;

				if (fx[n].duration==9) {
					plr_map_remove(fx[n].data[2]);

					if (can_drop(m)) ;
					else if (can_drop(m+1)) m+=1;
					else if (can_drop(m-1)) m+=-1;
					else if (can_drop(m+MAPX)) m+=MAPX;
					else if (can_drop(m-MAPX)) m+=-MAPX;
					else if (can_drop(m+1+MAPX)) m+=1+MAPX;
					else if (can_drop(m+1-MAPX)) m+=1-MAPX;
					else if (can_drop(m-1+MAPX)) m+=-1+MAPX;
					else if (can_drop(m-1-MAPX)) m+=-1-MAPX;
					else if (can_drop(m+2)) m+=2;
					else if (can_drop(m-2)) m+=-2;
					else if (can_drop(m+2*MAPX)) m+=2*MAPX;
					else if (can_drop(m-2*MAPX)) m+=-2*MAPX;
					else if (can_drop(m+2+MAPX)) m+=2+MAPX;
					else if (can_drop(m+2-MAPX)) m+=2-MAPX;
					else if (can_drop(m-2+MAPX)) m+=-2+MAPX;
					else if (can_drop(m-2-MAPX)) m+=-2-MAPX;
					else if (can_drop(m+1+2*MAPX)) m+=1+2*MAPX;
					else if (can_drop(m+1-2*MAPX)) m+=1-2*MAPX;
					else if (can_drop(m-1+2*MAPX)) m+=-1+2*MAPX;
					else if (can_drop(m-1-2*MAPX)) m+=-1-2*MAPX;
					else if (can_drop(m+2+2*MAPX)) m+=2+2*MAPX;
					else if (can_drop(m+2-2*MAPX)) m+=2-2*MAPX;
					else if (can_drop(m-2+2*MAPX)) m+=-2+2*MAPX;
					else if (can_drop(m-2-2*MAPX)) m+=-2-2*MAPX;
					else {
						int temp;

						co=fx[n].data[2];
						temp=ch[co].temp;
						
						chlog(co,"could not drop grave");

						god_destroy_items(co);
						ch[co].used=USE_EMPTY;
						
						if (ch[co].flags&CF_RESPAWN)
							fx_add_effect(2,TICKS*60*5+RANDOM(TICKS*60*10),ch_temp[temp].x,ch_temp[temp].y,temp);
						m=0;
					}

					if (m) {
						co=fx[n].data[2];

						flag=0;
						for (z=0; z<40 && !flag; z++) {
							if (ch[co].item[z]) { flag=1; break; }
						}
						for (z=0; z<20 && !flag; z++) {
							if (ch[co].worn[z]) { flag=1; break; }
						}
						if (ch[co].citem) flag=1;
						if (ch[co].gold) flag=1;
						
                                                if (flag) {
							map[m].flags|=MF_MOVEBLOCK;
							fn=fx_add_effect(4,0,m%MAPX,m/MAPX,fx[n].data[2]);
							fx[fn].data[3]=fx[n].data[3];
						} else {
							int temp;

							temp=ch[co].temp;

							god_destroy_items(co);
							ch[co].used=USE_EMPTY;

							if (temp && (ch[co].flags&CF_RESPAWN)) {
                                                                if (temp==189 || temp==561) {
									fx_add_effect(2,TICKS*60*20+RANDOM(TICKS*60*5),ch_temp[temp].x,ch_temp[temp].y,temp);									
                                                                } else {
									fx_add_effect(2,TICKS*60*4+RANDOM(TICKS*60*1),ch_temp[temp].x,ch_temp[temp].y,temp);
								}
								xlog("respawn %d (%s): YES",co,ch[co].name);
                                                        } else xlog("respawn %d (%s): NO",co,ch[co].name);
						}
					}
				}
			}
		}

		if (fx[n].type==4) {	// tomb stone
			fx[n].duration++;
			if (fx[n].duration==29) {

				fx[n].used=USE_EMPTY;
				
				co=fx[n].data[2];
				
				m=fx[n].data[0]+fx[n].data[1]*MAPX;
				map[m].flags&=~MF_GFX_TOMB;
				map[m].flags&=~MF_MOVEBLOCK;								

				in=god_create_item(170);				
				it[in].data[0]=co;
				if (ch[co].data[99]) it[in].max_age[0]*=4;

				sprintf(it[in].description,"Here rests %s, killed by %s on the %d%s%s%s%s day of the Year %d.",
					ch[co].reference,
					fx[n].data[3] ? ch[fx[n].data[3]].reference : "unknown causes",
					globs->mdday,
					(globs->mdday==1 ? "st" : ""),
					(globs->mdday==2 ? "nd" : ""),
					(globs->mdday==3 ? "rd" : ""),
					(globs->mdday>3 ? "th" : ""),
					globs->mdyear);
				god_drop_item(in,fx[n].data[0],fx[n].data[1]);
				ch[co].x=it[in].x;
				ch[co].y=it[in].y;
				
				chlog(co,"grave done");
			} else {
				m=fx[n].data[0]+fx[n].data[1]*MAPX;
				map[m].flags&=~MF_GFX_TOMB;
				map[m].flags|=((unsigned long long)fx[n].duration)<<35;
			}
		}

		if (fx[n].type==5) {	// evil magic
			fx[n].duration++;
			m=fx[n].data[0]+fx[n].data[1]*MAPX;
			if (fx[n].duration==8) {

				fx[n].used=USE_EMPTY;
				map[m].flags&=~MF_GFX_EMAGIC;
			} else {
				map[m].flags&=~MF_GFX_EMAGIC;
				map[m].flags|=((unsigned long long)fx[n].duration)<<45;
			}
		}

		if (fx[n].type==6) {	// good magic
			fx[n].duration++;
			m=fx[n].data[0]+fx[n].data[1]*MAPX;
			if (fx[n].duration==8) {

				fx[n].used=USE_EMPTY;
				map[m].flags&=~MF_GFX_GMAGIC;
			} else {
				map[m].flags&=~MF_GFX_GMAGIC;
				map[m].flags|=((unsigned long long)fx[n].duration)<<48;
			}
		}

		if (fx[n].type==7) {	// caster magic
			fx[n].duration++;
			m=fx[n].data[0]+fx[n].data[1]*MAPX;
			if (fx[n].duration==8) {
				fx[n].used=USE_EMPTY;
				map[m].flags&=~MF_GFX_CMAGIC;
			} else {
				map[m].flags&=~MF_GFX_CMAGIC;
				map[m].flags|=((unsigned long long)fx[n].duration)<<51;
			}
		}

		if (fx[n].type==8) {	// repawn mist
			fx[n].duration++;
			if (fx[n].duration==19) {
				fx[n].used=0;
				m=fx[n].data[0]+fx[n].data[1]*MAPX;
				map[m].flags&=~MF_GFX_DEATH;
			} else {
				m=fx[n].data[0]+fx[n].data[1]*MAPX;
				map[m].flags&=~MF_GFX_DEATH;
				map[m].flags|=((unsigned long long)fx[n].duration)<<40;
				if (fx[n].duration==9) {
					m=fx[n].data[0]+fx[n].data[1]*MAPX;
					map[m].flags&=~MF_MOVEBLOCK;
					if (!pop_create_char(fx[n].data[2],1) && (ch_temp[fx[n].data[2]].flags&CF_RESPAWN)) {
						fx[n].type=2;
						fx[n].duration=TICKS*60*5;	// try again every 5 minutes
						map[m].flags&=~MF_GFX_DEATH;
					}
				}
			}
		}
		if (fx[n].type==9) {	// controlled item animation with optional monster creation
			fx[n].duration--;
			in=fx[n].data[0];
			if (!(fx[n].duration&1))
				it[in].status[1]++;

			if (fx[n].duration==0) {
				map[it[in].x+it[in].y*MAPX].it=0;
				if (fx[n].data[1]) {
					cn=pop_create_char(fx[n].data[1],0);
					god_drop_char(cn,it[in].x,it[in].y);
					ch[cn].dir=DX_RIGHTUP;
					plr_reset_status(cn);
				}
				fx[n].used=USE_EMPTY;
				it[in].used=USE_EMPTY;
			}
		}
		if (fx[n].type==10) { // respawn object
			if (fx[n].duration) fx[n].duration--;
			else {
				m=fx[n].data[0]+fx[n].data[1]*MAPX;

				// check if object isnt allowed to respawn (supporting beams for mine)
				if (is_beam(map[m].it) ||
				    is_beam(map[m-1].it) || is_beam(map[m+1].it) ||
				    is_beam(map[m-MAPX].it) || is_beam(map[m+MAPX].it) ||
				
				    is_beam(map[m-2].it) || is_beam(map[m+2].it) ||
				    is_beam(map[m-2*MAPX].it) || is_beam(map[m+2*MAPX].it) ||
				
				    is_beam(map[m-1+1*MAPX].it) || is_beam(map[m+1+1*MAPX].it) ||
				    is_beam(map[m-1-1*MAPX].it) || is_beam(map[m+1-1*MAPX].it) ||
				
				    is_beam(map[m-2+1*MAPX].it) || is_beam(map[m+2+1*MAPX].it) ||
				    is_beam(map[m-2-1*MAPX].it) || is_beam(map[m+2-1*MAPX].it) ||
				
				    is_beam(map[m-1+2*MAPX].it) || is_beam(map[m+1+2*MAPX].it) ||
				    is_beam(map[m-1-2*MAPX].it) || is_beam(map[m+1-2*MAPX].it) ||
				
				    is_beam(map[m-2+2*MAPX].it) || is_beam(map[m+2+2*MAPX].it) ||
				    is_beam(map[m-2-2*MAPX].it) || is_beam(map[m+2-2*MAPX].it)) {
					fx[n].duration=TICKS*60*15;
					continue;
				}
				in2=map[m].it;
				map[m].it=0;

				in=god_create_item(fx[n].data[2]);

				if (!god_drop_item(in,fx[n].data[0],fx[n].data[1])) {
					fx[n].duration=TICKS*60;
					it[in].used=USE_EMPTY;
					map[m].it=in2;
				} else {
					fx[n].used=USE_EMPTY;
					if (in2) it[in2].used=USE_EMPTY;
					reset_go(fx[n].data[0],fx[n].data[1]);
				}
			}
		}
		if (fx[n].type==11) {	// remove queued spell flags
			fx[n].duration--;
			if (fx[n].duration<1) {
				fx[n].used=USE_EMPTY;
				ch[fx[n].data[0]].data[96]&=~fx[n].data[1];
			}
		}
                if (fx[n].type==12) {	// death mist
			fx[n].duration++;
			if (fx[n].duration==19) {

				fx[n].used=0;

				m=fx[n].data[0]+fx[n].data[1]*MAPX;
				map[m].flags&=~MF_GFX_DEATH;
			} else {

				m=fx[n].data[0]+fx[n].data[1]*MAPX;
				map[m].flags&=~MF_GFX_DEATH;
				map[m].flags|=((unsigned long long)fx[n].duration)<<40;
                        }

		}
	}
	globs->effect_cnt=cnt;
}
Example #5
0
/*	Added by SoulHunter  04.04.2000	*/
int pop_create_bonus_belt(int cn)
{
	int n = 1106;   // value to store id-number of created belt
	                // at start it contains template of 'rainbow_belt'
	int i, j;
	int rank, skill_value, skill_number;


//	item will be created with chance 1 from 10000
//	if (RANDOM(10000)) return 0;
//      it is moved outside the function cause item is rarely created
//      but function is called each time when NPC respawning.
//	so it will be much faster if it will check for chances before
//	the function call

	// MAX_POWER = rank
	// MAX_SKILLS = rank
	rank = points2rank(ch[cn].points_tot);  // private wont get this belt
	if(!rank)
	{
		return( 0);                     //

	}
	if (n)
	{
		n = god_create_item(n);   // creating belt from template
		if(!n)
		{
			return( 0);     // return if failed
		}
		// problem is if we keep template for newly created and
		// then changed item, it sometimes doesnt keep changes
		// we need template number for is_belt() function
		// but seems there is some checks by template so we reset it
		// and people wont notice belt :)
		it[n].temp = 0; // clearing template
		it[n].sprite[0] = 16964;
		strcpy(it[n].name, "Rainbow Belt");
		strcpy(it[n].description, "An ancient belt. It seems to be highly magical");
		strcpy(it[n].reference, "rainbow belt");
		// putting message about created belt into log-file
		chlog(cn, ", with rank %d, got %s (t=%d)", rank, it[n].name, it[n].temp);
	}

	j = RANDOM(rank); // how many skills will be in belt?
	if(j==0)
	{
		j = 1;          //
	}
	it[n].power += 5 * j;     // counting power of item, *remind* power = 10 in template
	it[n].value += 10000 * j; // counting price value, value = 100 in template
	// here we decide which skills will be in belt, not more than rank
	for(i = 0; i < j; i++)
	{
		skill_number = RANDOM(39); // which skill it will be
		skill_value  = RANDOM(rank);    // with that value of skill
		skill_value  = skill_value >> 1; // divide it by 2, cause it cant be more than 12 (max_rank/2)
		if(skill_value == 0)
		{
			skill_value = 1;              // and cant be zero
		}
		// the following code put all these skills in belt
		// sometimes requirements are zeroed, cause if we have, in example,
		// dagger and sword skills in belt, this belt can be used only by
		// templar/seyan, but i dont want this
		switch(skill_number)
		{
		case 0:
			// this line is how much it will raise attribute
			it[n].attrib[AT_BRAVE][0] += skill_value;
			// this will check for max level = 12
			// and if it is reached, will down it back to 12
			if(it[n].attrib[AT_BRAVE][0] > 12)
			{
				it[n].attrib[AT_BRAVE][0] = 12;
			}
			// this line will set requirements
			it[n].attrib[AT_BRAVE][2] = 10 +
			                            (it[n].attrib[AT_BRAVE][0] * RANDOM(7));
			break;
		case 1:
			it[n].attrib[AT_WILL][0] += skill_value;
			if(it[n].attrib[AT_WILL][0] > 12)
			{
				it[n].attrib[AT_WILL][0] = 12;
			}
			it[n].attrib[AT_WILL][2] = 10 +
			                           (it[n].attrib[AT_WILL][0] * RANDOM(7));
			break;
		case 2:
			it[n].attrib[AT_INT][0] += skill_value;
			if(it[n].attrib[AT_INT][0] > 12)
			{
				it[n].attrib[AT_INT][0] = 12;
			}
			it[n].attrib[AT_INT][2] = 10 +
			                          (it[n].attrib[AT_INT][0] * RANDOM(7));
			break;
		case 3:
			it[n].attrib[AT_AGIL][0] += skill_value;
			if(it[n].attrib[AT_AGIL][0] > 12)
			{
				it[n].attrib[AT_AGIL][0] = 12;
			}
			it[n].attrib[AT_AGIL][2] = 10 +
			                           (it[n].attrib[AT_AGIL][0] * RANDOM(7));
			break;
		case 4:
			it[n].attrib[AT_STREN][0] += skill_value;
			if(it[n].attrib[AT_STREN][0] > 12)
			{
				it[n].attrib[AT_STREN][0] = 12;
			}
			it[n].attrib[AT_STREN][2] = 10 +
			                            (it[n].attrib[AT_STREN][0] * RANDOM(7));
			break;
		case 5:
			it[n].hp[0] += (skill_value * 5);
			if(it[n].hp[0] > 60)
			{
				it[n].hp[0] = 60;
			}
			it[n].hp[2] = 50 +
			              (it[n].hp[0] * RANDOM(7));
			break;
		case 6:
			it[n].end[0] += (skill_value * 5);
			if(it[n].end[0] > 60)
			{
				it[n].end[0] = 60;
			}
			it[n].end[2] = 50 +
			               (it[n].end[0] * RANDOM(7));
			break;
		case 7:
			it[n].mana[0] += (skill_value * 5);
			if(it[n].mana[0] > 60)
			{
				it[n].mana[0] = 60;
			}
			it[n].mana[2] = 50 +
			                (it[n].mana[0] * RANDOM(7));
			break;
		case 8:
			it[n].armor[0] += skill_value;
			if(it[n].armor[0] > 12)
			{
				it[n].armor[0] = 12;
			}
			break;
		case 9:
			it[n].skill[SK_WARCRY][0] += skill_value;
			if(it[n].skill[SK_WARCRY][0] > 12)
			{
				it[n].skill[SK_WARCRY][0] = 12;
			}
			break;
		case 10:
			it[n].skill[SK_HAND][0] += skill_value;
			if(it[n].skill[SK_HAND][0] > 12)
			{
				it[n].skill[SK_HAND][0] = 12;
			}
			it[n].skill[SK_HAND][2] =
				(it[n].skill[SK_HAND][0] * RANDOM(7));
			break;
		case 11:
			it[n].skill[SK_SWORD][0] += skill_value;
			if(it[n].skill[SK_SWORD][0] > 12)
			{
				it[n].skill[SK_SWORD][0] = 12;
			}
			break;
		case 12:
			it[n].skill[SK_DAGGER][0] += skill_value;
			if(it[n].skill[SK_DAGGER][0] > 12)
			{
				it[n].skill[SK_DAGGER][0] = 12;
			}
			break;
		case 13:
			it[n].skill[SK_TWOHAND][0] += skill_value;
			if(it[n].skill[SK_TWOHAND][0] > 12)
			{
				it[n].skill[SK_TWOHAND][0] = 12;
			}
			break;
		case 14:
			it[n].skill[SK_LOCK][0] += skill_value;
			if(it[n].skill[SK_LOCK][0] > 12)
			{
				it[n].skill[SK_LOCK][0] = 12;
			}
			it[n].skill[SK_LOCK][2] =
				(it[n].skill[SK_LOCK][0] * RANDOM(7));
			break;
		case 15:
			it[n].skill[SK_STEALTH][0] += skill_value;
			if(it[n].skill[SK_STEALTH][0] > 12)
			{
				it[n].skill[SK_STEALTH][0] = 12;
			}
			break;
		case 16:
			it[n].skill[SK_PERCEPT][0] += skill_value;
			if(it[n].skill[SK_PERCEPT][0] > 12)
			{
				it[n].skill[SK_PERCEPT][0] = 12;
			}
			it[n].skill[SK_PERCEPT][2] =
				(it[n].skill[SK_PERCEPT][0] * RANDOM(7));
			break;
		case 17:
			it[n].skill[SK_MSHIELD][0] += skill_value;
			if(it[n].skill[SK_MSHIELD][0] > 12)
			{
				it[n].skill[SK_MSHIELD][0] = 12;
			}
			break;
		case 18:
			it[n].skill[SK_BARTER][0] += skill_value;
			if(it[n].skill[SK_BARTER][0] > 12)
			{
				it[n].skill[SK_BARTER][0] = 12;
			}
			it[n].skill[SK_BARTER][2] =
				(it[n].skill[SK_BARTER][0] * RANDOM(7));
			break;
		case 19:
			it[n].skill[SK_REPAIR][0] += skill_value;
			if(it[n].skill[SK_REPAIR][0] > 12)
			{
				it[n].skill[SK_REPAIR][0] = 12;
			}
			it[n].skill[SK_REPAIR][2] =
				(it[n].skill[SK_REPAIR][0] * RANDOM(7));
			break;
		case 20:
			it[n].skill[SK_LIGHT][0] += skill_value;
			if(it[n].skill[SK_LIGHT][0] > 12)
			{
				it[n].skill[SK_LIGHT][0] = 12;
			}
			it[n].skill[SK_LIGHT][2] =
				(it[n].skill[SK_LIGHT][0] * RANDOM(7));
			break;
		case 21:
			it[n].skill[SK_RECALL][0] += skill_value;
			if(it[n].skill[SK_RECALL][0] > 12)
			{
				it[n].skill[SK_RECALL][0] = 12;
			}
			it[n].skill[SK_RECALL][2] =
				(it[n].skill[SK_RECALL][0] * RANDOM(7));
			break;
		case 22:
			it[n].skill[SK_PROTECT][0] += skill_value;
			if(it[n].skill[SK_PROTECT][0] > 12)
			{
				it[n].skill[SK_PROTECT][0] = 12;
			}
			it[n].skill[SK_PROTECT][2] =
				(it[n].skill[SK_PROTECT][0] * RANDOM(7));
			break;
		case 23:
			it[n].skill[SK_ENHANCE][0] += skill_value;
			if(it[n].skill[SK_ENHANCE][0] > 12)
			{
				it[n].skill[SK_ENHANCE][0] = 12;
			}
			it[n].skill[SK_ENHANCE][2] =
				(it[n].skill[SK_ENHANCE][0] * RANDOM(7));
			break;
		case 24:
			it[n].skill[SK_STUN][0] += skill_value;
			if(it[n].skill[SK_STUN][0] > 12)
			{
				it[n].skill[SK_STUN][0] = 12;
			}
			break;
		case 25:
			it[n].skill[SK_CURSE][0] += skill_value;
			if(it[n].skill[SK_CURSE][0] > 12)
			{
				it[n].skill[SK_CURSE][0] = 12;
			}
			break;
		case 26:
			it[n].skill[SK_BLESS][0] += skill_value;
			if(it[n].skill[SK_BLESS][0] > 12)
			{
				it[n].skill[SK_BLESS][0] = 12;
			}
			it[n].skill[SK_BLESS][2] =
				(it[n].skill[SK_BLESS][0] * RANDOM(7));
			break;
		case 27:
			it[n].skill[SK_IDENT][0] += skill_value;
			if(it[n].skill[SK_IDENT][0] > 12)
			{
				it[n].skill[SK_IDENT][0] = 12;
			}
			it[n].skill[SK_IDENT][2] =
				(it[n].skill[SK_IDENT][0] * RANDOM(7));
			break;
		case 28:
			it[n].skill[SK_RESIST][0] += skill_value;
			if(it[n].skill[SK_RESIST][0] > 12)
			{
				it[n].skill[SK_RESIST][0] = 12;
			}
			it[n].skill[SK_RESIST][2] =
				(it[n].skill[SK_RESIST][0] * RANDOM(7));
			break;
		case 29:
			it[n].skill[SK_BLAST][0] += skill_value;
			if(it[n].skill[SK_BLAST][0] > 12)
			{
				it[n].skill[SK_BLAST][0] = 12;
			}
			break;
		case 30:
			it[n].skill[SK_DISPEL][0] += skill_value;
			if(it[n].skill[SK_DISPEL][0] > 12)
			{
				it[n].skill[SK_DISPEL][0] = 12;
			}
			break;
		case 31:
			it[n].skill[SK_HEAL][0] += skill_value;
			if(it[n].skill[SK_HEAL][0] > 12)
			{
				it[n].skill[SK_HEAL][0] = 12;
			}
			it[n].skill[SK_HEAL][2] =
				(it[n].skill[SK_HEAL][0] * RANDOM(7));
			break;
		case 32:
			it[n].skill[SK_GHOST][0] += skill_value;
			if(it[n].skill[SK_GHOST][0] > 12)
			{
				it[n].skill[SK_GHOST][0] = 12;
			}
			break;
		case 33:
			it[n].skill[SK_REGEN][0] += skill_value;
			if(it[n].skill[SK_REGEN][0] > 12)
			{
				it[n].skill[SK_REGEN][0] = 12;
			}
			break;
		case 34:
			it[n].skill[SK_REST][0] += skill_value;
			if(it[n].skill[SK_REST][0] > 12)
			{
				it[n].skill[SK_REST][0] = 12;
			}
			it[n].skill[SK_REST][2] =
				(it[n].skill[SK_REST][0] * RANDOM(7));
			break;
		case 35:
			it[n].skill[SK_MEDIT][0] += skill_value;
			if(it[n].skill[SK_MEDIT][0] > 12)
			{
				it[n].skill[SK_MEDIT][0] = 12;
			}
			break;
		case 36:
			it[n].skill[SK_SENSE][0] += skill_value;
			if(it[n].skill[SK_SENSE][0] > 12)
			{
				it[n].skill[SK_SENSE][0] = 12;
			}
			it[n].skill[SK_SENSE][2] =
				(it[n].skill[SK_SENSE][0] * RANDOM(7));
			break;
		case 37:
			it[n].skill[SK_IMMUN][0] += skill_value;
			if(it[n].skill[SK_IMMUN][0] > 12)
			{
				it[n].skill[SK_IMMUN][0] = 12;
			}
			break;
		case 38:
			it[n].skill[SK_SURROUND][0] += skill_value;
			if(it[n].skill[SK_SURROUND][0] > 12)
			{
				it[n].skill[SK_SURROUND][0] = 12;
			}
			break;
		case 39:
			it[n].skill[SK_CONCEN][0] += skill_value;
			if(it[n].skill[SK_CONCEN][0] > 12)
			{
				it[n].skill[SK_CONCEN][0] = 12;
			}
			break;
// this will be created in future, right now it is not needed
/*		case 40:
                        it[n].weapon[0] += skill_value;
                        if(it[n].weapon[0] > 12)
                        {
                                it[n].weapon[0] = 12;
                        }
                        break; */
		default:
			break;
		}
	}

	return(n);

}
Example #6
0
int pop_create_bonus(int cn, int chance)
{
	int n;

	// this check removed from here for speed reasons
	// they are the same as in pop_create_bonus_belt()
	// if (RANDOM(chance)) return 0;

	if (ch[cn].points_tot>20000000)
	{
		static int gitem[] = {273, 274, 693, 273, 274, 694, 273, 274, 695, 273, 274, 696, 273, 274, 697, 273, 274, 698, 361, 360, 487, 361, 360, 488, 361, 360, 489, 337, 361, 292, 525, 526};
		static int item[]  = {273, 274};

		if (RANDOM(5))
		{
			n = RANDOM(sizeof(item) / sizeof(int));
			n = item[n];
		}
		else
		{
			n = RANDOM(sizeof(gitem) / sizeof(int));
			n = gitem[n];
		}
	}
	else if (ch[cn].points_tot>1500000)
	{
		static int gitem[] = {273, 274, 699, 273, 274, 700, 273, 274, 701, 273, 274, 702, 273, 274, 703, 273, 274, 704, 361, 360, 347, 361, 360, 344, 361, 360, 341, 337, 283, 287, 291};
		static int item[]  = {273, 274};

		if (RANDOM(5))
		{
			n = RANDOM(sizeof(item) / sizeof(int));
			n = item[n];
		}
		else
		{
			n = RANDOM(sizeof(gitem) / sizeof(int));
			n = gitem[n];
		}
	}
	else if (ch[cn].points_tot>125000)
	{
		static int gitem[] = {101, 102, 705, 101, 102, 706, 101, 102, 707, 101, 102, 708, 101, 102, 709, 101, 102, 710, 360, 338, 361, 340, 361, 343, 361, 346, 282, 286, 290};
		static int item[]  = {101, 102};

		if (RANDOM(5))
		{
			n = RANDOM(sizeof(item) / sizeof(int));
			n = item[n];
		}
		else
		{
			n = RANDOM(sizeof(gitem) / sizeof(int));
			n = gitem[n];
		}
	}
	else if (ch[cn].points_tot>11250)
	{
		static int gitem[] = {18, 46, 711, 18, 46, 712, 18, 46, 713, 18, 46, 714, 18, 46, 715, 18, 46, 716, 360, 338, 361, 339, 361, 342, 361, 345, 281, 285, 289};
		static int item[]  = {18, 46, 100};

		if (RANDOM(5))
		{
			n = RANDOM(sizeof(item) / sizeof(int));
			n = item[n];
		}
		else
		{
			n = RANDOM(sizeof(gitem) / sizeof(int));
			n = gitem[n];
		}
	}
	else
	{
		static int gitem[] = {18, 46, 361, 348, 18, 46, 351, 18, 46, 354, 361, 338, 280, 284, 288};
		static int item[]  = {18, 46, 100};

		if (RANDOM(5))
		{
			n = RANDOM(sizeof(item) / sizeof(int));
			n = item[n];
		}
		else
		{
			n = RANDOM(sizeof(gitem) / sizeof(int));
			n = gitem[n];
		}
	}

	if (n)
	{
		n = god_create_item(n);

		chlog(cn, "got %s (t=%d)", it[n].name, it[n].temp);
	}

	return(n);

}
Example #7
0
int use_labtransfer(int cn,int nr,int exp)
{
        int x,y,co;

        for (y=159; y<179; y++) {
                for (x=164; x<=184; x++) {
                        if ((co=map[x+y*MAPX].ch) && (ch[co].flags&(CF_PLAYER|CF_LABKEEPER))) {
                                do_char_log(cn,0,"Sorry, the area is still busy. %s is there.\n",ch[co].name);
				chlog(cn,"Sorry, the area is still busy. %s is there",ch[co].name);
                                return 0;
                        }
                }
        }

        switch(nr) {
                case 1: co=pop_create_char(137,0); break;	// grolms
                case 2: co=pop_create_char(156,0); break;	// lizard
                case 3: co=pop_create_char(278,0); break;	// spellcaster
                case 4: co=pop_create_char(315,0); break;	// knight
                case 5: co=pop_create_char(328,0); break;	// undead
                case 6: co=pop_create_char(458,0); break;	// light&dark
                case 7: co=pop_create_char(462,0); break;	// underwater
                case 8: co=pop_create_char(845,0); break;	// forest / golem
                case 9: co=pop_create_char(919,0); break;	// riddle
		default:        do_char_log(cn,0,"Sorry, could not determine which enemy to send you.\n");
				chlog(cn,"Sorry, could not determine which enemy to send you");
				return 0;
        }


        if (!co) {
                do_char_log(cn,0,"Sorry, could not create your enemy.\n");
		chlog(cn,"Sorry, could not create your enemy");
                return 0;
        }

        if (!god_drop_char(co,174,172)) {
                do_char_log(cn,0,"Sorry, could not place your enemy.\n");
		chlog(cn,"Sorry, could not place your enemy");
                god_destroy_items(co);
                ch[co].used=USE_EMPTY;
                return 0;
        }

        ch[co].data[64]=globs->ticker+5*60*TICKS; // die in two minutes if not otherwise
        ch[co].data[24]=0;    // do not interfere in fights
        ch[co].data[36]=0;    // no walking around
        ch[co].data[43]=0;    // don't attack anyone
        ch[co].data[80]=0;    // no enemies

        ch[co].data[0]=cn;      // person to make solve
        ch[co].data[1]=nr;      // labnr
        ch[co].data[2]=exp;     // exp plr is supposed to get
        ch[co].flags|=CF_LABKEEPER|CF_NOSLEEP;
	ch[co].flags&=~CF_RESPAWN;

        npc_add_enemy(co,cn,1); // make him attack the solver

        if (!god_transfer_char(cn,174,166)) {
                do_char_log(cn,0,"Sorry, could not transfer you to your enemy.\n");
		chlog(cn,"Sorry, could not transfer you to your enemy");
                god_destroy_items(co);
                ch[co].used=USE_EMPTY;
                return 0;
        }
	chlog(cn,"Entered Labkeeper room");

        return 1;
}