@LabelIndex 163893
@StringIndex 20657
class 0 doom_knight : warrior_ag_casting_3skill_approach {
handler:
	EventHandler MY_DYING(always_list,code_info,i0,i1,i9,last_attacker,lparty,member,random1_list,target) {
		always_list = gg::AllocCodeInfoList();
		random1_list = gg::AllocCodeInfoList();
		target = last_attacker;
		if( gg::HaveMemo(target,336) && gg::GetMemoState(target,336) == 3 ) {
			random1_list::SetInfo(0,target);
		}
		if( gg::HaveMemo(target,336) && gg::GetMemoState(target,336) == 3 ) {
			random1_list::SetInfo(0,target);
		}
		if( gg::IsNull(lparty) == 0 ) {
			for(i9 = 0; i9 < lparty.member_count; i9++) {
				target = myself::GetMemberOfParty(lparty,i9);
				if( gg::HaveMemo(target,336) && gg::GetMemoState(target,336) == 3 ) {
					random1_list::SetInfo(0,target);
				}
			}
		}
		target = last_attacker;
		if( gg::HaveMemo(target,350) == 1 ) {
			random1_list::SetInfo(1,target);
		}
		target = last_attacker;
		if( gg::HaveMemo(target,662) ) {
			random1_list::SetInfo(2,target);
		}
		if( gg::HaveMemo(target,662) ) {
			random1_list::SetInfo(2,target);
		}
		if( gg::IsNull(lparty) == 0 ) {
			for(i9 = 0; i9 < lparty.member_count; i9++) {
				target = myself::GetMemberOfParty(lparty,i9);
				if( gg::HaveMemo(target,662) ) {
					random1_list::SetInfo(2,target);
				}
			}
		}
		target = last_attacker;
		if( gg::HaveMemo(target,663) == 1 && gg::GetMemoState(target,663) >= 1 && gg::GetMemoState(target,663) <= 4 ) {
			random1_list::SetInfo(3,target);
		}
		if( gg::HaveMemo(target,663) == 1 && gg::GetMemoState(target,663) >= 1 && gg::GetMemoState(target,663) <= 4 ) {
			random1_list::SetInfo(3,target);
		}
		if( gg::IsNull(lparty) == 0 ) {
			for(i9 = 0; i9 < lparty.member_count; i9++) {
				target = myself::GetMemberOfParty(lparty,i9);
				if( gg::HaveMemo(target,663) == 1 && gg::GetMemoState(target,663) >= 1 && gg::GetMemoState(target,663) <= 4 ) {
					random1_list::SetInfo(3,target);
				}
			}
		}
		while( gg::IsNull(code_info = always_list::Next()) == 0 ) {
			switch (code_info.code) {
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 ) {
			switch(code_info.code) {
				case 0: {
					myself::SetCurrentQuestID(336);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						if( gg::Rand(1000) < 210 ) {
							myself::GiveItem1(target,3482,1);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
						}
					}
					break;
				}
				case 1: {
					myself::SetCurrentQuestID(350);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						if( target == myself.c_quest0 && myself.i_quest0 == 2 ) {
							if( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( gg::OwnItemCount(target,4651) + gg::OwnItemCount(target,4652) ) + gg::OwnItemCount(target,4653) ) + gg::OwnItemCount(target,4654) ) + gg::OwnItemCount(target,4655) ) + gg::OwnItemCount(target,4656) ) + gg::OwnItemCount(target,4657) ) + gg::OwnItemCount(target,4658) ) + gg::OwnItemCount(target,4659) ) + gg::OwnItemCount(target,4660) ) + gg::OwnItemCount(target,4661) ) + gg::OwnItemCount(target,5579) ) + gg::OwnItemCount(target,5582) ) + gg::OwnItemCount(target,5914) ) + gg::OwnItemCount(target,4629) ) + gg::OwnItemCount(target,4630) ) + gg::OwnItemCount(target,4631) ) + gg::OwnItemCount(target,4632) ) + gg::OwnItemCount(target,4633) ) + gg::OwnItemCount(target,4634) ) + gg::OwnItemCount(target,4635) ) + gg::OwnItemCount(target,4636) ) + gg::OwnItemCount(target,4637) ) + gg::OwnItemCount(target,4638) ) + gg::OwnItemCount(target,4639) ) + gg::OwnItemCount(target,5577) ) + gg::OwnItemCount(target,5580) ) + gg::OwnItemCount(target,5908) ) + gg::OwnItemCount(target,4640) ) + gg::OwnItemCount(target,4641) ) + gg::OwnItemCount(target,4642) ) + gg::OwnItemCount(target,4643) ) + gg::OwnItemCount(target,4644) ) + gg::OwnItemCount(target,4645) ) + gg::OwnItemCount(target,4646) ) + gg::OwnItemCount(target,4647) ) + gg::OwnItemCount(target,4648) ) + gg::OwnItemCount(target,4649) ) + gg::OwnItemCount(target,4650) ) + gg::OwnItemCount(target,5578) ) + gg::OwnItemCount(target,5581) ) + gg::OwnItemCount(target,5911) ) + gg::OwnItemCount(target,9571) ) + gg::OwnItemCount(target,10161) ) + gg::OwnItemCount(target,9570) ) + gg::OwnItemCount(target,10160) ) + gg::OwnItemCount(target,9572) ) + gg::OwnItemCount(target,10162) ) + gg::OwnItemCount(target,10482) ) + gg::OwnItemCount(target,10481) ) + gg::OwnItemCount(target,10480) ) + gg::OwnItemCount(target,13072) ) + gg::OwnItemCount(target,13073) ) + gg::OwnItemCount(target,13071) ) == 1 ) {
								i0 = gg::Rand(100);
								if( i0 <= 9 ) {
									if( gg::OwnItemCount(target,4651) == 1 ) {
										myself::DeleteItem1(target,4651,1);
										myself::GiveItem1(target,4652,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4652) == 1 ) {
										myself::DeleteItem1(target,4652,1);
										myself::GiveItem1(target,4653,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4653) == 1 ) {
										myself::DeleteItem1(target,4653,1);
										myself::GiveItem1(target,4654,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4654) == 1 ) {
										myself::DeleteItem1(target,4654,1);
										myself::GiveItem1(target,4655,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4655) == 1 ) {
										myself::DeleteItem1(target,4655,1);
										myself::GiveItem1(target,4656,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4656) == 1 ) {
										myself::DeleteItem1(target,4656,1);
										myself::GiveItem1(target,4657,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4657) == 1 ) {
										myself::DeleteItem1(target,4657,1);
										myself::GiveItem1(target,4658,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4658) == 1 ) {
										myself::DeleteItem1(target,4658,1);
										myself::GiveItem1(target,4659,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4659) == 1 ) {
										myself::DeleteItem1(target,4659,1);
										myself::GiveItem1(target,4660,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4660) == 1 ) {
										myself::DeleteItem1(target,4660,1);
										myself::GiveItem1(target,4661,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4629) == 1 ) {
										myself::DeleteItem1(target,4629,1);
										myself::GiveItem1(target,4630,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4630) == 1 ) {
										myself::DeleteItem1(target,4630,1);
										myself::GiveItem1(target,4631,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4631) == 1 ) {
										myself::DeleteItem1(target,4631,1);
										myself::GiveItem1(target,4632,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4632) == 1 ) {
										myself::DeleteItem1(target,4632,1);
										myself::GiveItem1(target,4633,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4633) == 1 ) {
										myself::DeleteItem1(target,4633,1);
										myself::GiveItem1(target,4634,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4634) == 1 ) {
										myself::DeleteItem1(target,4634,1);
										myself::GiveItem1(target,4635,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4635) == 1 ) {
										myself::DeleteItem1(target,4635,1);
										myself::GiveItem1(target,4636,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4636) == 1 ) {
										myself::DeleteItem1(target,4636,1);
										myself::GiveItem1(target,4637,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4637) == 1 ) {
										myself::DeleteItem1(target,4637,1);
										myself::GiveItem1(target,4638,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4638) == 1 ) {
										myself::DeleteItem1(target,4638,1);
										myself::GiveItem1(target,4639,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4640) == 1 ) {
										myself::DeleteItem1(target,4640,1);
										myself::GiveItem1(target,4641,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4641) == 1 ) {
										myself::DeleteItem1(target,4641,1);
										myself::GiveItem1(target,4642,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4642) == 1 ) {
										myself::DeleteItem1(target,4642,1);
										myself::GiveItem1(target,4643,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4643) == 1 ) {
										myself::DeleteItem1(target,4643,1);
										myself::GiveItem1(target,4644,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4644) == 1 ) {
										myself::DeleteItem1(target,4644,1);
										myself::GiveItem1(target,4645,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4645) == 1 ) {
										myself::DeleteItem1(target,4645,1);
										myself::GiveItem1(target,4646,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4646) == 1 ) {
										myself::DeleteItem1(target,4646,1);
										myself::GiveItem1(target,4647,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4647) == 1 ) {
										myself::DeleteItem1(target,4647,1);
										myself::GiveItem1(target,4648,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4648) == 1 ) {
										myself::DeleteItem1(target,4648,1);
										myself::GiveItem1(target,4649,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else if( gg::OwnItemCount(target,4649) == 1 ) {
										myself::DeleteItem1(target,4649,1);
										myself::GiveItem1(target,4650,1);
										myself::SoundEffect(target,"ItemSound.quest_itemget");
										myself::ShowSystemMessage(target,974);
									} else {
										myself::ShowSystemMessage(target,978);
									}
								} else {
									myself::ShowSystemMessage(target,975);
								}
							} else {
								myself::ShowSystemMessage(target,977);
							}
						}
					}
					break;
				}
				case 2: {
					myself::SetCurrentQuestID(662);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						if( gg::Rand(1000) < 583 ) {
							myself::GiveItem1(target,8765,1);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
						}
					}
					break;
				}
				case 3: {
					myself::SetCurrentQuestID(663);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						i0 = gg::Rand(1000);
						if( i0 < 807 ) {
							myself::GiveItem1(target,8766,1);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
						}
					}
					break;
				}
			}
		}
		super;
	}

	EventHandler ATTACKED(attacker,damage,skill_name_id) {
		myself::SetCurrentQuestID(350);
		switch(myself.i_quest0) {
			case 0: {
				myself.i_quest0 = 1;
				if( ( skill_name_id / 65536 ) == ( 137363457 / 65536 ) && myself.sm.hp <= ( myself.sm.max_hp * 0.500000 ) ) {
					myself.i_quest0 = 2;
					myself.c_quest0 = attacker;
				}
				break;
			}
			case 1: {
				if( ( skill_name_id / 65536 ) == ( 137363457 / 65536 ) && myself.sm.hp <= ( myself.sm.max_hp * 0.500000 ) ) {
					myself.i_quest0 = 2;
					myself.c_quest0 = attacker;
				}
				break;
			}
			case 2: {
				break;
			}
		}
		super;
	}

}
