<?xml version="1.0" encoding="utf-8"?>
<ItemRenderer>
  <Data>
    <Sprite name="s_frontStick" fileName="game/player_cosmetics3.rttex" textureSize="32" frame="24,21"/>
    <Sprite name="s_backStick" fileName="game/player_cosmetics3.rttex" textureSize="32" frame="24,21"/>
    <Sprite name="s_punchFlash" fileName="game/particles_large14.rttex" textureSize="64" frame="11,10"/>
    <Sprite name="s_punchRing1" fileName="game/particles_large14.rttex" textureSize="64" frame="4,10"/>
    <Sprite name="s_cymbalLeft" fileName="game/particles11.rttex" textureSize="32" frame="17,30"/>
    <Sprite name="s_cymbalRight" fileName="game/particles11.rttex" textureSize="32" frame="17,30"/>
    <Sprite name="s_drumLeft" fileName="game/particles11.rttex" textureSize="32" frame="16,30"/>
    <Sprite name="s_drumRight" fileName="game/particles11.rttex" textureSize="32" frame="16,30"/>
    <Sprite name="s_punchSlash" fileName="game/particles11.rttex" textureSize="32" frame="17,29"/>
    <Sprite name="s_hitFlash" fileName="game/particles11.rttex" textureSize="32" frame="15,30" />
    <Sprite name="s_hitSparks" fileName="game/particles11.rttex" textureSize="32" frame="16,29" />

    <StateMachines>
      <StateMachine name="Motion">
        <States>
          <State name="Idle" />
          <State name="Move" />
          <State name="JumpFall" />
          <State name="Punch" />
        </States>
        <Transitions>
          <Transition to="Idle" from="Move|Punch|JumpFall">
            <Condition type="and">
              <IsVariableFloat name="speed.length" operator="Less" abs="true">0.1</IsVariableFloat>
              <IsAction operatorType="NotEqual">PUNCH</IsAction>
            </Condition>
          </Transition>
          <Transition to="Move" from="Idle|Punch|JumpFall">
            <Condition type="and">
              <IsVariableFloat name="speed.x" operator="Greater" abs="true">0.1</IsVariableFloat>
              <IsVariableFloat name="speed.y" operator="Less" abs="true">0.1</IsVariableFloat>
              <IsAction operatorType="NotEqual">PUNCH</IsAction>
            </Condition>
          </Transition>
          <Transition to="Punch" from="Idle|Move|JumpFall">
            <Condition>
              <IsAction>PUNCH</IsAction>
            </Condition>
          </Transition>
          <Transition to="JumpFall" from="Idle|Move|Punch">
            <Condition type="and">
              <IsVariableFloat name="speed.y" operator="Greater" abs="true">0.1</IsVariableFloat>
              <IsAction operatorType="NotEqual">PUNCH</IsAction>
            </Condition>
          </Transition>
        </Transitions>
      </StateMachine>
    </StateMachines>
    <Animations>
      <CurveAnimationVec4 name="staff_rotation_anim_right" isLoop="true" useFacing="RIGHT" playOnState="Motion.Idle|Motion.Move" sprite="StickSprite" animTime="500">
        <Curve name="stick_rotation">
          <KeyFrame>0, 0, 0,0,1</KeyFrame>
          <KeyFrame>1, -360, 0,0,1</KeyFrame>
        </Curve>
      </CurveAnimationVec4>
      <CurveAnimationVec4 name="staff_rotation_anim_left" isLoop="true" useFacing="LEFT" playOnState="Motion.Idle|Motion.Move" sprite="StickSprite" animTime="500">
        <Curve name="stick_rotation">
          <KeyFrame>0, 0, 0,0,1</KeyFrame>
          <KeyFrame>1, 360, 0,0,1</KeyFrame>
        </Curve>
      </CurveAnimationVec4>
      <CurveAnimationVec4 name="staff_fixed_rotation" playOnState="Motion.Punch|Motion.JumpFall" sprite="StickSprite" animTime="1">
        <Curve name="stick_rotation">
          <KeyFrame>0, 0, 0,0,1</KeyFrame>
        </Curve>
      </CurveAnimationVec4>
      <SpriteAnimation name="a_punchRing1" playOnState="Motion.Punch" sprite="s_punchRing1" isLoop="true" animTime="700">
        <Frame>4,10</Frame>
        <Frame>5,10</Frame>
        <Frame>6,10</Frame>
        <Frame>7,10</Frame>
        <Frame>8,10</Frame>
        <Frame>9,10</Frame>
        <Frame>10,10</Frame>
      </SpriteAnimation>
      <SpriteCurveAnimation name="a_cymbalLeft" isLoop="true" playOnState="Motion.Punch" sprite="s_cymbalLeft" animTime="1000">
        <Curve name="alpha">
          <KeyFrame>0.f, 0.5f</KeyFrame>
          <KeyFrame>0.375f, 0.5f</KeyFrame>
          <KeyFrame>0.375f, 1.f</KeyFrame>
          <KeyFrame>0.425f, 1.f</KeyFrame>
          <KeyFrame>0.425f, 0.5f</KeyFrame>
          <KeyFrame>1.f, 0.5f</KeyFrame>
        </Curve>
      </SpriteCurveAnimation>
      <SpriteCurveAnimation name="a_cymbalRight" isLoop="true" playOnState="Motion.Punch" sprite="s_cymbalRight" animTime="1000">
        <Curve name="alpha">
          <KeyFrame>0.f, 0.5f</KeyFrame>
          <KeyFrame>0.675f, 0.5f</KeyFrame>
          <KeyFrame>0.675f, 1.f</KeyFrame>
          <KeyFrame>0.725f, 1.f</KeyFrame>
          <KeyFrame>0.725f, 0.5f</KeyFrame>
          <KeyFrame>1.f, 0.5f</KeyFrame>
        </Curve>
      </SpriteCurveAnimation>
      <SpriteCurveAnimation name="a_drumLeft" isLoop="true" playOnState="Motion.Punch" sprite="s_drumLeft" animTime="1000">
        <Curve name="alpha">
          <KeyFrame>0.f, 0.5f</KeyFrame>
          <KeyFrame>0.875f, 0.5f</KeyFrame>
          <KeyFrame>0.875f, 1.f</KeyFrame>
          <KeyFrame>0.925f, 1.f</KeyFrame>
          <KeyFrame>0.925f, 0.5f</KeyFrame>
          <KeyFrame>1.f, 0.5f</KeyFrame>
        </Curve>
      </SpriteCurveAnimation>
      <SpriteCurveAnimation name="a_drumRight" isLoop="true" playOnState="Motion.Punch" sprite="s_drumRight" animTime="1000">
        <Curve name="alpha">
          <KeyFrame>0.f, 0.5f</KeyFrame>
          <KeyFrame>0.075f, 0.5f</KeyFrame>
          <KeyFrame>0.075f, 1.f</KeyFrame>
          <KeyFrame>0.125f, 1.f</KeyFrame>
          <KeyFrame>0.125f, 0.5f</KeyFrame>
          <KeyFrame>1.f, 0.5f</KeyFrame>
        </Curve>
      </SpriteCurveAnimation>
    </Animations>

    <VariableMap>
      <Set name="stick_rotation">0, 0, 0, 1</Set>
      <Set name="stick_offset">-4.5, 3, 0</Set>
      <Set name="stick_post_rotation_offset">4,-1,0</Set>
    </VariableMap>

    <ParticleSystems>
      <ParticleSystem name="ps_punchFlash" updateStage="OnPunchBegin" renderStage="RenderInFront">
        <Emitter>
          <Set name="offset">0,-16</Set>
          <Set name="lifeTime">0</Set>
          <Set name="particlesPerEmission">1</Set>
        </Emitter>
        <Particle>
          <Set name="sprite">s_punchFlash</Set>
          <Set name="inSpecificOrder">true</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 0</KeyFrame>
            <KeyFrame>0.5, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Curve name="initialScale">
            <KeyFrame>0, 0.5,0.5</KeyFrame>
            <KeyFrame>1, 1.5,1.5</KeyFrame>
          </Curve>
          <Set name="lifeTime">0.3</Set>
        </Particle>
      </ParticleSystem>
      <ParticleSystem name="ps_rightDrumImpactFlash">
        <Emitter>
          <Set name="offset">20,-6</Set>
          <Set name="infLifeTime">true</Set>
          <Set name="infParticles">true</Set>
          <Set name="particlesPerEmission">1</Set>
          <Set name="emissionInterval">1.0</Set>
          <Set name="delayTimer">0.1</Set>
        </Emitter>
        <Particle>
          <Set name="sprite">s_punchFlash</Set>
          <Set name="relativeToEmitter">true</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 0</KeyFrame>
            <KeyFrame>0.5, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Curve name="initialScale">
            <KeyFrame>0, 0.15,0.15</KeyFrame>
            <KeyFrame>1, 0.5,0.5</KeyFrame>
          </Curve>
          <Set name="lifeTime">0.2</Set>
        </Particle>
      </ParticleSystem>
      <ParticleSystem name="ps_leftCymbalImpactFlash">
        <Emitter>
          <Set name="offset">-20,-24</Set>
          <Set name="infLifeTime">true</Set>
          <Set name="infParticles">true</Set>
          <Set name="particlesPerEmission">1</Set>
          <Set name="emissionInterval">1.0</Set>
          <Set name="particlesToEmit">1</Set>
          <Set name="delayTimer">0.4</Set>
        </Emitter>
        <Particle>
          <Set name="sprite">s_punchFlash</Set>
          <Set name="relativeToEmitter">true</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 0</KeyFrame>
            <KeyFrame>0.5, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Curve name="initialScale">
            <KeyFrame>0, 0.15,0.15</KeyFrame>
            <KeyFrame>1, 0.5,0.5</KeyFrame>
          </Curve>
          <Set name="lifeTime">0.2</Set>
        </Particle>
      </ParticleSystem>
      <ParticleSystem name="ps_rightCymbalImpactFlash">
        <Emitter>
          <Set name="offset">20,-24</Set>
          <Set name="infLifeTime">true</Set>
          <Set name="infParticles">true</Set>
          <Set name="particlesPerEmission">1</Set>
          <Set name="emissionInterval">1.0</Set>
          <Set name="particlesToEmit">1</Set>
          <Set name="delayTimer">0.7</Set>
        </Emitter>
        <Particle>
          <Set name="sprite">s_punchFlash</Set>
          <Set name="relativeToEmitter">true</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 0</KeyFrame>
            <KeyFrame>0.5, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Curve name="initialScale">
            <KeyFrame>0, 0.15,0.15</KeyFrame>
            <KeyFrame>1, 0.5,0.5</KeyFrame>
          </Curve>
          <Set name="lifeTime">0.2</Set>
        </Particle>
      </ParticleSystem>
      <ParticleSystem name="ps_leftDrumImpactFlash">
        <Emitter>
          <Set name="offset">-20,-6</Set>
          <Set name="infLifeTime">true</Set>
          <Set name="infParticles">true</Set>
          <Set name="particlesPerEmission">1</Set>
          <Set name="emissionInterval">1.0</Set>
          <Set name="particlesToEmit">1</Set>
          <Set name="delayTimer">0.9</Set>
        </Emitter>
        <Particle>
          <Set name="sprite">s_punchFlash</Set>
          <Set name="relativeToEmitter">true</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 0</KeyFrame>
            <KeyFrame>0.5, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Curve name="initialScale">
            <KeyFrame>0, 0.15,0.15</KeyFrame>
            <KeyFrame>1, 0.5,0.5</KeyFrame>
          </Curve>
          <Set name="lifeTime">0.2</Set>
        </Particle>
      </ParticleSystem>
      <ParticleSystem name="ps_punchSlash">
        <Emitter>
          <Set name="offset">10,-16</Set>
          <Set name="emissionInterval">0.2</Set>
          <Set name="infParticles">true</Set>
          <Set name="infLifeTime">true</Set>
          <Set name="particlesPerEmission">10</Set>
        </Emitter>
        <Particle>
          <Set name="sprite">s_punchSlash</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Curve name="initialScale">
            <KeyFrame>0, 0, 0</KeyFrame>
            <KeyFrame>0.1, 0, 0</KeyFrame>
            <KeyFrame>0.1, 0.5, 0.5</KeyFrame>
            <KeyFrame>1, 1.5, 1.5</KeyFrame>
          </Curve>
          <Curve name="initialAlpha">
            <KeyFrame>0, 0.15</KeyFrame>
            <KeyFrame>0.5, 0.15</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Set name="lifeTime">0.6</Set>
          <Set name="rotateWithVelocity">true</Set>
          <VectorTo name="initialVelocity" source="targetPos"  duration="lifeTime" x="1"/>
        </Particle>
      </ParticleSystem>
      <ParticleSystem name="ps_hitFlash">
        <Emitter>
          <Set name="lifeTime">0</Set>
          <Set name="particlesPerEmission">1</Set>
        </Emitter>
        <Particle>
          <Set name="sprite">s_hitFlash</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Curve name="initialScale">
            <KeyFrame>0, 1, 1</KeyFrame>
            <KeyFrame>1, 1.3, 1.3</KeyFrame>
          </Curve>
          <Curve name="initialAlpha">
            <KeyFrame>0, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Set name="lifeTime">0.5</Set>
          <Random name="initialAngle" min="0" max="360" />
        </Particle>
      </ParticleSystem>
      <ParticleSystem name="ps_hitSparks">
        <Emitter>
          <Set name="lifeTime">0.25</Set>
          <Set name="emissionInterval">0.1</Set>
          <Set name="infParticles">true</Set>
          <Set name="particlesPerEmission">1</Set>
        </Emitter>
        <Particle randomSpriteFrame="true">
          <Set name="sprite">s_hitSparks</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Set name="lifeTime">1</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 0</KeyFrame>
            <KeyFrame>0.5, 1</KeyFrame>
            <KeyFrame>0.6, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Curve name="initialScale">
            <KeyFrame>0, 0.25, 0.25</KeyFrame>
            <KeyFrame>0.5, 0.5, 0.5</KeyFrame>
            <KeyFrame>1, 0.5, 0.5</KeyFrame>
          </Curve>
          <Random name="offset" min="-16,-15" max="16,15" />
          <Select name="initalRGB" input="randomNumber">
            <Item>1.00, 0.72, 0.96</Item>
            <Item>1.00, 0.73, 0.36</Item>
            <Item>0.57, 0.70, 1.00</Item>
            <Item>0.89, 0.89, 0.36</Item>
            <Item>0.53, 0.91, 0.60</Item>
            <Item>0.43, 0.85, 0.95</Item>
            <Item>1.00, 0.58, 0.55</Item>
            <Item>0.31, 0.86, 0.55</Item>
          </Select>
        </Particle>
      </ParticleSystem>
    </ParticleSystems>

    <RenderOptions>
      <Default>
        <Set name="RenderFrontArmInfected">true</Set>
        <Set name="RenderBackArmInfected">true</Set>
        <Set name="RenderBackArmBuild">false</Set>
        <Set name="DefaultRenderMannequinHandItem">false</Set>
        <Set name="RenderBackArmInTheFront">false</Set>
        <Set name="IgnoreDefaultDamagedTileEffect">true</Set>
        <Set name="PlayDefaultPunchAudio">false</Set>
      </Default>
      <Override overrideOnState="Motion.Punch">
        <Set name="RenderBackArmInTheFront">True</Set>
      </Override>
    </RenderOptions>
  </Data>

  <RenderRules>
    <AddClothingParticles>
      <ParticleSystemUpdate name="ps_punchSlash" onState="Motion.Punch"/>
      <StopIf>
        <IsZombified>true</IsZombified>
        <IsTrnsformed>true</IsTrnsformed>
        <IsWearing slot="SHIRT">ITEM_ID_TACTICAL_STEALTH_DEVICE</IsWearing>
        <IsWearing slot="SHOES">ITEM_ID_STAR_FIGHTER_REBEL_RAIDER</IsWearing>
        <IsWearing slot="SHOES">ITEM_ID_STAR_FIGHTER_IMPERIAL_ENFORCER</IsWearing>
      </StopIf>
      <ParticleSystemUpdate name="ps_leftDrumImpactFlash" onState="Motion.Punch"/>
      <ParticleSystemUpdate name="ps_rightDrumImpactFlash" onState="Motion.Punch"/>
      <ParticleSystemUpdate name="ps_leftCymbalImpactFlash" onState="Motion.Punch"/>
      <ParticleSystemUpdate name="ps_rightCymbalImpactFlash" onState="Motion.Punch"/>
    </AddClothingParticles>
    <Update>
      <StopIf>
        <IsZombified>true</IsZombified>
        <IsTrnsformed>true</IsTrnsformed>
        <IsWearing slot="SHIRT">ITEM_ID_TACTICAL_STEALTH_DEVICE</IsWearing>
        <IsWearing slot="SHOES">ITEM_ID_STAR_FIGHTER_REBEL_RAIDER</IsWearing>
        <IsWearing slot="SHOES">ITEM_ID_STAR_FIGHTER_IMPERIAL_ENFORCER</IsWearing>
      </StopIf>
      <AvatarTransform class="ArmAngle" onState="Motion.Idle|Motion.Move">
        <Set name="armName">arm1Angle</Set>
        <Set name="animTime">700</Set>
        <Set name="Curve">
          <KeyFrame>0.0, 270</KeyFrame>
          <KeyFrame>0.5, 330</KeyFrame>
          <KeyFrame>1, 270</KeyFrame>
        </Set>
      </AvatarTransform>
      <AvatarTransform class="ArmAngle" onState="Motion.Punch">
        <Set name="armName">arm2Angle</Set>
        <Set name="animTime">1000</Set>
        <Set name="Curve">
          <KeyFrame>0.0, 60</KeyFrame>
          <KeyFrame>0.2, 60</KeyFrame>
          <KeyFrame>0.3, 120</KeyFrame>
          <KeyFrame>0.4, 90</KeyFrame>
          <KeyFrame>0.5, 60</KeyFrame>
          <KeyFrame>0.8, 60</KeyFrame>
          <KeyFrame>0.9, 0</KeyFrame>
          <KeyFrame>1.0, 60</KeyFrame>
        </Set>
      </AvatarTransform>
      <AvatarTransform class="ArmAngle" onState="Motion.Punch">
        <Set name="armName">arm1Angle</Set>
        <Set name="animTime">1000</Set>
        <Set name="Curve">
          <KeyFrame>0.0, 300</KeyFrame>
          <KeyFrame>0.1, 360</KeyFrame>
          <KeyFrame>0.2, 300</KeyFrame>
          <KeyFrame>0.5, 300</KeyFrame>
          <KeyFrame>0.6, 240</KeyFrame>
          <KeyFrame>0.7, 270</KeyFrame>
          <KeyFrame>0.8, 300</KeyFrame>
          <KeyFrame>1.0, 300</KeyFrame>
        </Set>
      </AvatarTransform>
    </Update>
    <OnPunchUpdate>
      <AvatarTransform class="Emotion">
        <Set name="emotion">HAPPY</Set>
      </AvatarTransform>
    </OnPunchUpdate>
    <RenderBackHandItem>
      <StopIf type="and">
        <IsZombified>true</IsZombified>
        <IsAction>PUNCH</IsAction>
      </StopIf>
      <Translate>stick_offset</Translate>
      <Group>
        <StopIf>
          <IsZombified>true</IsZombified>
        </StopIf>
        <Rotate>stick_rotation</Rotate>
        <Translate>stick_post_rotation_offset</Translate>
        <SpriteRender name="s_backStick" alignment="CENTER" blend="PREMULTIPLIED_ALPHA"/>
      </Group>
      <Group>
        <StopIf>
          <IsZombified>false</IsZombified>
        </StopIf>
        <Rotate>0,0,0,1</Rotate>
        <Translate>stick_post_rotation_offset</Translate>
        <SpriteRender name="s_backStick" alignment="CENTER" blend="PREMULTIPLIED_ALPHA"/>
      </Group>
    </RenderBackHandItem>
    <RenderHandItem>
      <SpriteRender name="s_frontStick" offset="4,7" rotationPoint="0,1" alignment="CENTER" rotateOffset="true" blend="PREMULTIPLIED_ALPHA" onState="Motion.Idle|Motion.Move|Motion.JumpFall"/>
      <SpriteRender name="s_frontStick" offset="-4,7" flip="1,0" rotationPoint="0,1" alignment="CENTER" rotateOffset="true" blend="PREMULTIPLIED_ALPHA" onState="Motion.Punch"/>
    </RenderHandItem>
    <RenderBehind value="playerCenter">
      <StopIf>
        <IsZombified>true</IsZombified>
        <IsTrnsformed>true</IsTrnsformed>
        <IsWearing slot="SHIRT">ITEM_ID_TACTICAL_STEALTH_DEVICE</IsWearing>
        <IsWearing slot="SHOES">ITEM_ID_STAR_FIGHTER_REBEL_RAIDER</IsWearing>
        <IsWearing slot="SHOES">ITEM_ID_STAR_FIGHTER_IMPERIAL_ENFORCER</IsWearing>
      </StopIf>
      <SpriteRender name="s_punchRing1" offset="0,-16" blend="PREMULTIPLIED_ALPHA" onState="Motion.Punch" drawShadow="false"/>
    </RenderBehind>
    <RenderInFront>
      <MusicSource onState="Motion.Punch">
        <Set name="MusicFile">audio/drumloop.wav</Set>
        <Set name="FadeOutTimeMs">100</Set>
      </MusicSource>
      <StopIf>
        <IsZombified>true</IsZombified>
        <IsTrnsformed>true</IsTrnsformed>
        <IsWearing slot="SHIRT">ITEM_ID_TACTICAL_STEALTH_DEVICE</IsWearing>
        <IsWearing slot="SHOES">ITEM_ID_STAR_FIGHTER_REBEL_RAIDER</IsWearing>
        <IsWearing slot="SHOES">ITEM_ID_STAR_FIGHTER_IMPERIAL_ENFORCER</IsWearing>
      </StopIf>
      <SpriteRender name="s_cymbalLeft" useFixedRotation="true" offset="-25,-22" blend="PREMULTIPLIED_ALPHA" onState="Motion.Punch" drawShadow="false"/>
      <SpriteRender name="s_cymbalRight" useFixedRotation="true" offset="25,-22" blend="PREMULTIPLIED_ALPHA" onState="Motion.Punch" drawShadow="false" flip="1,0"/>
      <SpriteRender name="s_drumLeft" useFixedRotation="true" offset="-25,-4" blend="PREMULTIPLIED_ALPHA" onState="Motion.Punch" drawShadow="false"/>
      <SpriteRender name="s_drumRight" useFixedRotation="true" offset="25,-4" blend="PREMULTIPLIED_ALPHA" onState="Motion.Punch" drawShadow="false" flip="1,0"/>
    </RenderInFront>
    <OnDamagedTile>
      <ParticleSystemUpdate name="ps_hitFlash"/>
      <ParticleSystemUpdate name="ps_hitSparks"/>
    </OnDamagedTile>
  </RenderRules>
</ItemRenderer>