@LabelIndex 25581
@StringIndex 4574
class 0 raid_boss_standard : default_npc {
parameter:
	float	Attack_DecayRatio = 6.600000;
	float	UseSkill_DecayRatio = 66000.000000;
	float	Attack_BoostValue = 300.000000;
	float	UseSkill_BoostValue = 100000.000000;
	string	RaidSpawnMusic = "Rm01_A";
	int	doSummonNPC = 0;
	int	RootingManage = 1;
	int	SSQLoserTeleport = 0;
	int	SSQTelPosX = 0;
	int	SSQTelPosY = 0;
	int	SSQTelPosZ = 0;
	string	AdvMakerGludio = "gludio08_npc1921_101m1";
	string	AdvMakerDion = "dion09_npc2022_101m1";
	string	AdvMakerGiran = "giran11_npc2222_101m1";
	string	AdvMakerOren = "oren17_npc2219_101m1";
	string	AdvMakerAden = "aden13_npc2418_101m1";
	string	AdvMakerInnadril = "innadril09_npc2324_101m1";
	string	AdvMakerGodard = "godard02_npc2416_101m1";
	string	AdvMakerRune = "rune02_npc2116_101m1";
	string	AdvMakerSchuttgart = "schuttgart20_npc2213_101m1";
	int	InzoneRestriction = 0;
	int	InzoneFinish = 0;
	int	CouldDespawn = 0;
	int	DespawnTime = 15;
	int	attack_weight_value = 20000;
	int	different_level_9_attacked = 295895041;
	int	different_level_9_see_spelled = 276234241;
	int	SeeCreatureAttackerTime = -1;

handler:
	EventHandler NO_DESIRE() {
		myself::AddDoNothingDesire(5,5);
	}

	EventHandler CREATED() {
		myself::EffectMusic(myself.sm,8000,RaidSpawnMusic);
		myself.i_quest3 = 0;
		myself.i_quest4 = myself::GetCurrentTick();
		myself::AddTimerEx(1001,1000);
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0) {
		if( timer_id == 1001 ) {
			if( myself::InMyTerritory(myself.sm) == 0 && gg::Rand(2) < 1 && myself.p_state != 3 ) {
				myself::InstantTeleport(myself.sm,myself.start_x,myself.start_y,myself.start_z);
				myself::RemoveAllAttackDesire();
			}
			if( gg::Rand(5) < 1 ) {
				myself::RandomizeAttackDesire();
			}
			if( RootingManage == 1 ) {
				if( myself.i_quest3 == 1 && myself::GetCurrentTick() > ( myself.i_quest4 + ( 60 * 5 ) ) ) {
					myself::MPCC_SetMasterPartyRouting(myself.int_list::Get(0),myself.sm,0);
					myself.int_list::Clear();
					gg::BroadcastOnScreenMsgStr(myself.sm,4000,2,0,0,0,0,1,10000,0,gg::MakeFString(1800010,"","","","",""));
					myself.i_quest3 = 0;
				}
			}
			if( CouldDespawn == 1 ) {
				i0 = ( myself::GetCurrentTick() - myself.i_quest4 );
				if( i0 > ( DespawnTime * 60 ) ) {
					if( InzoneRestriction == 1 || InzoneFinish == 1 ) {
						myself::InstantZone_Finish(5);
					}
					myself::Despawn();
				}
			}
			myself::AddTimerEx(1001,( 60 * 1000 ));
		}
	}

	EventHandler ATTACKED(attacker,damage,i0,i1,i2,i3,i4,i5,i6,i7,c0,c1,i9,i10) {
		myself.i_quest4 = myself::GetCurrentTick();
		if( myself.sm.in_peacezone != 1 ) {
			if( SSQLoserTeleport != 0 ) {
				if( attacker.builder_level == 0 ) {
					if( SSQLoserTeleport != 1 && SSQLoserTeleport != 2 ) {
						myself::Say(":SSQLoserTeleport   . ˆ= " + SSQLoserTeleport);
					} else if( myself::GetSSQStatus() == 3 ) {
						i0 = myself::GetSSQSealOwner(SSQLoserTeleport);
						if( attacker.is_pc == 1 ) {
							if( i0 == 0 && gg::GetSSQPart(attacker) == 0 ) {
								myself::RemoveAttackDesire(attacker.id);
								myself::InstantTeleport(attacker,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i0 == 1 && gg::GetSSQPart(attacker) != 1 ) {
								myself::RemoveAttackDesire(attacker.id);
								myself::InstantTeleport(attacker,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i0 == 2 && gg::GetSSQPart(attacker) != 2 ) {
								myself::RemoveAttackDesire(attacker.id);
								myself::InstantTeleport(attacker,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						} else if( myself::IsInCategory(12,attacker.class_id) == 1 ) {
							if( i0 == 0 && gg::GetSSQPart(attacker.master) == 0 ) {
								myself::RemoveAttackDesire(attacker.master.id);
								myself::InstantTeleport(attacker.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i0 == 1 && gg::GetSSQPart(attacker.master) != 1 ) {
								myself::RemoveAttackDesire(attacker.master.id);
								myself::InstantTeleport(attacker.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i0 == 2 && gg::GetSSQPart(attacker.master) != 2 ) {
								myself::RemoveAttackDesire(attacker.master.id);
								myself::InstantTeleport(attacker.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						}
					} else if( myself::GetSSQStatus() == 1 ) {
						i0 = myself::GetSSQSealOwner(SSQLoserTeleport);
						if( attacker.is_pc == 1 ) {
							if( gg::GetSSQPart(attacker) == 0 ) {
								myself::RemoveAttackDesire(attacker.id);
								myself::InstantTeleport(attacker,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						} else if( myself::IsInCategory(12,attacker.class_id) == 1 ) {
							if( gg::GetSSQPart(attacker.master) == 0 ) {
								myself::RemoveAttackDesire(attacker.master.id);
								myself::InstantTeleport(attacker.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						}
					}
				}
			}
		}
		if( RootingManage == 1 ) {
			if( myself.i_quest3 == 0 ) {
				i9 = myself::MPCC_GetMPCCId(attacker);
				c1 = myself::MPCC_GetMaster(i9);
				if( myself::IsNullCreature(c1) == 0 && attacker.builder_level > 0 && attacker.builder_level <= 3 && myself::MPCC_GetMemberCount(i9) >= 1 ) {
					myself::MPCC_SetMasterPartyRouting(i9,myself.sm,1);
					myself.int_list::Add(i9);
					gg::BroadcastOnScreenMsgStr(myself.sm,4000,2,0,0,0,0,1,3000,0,gg::MakeFString(1800009,c1.name,"","","",""));
				} else if( myself::IsNullCreature(c1) == 0 && myself::MPCC_GetMemberCount(i9) >= 18 ) {
					myself::MPCC_SetMasterPartyRouting(i9,myself.sm,1);
					myself.int_list::Add(i9);
					gg::BroadcastOnScreenMsgStr(myself.sm,4000,2,0,0,0,0,1,3000,0,gg::MakeFString(1800009,c1.name,"","","",""));
				}
				myself.i_quest3 = 1;
			}
		}
		c0 = attacker;
		if( attacker.yongma_type == 1 && gg::GetAbnormalLevel(attacker,myself::Skill_GetAbnormalType(279052289)) <= 0 ) {
			if( myself::Skill_GetConsumeMP(279052289) < myself.sm.mp && myself::Skill_GetConsumeHP(279052289) < myself.sm.hp && myself::Skill_InReuseDelay(279052289) == 0 ) {
				myself::AddUseSkillDesire(attacker,279052289,0,1,1000000);
			}
		}
		if( attacker.level > ( myself.sm.level + 8 ) ) {
			i10 = 0;
			if( gg::GetAbnormalLevel(attacker,myself::Skill_GetAbnormalType(different_level_9_attacked)) == -1 ) {
				if( different_level_9_attacked == 295895041 ) {
					myself::CastBuffForQuestReward(attacker,different_level_9_attacked);
					myself::RemoveAttackDesire(attacker.id);
					return;
				} else {
					myself::CastBuffForQuestReward(attacker,different_level_9_attacked);
				}
			}
		}
		if( gg::GetAbnormalLevel(attacker,myself::Skill_GetAbnormalType(295895041)) == -1 ) {
			if( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) {
				if( damage == 0 ) {
					damage = 1;
				}
				myself::AddAttackDesire(attacker,1,( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) * attack_weight_value ));
			}
		}
		if( myself::GetPathfindFailCount() > 10 ) {
			if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
				if( myself::DistFromMe(myself.top_desire_target) < 1000 ) {
					myself::InstantTeleport(myself.sm,gg::FloatToInt(myself.top_desire_target.x),gg::FloatToInt(myself.top_desire_target.y),gg::FloatToInt(myself.top_desire_target.z));
				} else {
					myself::RemoveAllAttackDesire();
					if( attacker.is_pc != 0 || myself::IsInCategory(12,attacker.class_id) ) {
						if( damage == 0 ) {
							damage = 1;
						}
						myself::AddAttackDesire(attacker,1,( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) * attack_weight_value ));
					}
					myself::InstantTeleport(myself.sm,gg::FloatToInt(attacker.x),gg::FloatToInt(attacker.y),gg::FloatToInt(attacker.z));
				}
			} else {
			}
		}
		if( myself.sm.in_peacezone != 0 ) {
			myself::InstantTeleport(myself.sm,myself.start_x,myself.start_y,myself.start_z);
			myself::RemoveAllAttackDesire();
		}
	}

	EventHandler SEE_CREATURE(creature,i0) {
		if( myself.sm.in_peacezone != 1 ) {
			if( SSQLoserTeleport != 0 ) {
				if( creature.builder_level == 0 ) {
					if( SSQLoserTeleport != 1 && SSQLoserTeleport != 2 ) {
						myself::Say(":SSQLoserTeleport   . ˆ= " + SSQLoserTeleport);
					} else if( myself::GetSSQStatus() == 3 ) {
						i0 = myself::GetSSQSealOwner(SSQLoserTeleport);
						if( creature.is_pc == 1 ) {
							if( i0 == 0 && gg::GetSSQPart(creature) == 0 ) {
								myself::RemoveAttackDesire(creature.id);
								myself::InstantTeleport(creature,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i0 == 1 && gg::GetSSQPart(creature) != 1 ) {
								myself::RemoveAttackDesire(creature.id);
								myself::InstantTeleport(creature,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i0 == 2 && gg::GetSSQPart(creature) != 2 ) {
								myself::RemoveAttackDesire(creature.id);
								myself::InstantTeleport(creature,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						} else if( myself::IsInCategory(12,creature.class_id) == 1 ) {
							if( i0 == 0 && gg::GetSSQPart(creature.master) == 0 ) {
								myself::RemoveAttackDesire(creature.master.id);
								myself::InstantTeleport(creature.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i0 == 1 && gg::GetSSQPart(creature.master) != 1 ) {
								myself::RemoveAttackDesire(creature.master.id);
								myself::InstantTeleport(creature.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i0 == 2 && gg::GetSSQPart(creature.master) != 2 ) {
								myself::RemoveAttackDesire(creature.master.id);
								myself::InstantTeleport(creature.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						}
					} else if( myself::GetSSQStatus() == 1 ) {
						i0 = myself::GetSSQSealOwner(SSQLoserTeleport);
						if( creature.is_pc == 1 ) {
							if( gg::GetSSQPart(creature) == 0 ) {
								myself::RemoveAttackDesire(creature.id);
								myself::InstantTeleport(creature,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						} else if( myself::IsInCategory(12,creature.class_id) == 1 ) {
							if( gg::GetSSQPart(creature.master) == 0 ) {
								myself::RemoveAttackDesire(creature.master.id);
								myself::InstantTeleport(creature.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						}
					}
				}
			}
		}
		super;
	}

	EventHandler SEE_SPELL(speller,skill_name_id,i0,c0,i1,i2) {
		c0 = speller;
		if( myself.sm.in_peacezone != 1 ) {
			if( SSQLoserTeleport != 0 ) {
				if( c0.builder_level == 0 ) {
					if( SSQLoserTeleport != 1 && SSQLoserTeleport != 2 ) {
						myself::Say(":SSQLoserTeleport   . ˆ= " + SSQLoserTeleport);
					} else if( myself::GetSSQStatus() == 3 ) {
						i1 = myself::GetSSQSealOwner(SSQLoserTeleport);
						if( c0.is_pc == 1 ) {
							if( i1 == 0 && gg::GetSSQPart(c0) == 0 ) {
								myself::RemoveAttackDesire(c0.id);
								myself::InstantTeleport(c0,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i1 == 1 && gg::GetSSQPart(c0) != 1 ) {
								myself::RemoveAttackDesire(c0.id);
								myself::InstantTeleport(c0,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i1 == 2 && gg::GetSSQPart(c0) != 2 ) {
								myself::RemoveAttackDesire(c0.id);
								myself::InstantTeleport(c0,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						} else if( myself::IsInCategory(12,c0.class_id) == 1 ) {
							if( i1 == 0 && gg::GetSSQPart(c0.master) == 0 ) {
								myself::RemoveAttackDesire(c0.master.id);
								myself::InstantTeleport(c0.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i1 == 1 && gg::GetSSQPart(c0.master) != 1 ) {
								myself::RemoveAttackDesire(c0.master.id);
								myself::InstantTeleport(c0.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							} else if( i1 == 2 && gg::GetSSQPart(c0.master) != 2 ) {
								myself::RemoveAttackDesire(c0.master.id);
								myself::InstantTeleport(c0.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						}
					} else if( myself::GetSSQStatus() == 1 ) {
						i1 = myself::GetSSQSealOwner(SSQLoserTeleport);
						if( c0.is_pc == 1 ) {
							if( gg::GetSSQPart(c0) == 0 ) {
								myself::RemoveAttackDesire(c0.id);
								myself::InstantTeleport(c0,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						} else if( myself::IsInCategory(12,c0.class_id) == 1 ) {
							if( gg::GetSSQPart(c0.master) == 0 ) {
								myself::RemoveAttackDesire(c0.master.id);
								myself::InstantTeleport(c0.master,SSQTelPosX,SSQTelPosY,SSQTelPosZ);
								return;
							}
						}
					}
				}
			}
		}
		if( speller.level > ( myself.sm.level + 8 ) ) {
			i2 = 0;
			if( gg::GetAbnormalLevel(speller,myself::Skill_GetAbnormalType(different_level_9_see_spelled)) == -1 ) {
				if( different_level_9_see_spelled == 295895041 ) {
					myself::CastBuffForQuestReward(speller,different_level_9_see_spelled);
					myself::RemoveAttackDesire(speller.id);
					return;
				} else {
					myself::CastBuffForQuestReward(speller,different_level_9_see_spelled);
				}
			}
		}
		if( myself::Skill_GetEffectPoint(skill_name_id) > 0 ) {
			if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
				if( myself.p_state == 3 && myself.top_desire_target != speller ) {
					myself::AddAttackDesire(speller,1,( ( ( myself::Skill_GetEffectPoint(skill_name_id) / myself.sm.max_hp ) * 4000 ) * 150 ));
				}
			}
		}
		if( myself::IsNullCreature(myself.top_desire_target) == 0 ) {
			if( myself::GetPathfindFailCount() > 10 && speller == myself.top_desire_target && gg::FloatToInt(myself.sm.hp) != gg::FloatToInt(myself.sm.max_hp) ) {
				myself::InstantTeleport(myself.sm,gg::FloatToInt(speller.x),gg::FloatToInt(speller.y),gg::FloatToInt(speller.z));
			}
		}
	}

	EventHandler MY_DYING(last_attacker,pledge0,maker0,i0) {
		if( InzoneRestriction == 1 ) {
			myself::InstantZone_MarkRestriction();
		}
		if( InzoneFinish == 1 ) {
			myself::InstantZone_Finish(5);
		}
		if( doSummonNPC == 1 ) {
			pledge0 = myself::GetPledge(last_attacker);
			if( gg::IsNull(pledge0) == 1 ) {
				return;
			}
			i0 = pledge0.castle_id;
			if( i0 == 1 ) {
				maker0 = gg::GetNpcMaker(AdvMakerGludio);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,1001,0,0);
				}
			} else if( i0 == 2 ) {
				maker0 = gg::GetNpcMaker(AdvMakerDion);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,1001,0,0);
				}
			} else if( i0 == 3 ) {
				maker0 = gg::GetNpcMaker(AdvMakerGiran);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,1001,0,0);
				}
			} else if( i0 == 4 ) {
				maker0 = gg::GetNpcMaker(AdvMakerOren);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,1001,0,0);
				}
			} else if( i0 == 5 ) {
				maker0 = gg::GetNpcMaker(AdvMakerAden);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,1001,0,0);
				}
			} else if( i0 == 6 ) {
				maker0 = gg::GetNpcMaker(AdvMakerInnadril);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,1001,0,0);
				}
			} else if( i0 == 7 ) {
				maker0 = gg::GetNpcMaker(AdvMakerGodard);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,1001,0,0);
				}
			} else if( i0 == 8 ) {
				maker0 = gg::GetNpcMaker(AdvMakerRune);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,1001,0,0);
				}
			} else if( i0 == 9 ) {
				maker0 = gg::GetNpcMaker(AdvMakerSchuttgart);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,1001,0,0);
				}
			} else {
			}
		} else {
		}
	}

	EventHandler ABNORMAL_STATUS_CHANGED(speller,i1) {
		if( speller.level > ( myself.sm.level + 8 ) ) {
			i1 = 1;
			if( gg::GetAbnormalLevel(speller,myself::Skill_GetAbnormalType(different_level_9_attacked)) == -1 ) {
				if( different_level_9_attacked == 295895041 ) {
					myself::CastBuffForQuestReward(speller,different_level_9_attacked);
					myself::RemoveAttackDesire(speller.id);
					return;
				} else {
					myself::CastBuffForQuestReward(speller,different_level_9_attacked);
				}
			}
		}
	}

}
