Example #1
0
/**
* Change homunculus name
*/
int hom_change_name(struct map_session_data *sd,char *name)
{
	int i;
	struct homun_data *hd;
	nullpo_retr(1, sd);

	hd = sd->hd;
	if (!hom_is_active(hd))
		return 1;
	if (hd->homunculus.rename_flag && !battle_config.hom_rename)
		return 1;

	for (i = 0; i < NAME_LENGTH && name[i];i++) {
		if (!(name[i]&0xe0) || name[i] == 0x7f)
			return 1;
	}

	return intif_rename_hom(sd, name);
}
Example #2
0
int merc_hom_evolution (struct homun_data *hd)
{
	struct s_homunculus *hom;
	struct h_stats *max, *min;
	struct map_session_data *sd;
	int class_;
	nullpo_ret (hd);

//	if (!hd->homunculusDB->evo_class || hd->homunculus.class_ == hd->homunculusDB->evo_class) {
//		clif_emotion (&hd->bl, E_SWT);
//		return 0 ;
//	}

	if(hd->homunculusDB->emax.luk > 99)
		return 0;

	sd = hd->master;

	if (!sd)
		return 0;

	class_ = (hd->homunculus.class_) + 1;

	if (!merc_hom_change_class (hd, class_)) {
		ShowError ("merc_hom_evolution: Can't evolve homunc from %d to %d", hd->homunculus.class_, hd->homunculusDB->evo_class);
		return 0;
	}

	//Apply evolution bonuses
	hom = &hd->homunculus;
	max = &hd->homunculusDB->emax;
	min = &hd->homunculusDB->emin;
	intif_rename_hom(sd, hd->homunculusDB->name);
	hd->homunculus.rename_flag = 1;
	hom->max_hp += rnd_value (min->HP, max->HP);
	hom->max_sp += rnd_value (min->SP, max->SP);
	hom->str += 10 * rnd_value (min->str, max->str);
	hom->agi += 10 * rnd_value (min->agi, max->agi);
	hom->vit += 10 * rnd_value (min->vit, max->vit);
	hom->int_ += 10 * rnd_value (min->int_, max->int_);
	hom->dex += 10 * rnd_value (min->dex, max->dex);
//	hom->luk += 10 * rnd_value (min->luk, max->luk);
	hom->intimacy = 100;
	unit_remove_map (&hd->bl, CLR_OUTSIGHT);
	map_addblock (&hd->bl);
	clif_spawn (&hd->bl);
	clif_emotion (&sd->bl, E_NO1);
	clif_specialeffect(&hd->bl,72,AREA);
	clif_specialeffect(&hd->bl,99,AREA);
	//status_Calc flag&1 will make current HP/SP be reloaded from hom structure
	hom->hp = hd->battle_status.hp;
	hom->sp = hd->battle_status.sp;
	status_calc_homunculus (hd, 1);

	if (! (battle_config.hom_setting & 0x2))
		skill_unit_move (&sd->hd->bl, gettick(), 1); // apply land skills immediately
	
	if(hom->lvlevo1)
		hom->lvlevo2 = hom->level;
	else
		hom->lvlevo1 = hom->level;
	
	hom->evomoment = 0;
	merc_hom_gainexp(hd,1);

	return 1 ;
}