@LabelIndex 205923
@StringIndex 23862
class 0 horrorble_cannon_great : party_leader_ag_pabelgolem {
handler:
	EventHandler MY_DYING(always_list,c0,code_info,i0,i1,i4,i9,last_attacker,lparty,member,random1_list,target) {
		always_list = gg::AllocCodeInfoList();
		random1_list = gg::AllocCodeInfoList();
		target = last_attacker;
		if( gg::HaveMemo(target,647) == 1 && gg::GetMemoState(target,647) == ( ( 1 * 10 ) + 1 ) ) {
			random1_list::SetInfo(0,target);
		}
		if( gg::HaveMemo(target,647) == 1 && gg::GetMemoState(target,647) == ( ( 1 * 10 ) + 1 ) ) {
			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,647) == 1 && gg::GetMemoState(target,647) == ( ( 1 * 10 ) + 1 ) ) {
					random1_list::SetInfo(0,target);
				}
			}
		}
		target = last_attacker;
		always_list::SetInfo(1,target);
		while( gg::IsNull(code_info = always_list::Next()) == 0 ) {
			switch(code_info.code) {
				case 1: {
					myself::SetCurrentQuestID(714);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						c0 = myself::Pledge_GetLeader(target);
						if( myself::IsNullCreature(c0) == 0 ) {
							if( gg::HaveMemo(c0,714) == 1 && gg::GetMemoState(c0,714) == 6 && myself::DistFromMe(c0) <= 1500 ) {
								i0 = gg::GetMemoStateEx(c0,714,1);
								if( i0 < 300 ) {
									myself::SetMemoStateEx(c0,714,1,( i0 + 1 ));
								} else {
									myself::SetMemoState(c0,714,7);
									myself::SetFlagJournal(c0,714,8);
									myself::ShowQuestMark(c0,714);
									myself::SoundEffect(c0,"ItemSound.quest_middle");
								}
							}
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 ) {
			switch(code_info.code) {
				case 0: {
					myself::SetCurrentQuestID(647);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						i4 = gg::Rand(1000);
						if( i4 < 967 ) {
							if( ( gg::OwnItemCount(target,8100) + 1 ) >= 500 ) {
								if( gg::OwnItemCount(target,8100) < 500 ) {
									myself::GiveItem1(target,8100,( 500 - gg::OwnItemCount(target,8100) ));
									myself::SoundEffect(target,"ItemSound.quest_middle");
								}
								myself::SetFlagJournal(target,647,2);
								myself::ShowQuestMark(target,647);
								myself::SetMemoState(target,647,( ( 1 * 10 ) + 2 ));
							} else {
								myself::GiveItem1(target,8100,1);
								myself::SoundEffect(target,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
			}
		}
		super;
	}

}
