function Trig_EpDo2_Func001Func001Func001C takes nothing returns boolean
// function nay dung de kiem tra slot 1 va 2 cua unit co mon A hay ko, mon nay co ID la I000
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 1)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 2)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func002C takes nothing returns boolean
// tuong tu cho slot 1 va 3, kiem tra xem co mon A
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 1)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 3)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func003C takes nothing returns boolean
// va duong nhien la kiem tra cho slot 1 va 4 co mon A hay ko
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 1)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 4)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func004C takes nothing returns boolean
// kiem tra slot 1 va 5
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 1)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 5)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func005C takes nothing returns boolean
// tiep tuc cho slot 1 va 6, cu lam tuan tu cho nhung slot con lai
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 1)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 6)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func006C takes nothing returns boolean
// kiem tra cho slot 2 va 3
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 2)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 3)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func007C takes nothing returns boolean
// kiem tra tiep tuc cho slot 2 va 4
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 2)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 4)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func008C takes nothing returns boolean
// kiem tra cho slot 2 va 5
// ban cu lam lan luot cho cac slot con lai, theo quy tac canh cay, cai nao da kiem tra roi thi ko kiem tra lai nua
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 2)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 5)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func009C takes nothing returns boolean
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 2)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 6)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func010C takes nothing returns boolean
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 3)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 4)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func011C takes nothing returns boolean
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 3)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 5)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func012C takes nothing returns boolean
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 3)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 6)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func013C takes nothing returns boolean
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 4)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 5)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func014C takes nothing returns boolean
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 4)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 6)) == 'I000' ) ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Func001Func001Func015C takes nothing returns boolean
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 5)) == 'I000' ) ) then
return false
endif
if ( not ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), 6)) == 'I000' ) ) then
return false
endif
return true
endfunction
// khi kiem tra den slot 5 va 6 thi coi nhu da kiem tra xong
// nhung trigger duoi la de lien ket cac condition lai sao cho phai dong thoi ca hai mon do A hien dien trong hom do
// rat quan trong do, neu ko thi se ko phai la condition " and ", tuc la co mon A and mon A
function Trig_EpDo2_Func001Func001C takes nothing returns boolean
if ( Trig_EpDo2_Func001Func001Func001C() ) then
// mon A phai cung xuat hien o slot 1 va 2, nhung if phia duoi la cho cac slot con lai
return true
endif
if ( Trig_EpDo2_Func001Func001Func002C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func003C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func004C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func005C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func006C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func007C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func008C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func009C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func010C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func011C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func012C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func013C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func014C() ) then
return true
endif
if ( Trig_EpDo2_Func001Func001Func015C() ) then
return true
endif
return false
endfunction
function Trig_EpDo2_Func001C takes nothing returns boolean
if ( not Trig_EpDo2_Func001Func001C() ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'I001') == true ) ) then
// kiem tra them coi co and them mon B hay ko, mon nay co ID la I001
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), 'I004') == true ) ) then
// va duong nhien phai co mon D, tuc la cuon sach thi moi cho ghep
// tai sao phai mon D, vi mon C gia khi mua vao se remove va cho ra mon D
return false
endif
return true
endfunction
function Trig_EpDo2_Conditions takes nothing returns boolean
// tong hop lai cac condition tren, 15 or ( 15 truong hop xuat hien cua mon A ) cua 2 and ( cung xuat hien 2 mon A trong thung, roi and voi 2 mon B va D
if ( not Trig_EpDo2_Func001C() ) then
return false
endif
return true
endfunction
function Trig_EpDo2_Actions takes nothing returns nothing
//cai nay la hanh dong ne, sau khi cac dieu kien or va and phia tren dung
local unit unitghepdo
// khai bao bien
local location chounitghepdo
// nhu tren
set unitghepdo = GetManipulatingUnit()
// set cho 2 bien do
set chounitghepdo = GetUnitLoc(unitghepdo)
// thuc ra den day thi ko quan trong nua roi vi chi can remove cac mon do thanh phan de cho ra non ghep cuoi cung
// quan trong la mot dong dieu kien o tren, ban phai hieu cai nao or, cai nao and
call RemoveItem( GetItemOfTypeFromUnitBJ(unitghepdo, 'I000') )
call RemoveItem( GetItemOfTypeFromUnitBJ(unitghepdo, 'I000') )
call RemoveItem( GetItemOfTypeFromUnitBJ(unitghepdo, 'I001') )
call RemoveItem( GetItemOfTypeFromUnitBJ(unitghepdo, 'I004') )
// remove 2 mon A, mot mon B va remove mon D ( chinh la cuon sach do )
call UnitAddItemByIdSwapped( 'I003', unitghepdo )
// tao item C that cho unit dang ghep do
call AddSpecialEffectLocBJ( chounitghepdo, "Abilities\\Spells\\Items\\AIam\\AIamTarget.mdl" )
// them hieu ung vao
call DestroyEffect( GetLastCreatedEffectBJ() )
set chounitghepdo = null
set unitghepdo = null
// huy effect va set bien cho bang null thoi
endfunction
//===========================================================================
function InitTrig_EpDo2 takes nothing returns nothing
// trigger nay dung de lien ket cac trigger tren
set gg_trg_EpDo2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_EpDo2, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_EpDo2, Condition( function Trig_EpDo2_Conditions ) )
call TriggerAddAction( gg_trg_EpDo2, function Trig_EpDo2_Actions )
// kiem tra dieu kien, goi hanh dong, vay la xong roi do
endfunction