@startuml RoomSplitWithEffects
header Student Moves to a Room with another Student
hide footbox

participant S1 as "student1 : Student"
participant S1S as "student1State : StudentActions"
participant S1I as "student1Inventory : Inventory"
participant D as "door : Door"
participant R1 as "room1 : Room"
participant R2 as "room2 : Room"
participant W as "gasEffect : GasEffect"
participant F as "bestGasMaskFinder : BestGasMaskFinder"

ref over S1, W: Setup Neighbouring Rooms, with a student in one of them, and a a Gas Effect in the other
-> S1 ++: move(door)
S1 -> S1S ++: move(door)
S1S -> D ++: leadsTo(room1)
return room2
S1S -> R2 ++ : enter(student1)
R2 -> R2 : isFull()
opt isFull == false
    R2 -> S1 ++ : acceptEffect(gasEffect, null)
    S1 -> F ++: findIn(student1Inventory)
    F -> S1I ++: acceptVisitor(bestGasMaskFinder)
    return
    return null
    S1 -> W ++ : applyEffect(student1)
    W -> S1 ++: dropAllTo(room2)
    S1 -> S1I ++ : dropAllTo(room2)
    return
    return
    create S as "stunnedStep : StunnedStep"
    W --> S <<create>>

    W -> S1 ++: setActionState(stunnedStep)
    return
    return
    return
    R2 -> S1 ++ : attack()
    S1 -> S1S ++ : attack()
    return
    return
end
return isSuccessful
opt isSuccessful
    S1S -> R1 ++ : leave(student1)
    return
end
return 
return 


@enduml

