int merc_hom_mutation(struct homun_data *hd, int class_) { struct s_homunculus *hom; struct map_session_data *sd; nullpo_ret(hd); //Only allows mutating level 99 evolved homunculus and also prevents mutating already mutated homunculus. if( hd->homunculus.level < 99 || !(hd->homunculus.class_ >= 6009 && hd->homunculus.class_ <= 6016) || hd->homunculus.class_ >= MH_CLASS_BASE && hd->homunculus.class_ <= MH_CLASS_MAX) { clif_emotion(&hd->bl, E_SWT); return 0 ; } sd = hd->master; if (!sd) return 0; if (!merc_hom_change_class(hd, class_)) { ShowError("merc_hom_mutation: Can't mutate homunc from %d to %d", hd->homunculus.class_, class_); return 0; } // Its said the player can rename the homunculus again after mutation. // This might be true since the homunculus's form completely changes. hd->homunculus.rename_flag = 0; //Apply mutation bonuses. //Bonuses are the same for all mutations. hom = &hd->homunculus; hom->max_hp += rand(1000, 2000); hom->max_sp += rand(10, 200); hom->str += 10*rand(1, 10); hom->agi += 10*rand(1, 10); hom->vit += 10*rand(1, 10); hom->int_+= 10*rand(1, 10); hom->dex += 10*rand(1, 10); hom->luk += 10*rand(1, 10); 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,568,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 return 1 ; }
/** * Make an homonculus evolve, (changing in evolution class and apply bonus) * @param hd : homonculus datas * @return 0:failure, 1:success */ int merc_hom_evolution(struct homun_data *hd) { struct s_homunculus *hom; struct h_stats *max, *min; struct map_session_data *sd; nullpo_ret(hd); if(!hd->homunculusDB->evo_class || hd->homunculus.class_ == hd->homunculusDB->evo_class) { clif_emotion(&hd->bl, E_SWT); return 0 ; } sd = hd->master; if (!sd) return 0; if (!merc_hom_change_class(hd, hd->homunculusDB->evo_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; 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 = 500; unit_remove_map(&hd->bl, CLR_OUTSIGHT); if(map_addblock(&hd->bl)) return 0; clif_spawn(&hd->bl); clif_emotion(&sd->bl, E_NO1); clif_specialeffect(&hd->bl,568,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 return 1 ; }
/** * Make an homonculus mutate in renewal homon * @param hd : homonculus datas * @param homun_id : id to make it transform into (must be a valid homon class) * @return 0:failure, 1:sucess */ int hom_mutate(struct homun_data *hd, int homun_id) { struct s_homunculus *hom; struct map_session_data *sd; int m_class, m_id, prev_class = 0; nullpo_ret(hd); m_class = hom_class2mapid(hd->homunculus.class_); m_id = hom_class2mapid(homun_id); if( m_class == -1 || m_id == -1 || !(m_class&HOM_EVO) || !(m_id&HOM_S) ) { clif_emotion(&hd->bl, E_SWT); return 0; } sd = hd->master; if (!sd) return 0; prev_class = hd->homunculus.class_; if (!merc_hom_change_class(hd, homun_id)) { ShowError("hom_mutate: Can't evolve homunc from %d to %d", hd->homunculus.class_, homun_id); return 0; } unit_remove_map(&hd->bl, CLR_OUTSIGHT); if(map_addblock(&hd->bl)) return 0; clif_spawn(&hd->bl); clif_emotion(&sd->bl, E_NO1); clif_specialeffect(&hd->bl,568,AREA); //status_Calc flag&1 will make current HP/SP be reloaded from hom structure hom = &hd->homunculus; hom->hp = hd->battle_status.hp; hom->sp = hd->battle_status.sp; hom->prev_class = prev_class; status_calc_homunculus(hd,1); if (!(battle_config.hom_setting&0x2)) skill_unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately return 1; }