@LabelIndex 163108
@StringIndex 20593
class 0 lesser_giant_scout : warrior_aggressive_casting_ddmagic {
handler:
	EventHandler MY_DYING(always_list,c1,c2,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;
		if( gg::HaveMemo(target,377) && gg::OwnItemCount(target,5892) > 0 ) {
			random1_list::SetInfo(1,target);
		}
		if( gg::HaveMemo(target,377) && gg::OwnItemCount(target,5892) > 0 ) {
			random1_list::SetInfo(1,target);
		}
		if( gg::IsNull(lparty) == 0 ) {
			for(i9 = 0; i9 < lparty.member_count; i9++) {
				target = myself::GetMemberOfParty(lparty,i9);
				if( gg::HaveMemo(target,377) && gg::OwnItemCount(target,5892) > 0 ) {
					random1_list::SetInfo(1,target);
				}
			}
		}
		target = last_attacker;
		if( gg::HaveMemo(target,426) == 1 ) {
			random1_list::SetInfo(2,target);
		}
		if( gg::HaveMemo(target,426) == 1 ) {
			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,426) == 1 ) {
					random1_list::SetInfo(2,target);
				}
			}
		}
		while( gg::IsNull(code_info = always_list::Next()) == 0 ) {
			switch(code_info.code) {
				case 0: {
					myself::SetCurrentQuestID(503);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						c1 = myself::GetLastAttacker();
						if( c1.master ) {
							c1 = c1.master;
						}
						c2 = myself::Pledge_GetLeader(c1);
						if( myself::IsNullCreature(c2) == 0 ) {
							if( gg::HaveMemo(c2,503) == 1 && gg::GetMemoState(c2,503) == 5000 && myself::DistFromMe(c2) <= 1500 ) {
								i0 = gg::Rand(100);
								c2.quest_last_reward_time = myself::GetCurrentTick();
								if( i0 < 10 ) {
									if( gg::OwnItemCount(c2,3846) < 10 ) {
										myself::GiveItem1(c2,3846,1);
									}
								} else if( i0 < 30 ) {
									if( gg::OwnItemCount(c2,3844) < 10 ) {
										myself::GiveItem1(c2,3844,1);
									}
								} else if( i0 < 80 ) {
									myself::GiveItem1(c2,3845,1);
								}
							}
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 ) {
			switch(code_info.code) {
				case 1: {
					myself::SetCurrentQuestID(377);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						if( gg::Rand(1000) < 22 ) {
							myself::GiveItem1(target,5955,1);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
						}
					}
					break;
				}
				case 2: {
					myself::SetCurrentQuestID(426);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						if( gg::Rand(100) < 15 ) {
							myself::GiveItem1(target,7586,3);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
						} else {
							myself::GiveItem1(target,7586,2);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
						}
					}
					break;
				}
			}
		}
		super;
	}

}
