<?xml version="1.0" encoding="utf-8"?>
<Defs>
  <RitualBehaviorDef>
    <defName>LewdWeddingBehaviour</defName>
    <durationTicks>6250</durationTicks>
    <spectatorsLabel>Spectators</spectatorsLabel>
    <spectatorGerund>attending</spectatorGerund>
    <roles>
      <li Class="RitualRoleTag">
        <label>speaker</label>
        <id>celebrant</id>
        <tag>Moralist</tag>
        <precept>IdeoRole_Moralist</precept>
        <required>true</required>
        <substitutable>true</substitutable>
        <maxCount>1</maxCount>
        <countsAsParticipant>false</countsAsParticipant>
        <mustBeAbleToReachTarget>true</mustBeAbleToReachTarget>
      </li>
      <!-- TODO: Figure out poly marriages -->
      <li Class="SCE.RitualRoleBetrothed">
        <label>engaged pawn</label>
        <missingDesc>engaged pawn</missingDesc>
        <mergeId>engaged pawn</mergeId>
        <!-- <categoryLabel></categoryLabel> <!- Blank because 'marrying' gets converted to 'marryings' and nothing else sounds right. -->
        <id>initiator</id>
        <required>true</required>
        <maxCount>1</maxCount>
        <countsAsParticipant>false</countsAsParticipant>
        <mustBeAbleToReachTarget>true</mustBeAbleToReachTarget>
      </li>
      <li Class="SCE.RitualRoleBetrothed">
        <label>engaged pawn</label>
        <missingDesc>engaged pawn</missingDesc>
        <mergeId>engaged pawn</mergeId>
        <id>receiver</id>
        <required>true</required>
        <maxCount>1</maxCount>
        <countsAsParticipant>false</countsAsParticipant>
        <allowOtherIdeos>true</allowOtherIdeos>
        <mustBeAbleToReachTarget>true</mustBeAbleToReachTarget>
      </li>
    </roles>
    <stages>
      <li> <!-- Gather -->
        <defaultDuty>SpectateWedding</defaultDuty>
        <roleBehaviors>
          <li>
            <roleId>celebrant</roleId>
            <dutyDef>ArriveToCell</dutyDef>
            <customPositions>
              <li Class="RitualPosition_Lectern">
                <maxDistanceToFocus>5</maxDistanceToFocus>
              </li>
              <li Class="SCE.RitualPosition_ConditionalTargetDef">
                <def>MarriageSpot</def>
                <position Class="SCE.RitualPosition_RelativeThingCentre">
                  <side>North</side>
                </position>
              </li>
              <li Class="SCE.RitualPosition_ConditionalTargetDef">
                <def>Ideogram</def>
                <position Class="RitualPosition_OnInteractionCell" />
              </li>
              <!--li Class="RitualPosition_OnInteractionCell" /-->
              <li Class="SCE.RitualPosition_RelativeThingCentre">
                <side>South</side>
                <facing>South</facing>
              </li>
            </customPositions>
          </li>
          <li>
            <roleId>initiator</roleId>
            <dutyDef>ArriveToCell</dutyDef>
            <customPositions>
              <li Class="SCE.RitualPosition_ConditionalTargetDef">
                <def>MarriageSpot</def>
                <position Class="SCE.RitualPosition_OnThingCentre">
                  <facing>East</facing>
                </position>
              </li>
              <li Class="SCE.RitualPosition_ConditionalTargetDef">
                <def>Ideogram</def>
                <position Class="SCE.RitualPosition_OnThingCentre">
                  <offset>(-1,0,0)</offset>
                  <facing>East</facing>
                </position>
              </li>
              <li Class="SCE.RitualPosition_RelativeThingCentre">
                <side>South</side>
                <offset>(-1,0,-1)</offset>
                <facing>East</facing>
              </li>
            </customPositions>
          </li>
          <li>
            <roleId>receiver</roleId>
            <dutyDef>ArriveToCell</dutyDef>
            <customPositions>
              <li Class="SCE.RitualPosition_ConditionalTargetDef">
                <def>MarriageSpot</def>
                <position Class="SCE.RitualPosition_OnThingCentre">
                  <offset>(1,0,0)</offset>
                  <facing>West</facing>
                </position>
              </li>
              <li Class="SCE.RitualPosition_ConditionalTargetDef">
                <def>Ideogram</def>
                <position Class="SCE.RitualPosition_OnThingCentre">
                  <offset>(1,0,0)</offset>
                  <facing>West</facing>
                </position>
              </li>
              <li Class="SCE.RitualPosition_RelativeThingCentre">
                <side>South</side>
                <offset>(0,0,-1)</offset>
                <facing>West</facing>
              </li>
            </customPositions>
          </li>
        </roleBehaviors>
        <endTriggers>
          <li Class="StageEndTrigger_RolesArrived">
            <roleIds>
              <li>celebrant</li>
              <li>initiator</li>
              <li>receiver</li>
            </roleIds>
          </li>
        </endTriggers>
      </li>
      <li Class="RitualStage_InteractWithRole"> <!-- Preliminary speech -->
        <defaultDuty>SpectateWedding</defaultDuty>
        <targets>
          <li>
            <pawnId>initiator</pawnId>
            <targetId>receiver</targetId>
          </li>
          <li>
            <pawnId>receiver</pawnId>
            <targetId>initiator</targetId>
          </li>
        </targets>
        <roleBehaviors>
          <li>
            <roleId>celebrant</roleId>
            <dutyDef>SpeakOnCell</dutyDef>
            <speakerInteraction>Speech_LewdWedding</speakerInteraction>
            <customPositions> <!-- Need to repeat celebrant positions to maintain facing -->
              <li Class="RitualPosition_Lectern">
                <maxDistanceToFocus>5</maxDistanceToFocus>
              </li>
              <li Class="SCE.RitualPosition_ConditionalTargetDef">
                <def>MarriageSpot</def>
                <position Class="SCE.RitualPosition_RelativeThingCentre">
                  <side>North</side>
                </position>
              </li>
              <li Class="SCE.RitualPosition_ConditionalTargetDef">
                <def>Ideogram</def>
                <position Class="RitualPosition_OnInteractionCell">
                </position>
              </li>
              <li Class="SCE.RitualPosition_RelativeThingCentre">
                <side>South</side>
                <facing>South</facing>
              </li>
            </customPositions>
          </li>
          <li>
            <roleId>initiator</roleId>
            <dutyDef>MarryPawnFake</dutyDef>
          </li>
          <li>
            <roleId>receiver</roleId>
            <dutyDef>MarryPawnFake</dutyDef>
          </li>
        </roleBehaviors>
        <endTriggers>
          <li Class="StageEndTrigger_DurationPercentage">
            <percentage>0.2</percentage>
            <countsTowardsProgress>true</countsTowardsProgress>
          </li>
        </endTriggers>
      </li>
      <li Class="RitualStage_InteractWithRole"> <!-- Wedding ceremony! -->
        <defaultDuty>SpectateWedding</defaultDuty>
        <targets>
          <li>
            <pawnId>initiator</pawnId>
            <targetId>receiver</targetId>
          </li>
          <li>
            <pawnId>receiver</pawnId>
            <targetId>initiator</targetId>
          </li>
        </targets>
        <roleBehaviors>
          <li> <!-- Continue speaking instead? -->
            <roleId>celebrant</roleId>
            <dutyDef>Idle</dutyDef>
            <customPositions> <!-- Need to repeat celebrant positions to maintain facing -->
              <li Class="RitualPosition_Lectern">
                <maxDistanceToFocus>5</maxDistanceToFocus>
              </li>
              <li Class="SCE.RitualPosition_ConditionalTargetDef">
                <def>MarriageSpot</def>
                <position Class="SCE.RitualPosition_RelativeThingCentre">
                  <side>North</side>
                </position>
              </li>
              <li Class="SCE.RitualPosition_ConditionalTargetDef">
                <def>Ideogram</def>
                <position Class="RitualPosition_OnInteractionCell">
                </position>
              </li>
              <li Class="SCE.RitualPosition_RelativeThingCentre">
                <side>South</side>
                <facing>South</facing>
              </li>
            </customPositions>
          </li>
          <li>
            <roleId>initiator</roleId>
            <dutyDef>Consummate</dutyDef>
          </li>
          <li>
            <roleId>receiver</roleId>
            <dutyDef>GetConsummated</dutyDef>
          </li>
        </roleBehaviors>
        <postAction Class="SCE.RitualStageAction_MarryPawns">
          <roleIds>
            <li>initiator</li>
            <li>receiver</li>
          </roleIds>
        </postAction>
        <endTriggers>
          <li Class="SCE.StageEndTrigger_SexFinished">
            <role>initiator</role>
            <countsTowardsProgress>true</countsTowardsProgress>
          </li>
          <li Class="StageEndTrigger_DurationPercentage">
            <percentage>0.6</percentage>
            <countsTowardsProgress>true</countsTowardsProgress>
          </li>
        </endTriggers>
      </li>
      <li>
        <defaultDuty>Party</defaultDuty>
        <endTriggers>
          <li Class="StageEndTrigger_DurationPercentage">
            <percentage>0.9</percentage>
            <countsTowardsProgress>true</countsTowardsProgress>
          </li>
        </endTriggers>
      </li>
    </stages>
  </RitualBehaviorDef>
</Defs>