@LabelIndex 144831
@StringIndex 18684
class 0 ant_warrior_captain : warrior_aggressive_casting_enchant_self {
handler:
	EventHandler MY_DYING(always_list,c1,code_info,i0,i9,last_attacker,lparty,member,random1_list,target) {
		always_list = gg::AllocCodeInfoList();
		random1_list = gg::AllocCodeInfoList();
		target = last_attacker;
		always_list::SetInfo(0,target);
		target = last_attacker;
		always_list::SetInfo(1,target);
		target = last_attacker;
		always_list::SetInfo(2,target);
		target = last_attacker;
		if( gg::HaveMemo(target,334) && gg::OwnItemCount(target,3680) && gg::OwnItemCount(target,3681) && gg::OwnItemCount(target,3689) == 0 ) {
			random1_list::SetInfo(3,target);
		}
		target = last_attacker;
		if( gg::HaveMemo(target,426) == 1 ) {
			random1_list::SetInfo(4,target);
		}
		if( gg::HaveMemo(target,426) == 1 ) {
			random1_list::SetInfo(4,target);
		}
		if( gg::IsNull(lparty) == 0 ) {
			for(i9 = 0; i9 < lparty.member_count; i9++) {
				target = myself::GetMemberOfParty(lparty,i9);
				if( gg::HaveMemo(target,426) == 1 ) {
					random1_list::SetInfo(4,target);
				}
			}
		}
		target = last_attacker;
		if( gg::HaveMemo(target,142) == 1 && gg::GetMemoState(target,142) == 7 && myself::GetOneTimeQuestFlag(target,142) == 0 ) {
			random1_list::SetInfo(5,target);
		}
		if( gg::HaveMemo(target,142) == 1 && gg::GetMemoState(target,142) == 7 && myself::GetOneTimeQuestFlag(target,142) == 0 ) {
			random1_list::SetInfo(5,target);
		}
		if( gg::IsNull(lparty) == 0 ) {
			for(i9 = 0; i9 < lparty.member_count; i9++) {
				target = myself::GetMemberOfParty(lparty,i9);
				if( gg::HaveMemo(target,142) == 1 && gg::GetMemoState(target,142) == 7 && myself::GetOneTimeQuestFlag(target,142) == 0 ) {
					random1_list::SetInfo(5,target);
				}
			}
		}
		while( gg::IsNull(code_info = always_list::Next()) == 0 ) {
			switch(code_info.code) {
				case 0: {
					myself::SetCurrentQuestID(217);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						c1 = myself::GetLastAttacker();
						if( c1.master ) {
							c1 = c1.master;
						}
						if( gg::HaveMemo(c1,217) && gg::GetMemoState(c1,217) == 6 && gg::OwnItemCount(c1,2750) < 10 && gg::OwnItemCount(c1,2755) && gg::OwnItemCount(c1,2753) == 0 ) {
							if( gg::OwnItemCount(c1,2750) >= 4 ) {
								myself::GiveItem1(c1,2753,1);
								myself::DeleteItem1(c1,2750,gg::OwnItemCount(c1,2750));
								myself::SoundEffect(c1,"Itemsound.quest_middle");
								if( gg::OwnItemCount(c1,2752) >= 1 && gg::OwnItemCount(c1,2754) >= 1 ) {
									myself::SetFlagJournal(c1,217,7);
									myself::ShowQuestMark(c1,217);
								}
							} else {
								myself::GiveItem1(c1,2750,1);
								myself::SoundEffect(c1,"Itemsound.quest_itemget");
							}
						}
					}
					break;
				}
				case 1: {
					myself::SetCurrentQuestID(218);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						c1 = myself::GetLastAttacker();
						if( c1.master ) {
							c1 = c1.master;
						}
						if( gg::HaveMemo(c1,218) && gg::OwnItemCount(c1,3144) == 1 && gg::OwnItemCount(c1,3149) == 1 && gg::OwnItemCount(c1,3162) < 20 ) {
							if( gg::Rand(100) < 100 ) {
								c1.quest_last_reward_time = myself::GetCurrentTick();
								myself::GiveItem1(c1,3162,2);
								if( gg::OwnItemCount(c1,3162) >= 18 ) {
									myself::SoundEffect(c1,"ItemSound.quest_middle");
									if( gg::OwnItemCount(c1,3161) >= 10 && gg::OwnItemCount(c1,3163) >= 20 ) {
										myself::SetFlagJournal(c1,218,5);
										myself::ShowQuestMark(c1,218);
									}
								} else {
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 2: {
					myself::SetCurrentQuestID(213);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						c1 = myself::GetLastAttacker();
						if( c1.master ) {
							c1 = c1.master;
						}
						if( gg::HaveMemo(c1,213) && gg::OwnItemCount(c1,2667) == 1 && gg::OwnItemCount(c1,2670) == 0 ) {
							if( gg::Rand(100) < 100 ) {
								c1.quest_last_reward_time = myself::GetCurrentTick();
								myself::GiveItem1(c1,2670,1);
								myself::SoundEffect(c1,"ItemSound.quest_middle");
								if( gg::OwnItemCount(c1,2668) >= 1 && gg::OwnItemCount(c1,2669) >= 1 && gg::OwnItemCount(c1,2671) >= 1 ) {
									myself::SetFlagJournal(c1,213,16);
									myself::ShowQuestMark(c1,213);
								}
							}
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 ) {
			switch(code_info.code) {
				case 3: {
					myself::SetCurrentQuestID(334);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						if( gg::Rand(10) == 0 ) {
							target.quest_last_reward_time = myself::GetCurrentTick();
							myself::GiveItem1(target,3689,1);
							if( gg::OwnItemCount(target,3684) >= 1 && gg::OwnItemCount(target,3685) >= 1 && gg::OwnItemCount(target,3686) >= 1 && gg::OwnItemCount(target,3687) >= 1 && gg::OwnItemCount(target,3688) >= 1 && gg::OwnItemCount(target,3689) >= 1 && gg::OwnItemCount(target,3690) >= 1 && gg::OwnItemCount(target,3691) >= 1 ) {
								myself::SetJournal(target,334,4);
								myself::ShowQuestMark(target,334);
								myself::SoundEffect(target,"ItemSound.quest_middle");
							} else {
								myself::SoundEffect(target,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
				case 4: {
					myself::SetCurrentQuestID(426);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						if( gg::Rand(1000) < 605 ) {
							myself::GiveItem1(target,7586,1);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
						}
					}
					break;
				}
				case 5: {
					myself::SetCurrentQuestID(142);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						i0 = gg::Rand(1000);
						if( i0 < 1000 ) {
							if( gg::OwnItemCount(target,10352) >= 29 ) {
								myself::DeleteItem1(target,10352,gg::OwnItemCount(target,10352));
								myself::SoundEffect(target,"ItemSound.quest_middle");
								myself::SetFlagJournal(target,142,5);
								myself::ShowQuestMark(target,142);
								myself::SetMemoState(target,142,8);
							} else {
								myself::GiveItem1(target,10352,1);
								myself::SoundEffect(target,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
			}
		}
		super;
	}

}
