<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:element name="ADdata">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="aliens">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="alien" type="alienType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="maps">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="map" type="mapType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="waves">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="wave" type="waveType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="levels">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="level" type="levelType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
<!--                <xsd:element name="waveParts">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="wavePart" type="wavePartType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>-->
                <xsd:element name="wavesOnLevels">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="waveOnLevel" type="waveOnLevelType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="splashes">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="splash" type="splashType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="towers">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="tower" type="towerType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="triggers">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="trigger" type="triggerType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="chains">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="chain" type="chainType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="towersOnLevels">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="towerOnLevel" type="towerOnLevelType" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="morphs">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="morph" type="morphType" maxOccurs="unbounded" minOccurs="0"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="animations">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="animation" type="animationType" maxOccurs="unbounded" minOccurs="0"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    <xsd:complexType name="alienType">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="id" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="score" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="speed" type="xsd:float" use="required"/>
        <xsd:attribute name="health" type="xsd:float" use="required"/>
        <xsd:attribute name="prise" type="xsd:nonNegativeInteger" use="required"/>
        <xsd:attribute name="imageType" type="xsd:integer" use="required"/>
        <xsd:attribute name="armor" type="xsd:float" use="optional"/>
        <xsd:attribute name="regeneration" type="xsd:float" use="optional"/>
        <xsd:attribute name="flying" type="xsd:boolean" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="splashType">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="id" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="speed" type="xsd:float" use="required"/>
        <xsd:attribute name="imageType" type="xsd:integer" use="required"/>
        <xsd:attribute name="lifetime" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="autoControl" type="xsd:boolean" use="optional"/>
        <xsd:attribute name="animSpeed" type="xsd:float" use="optional"/>
        <xsd:attribute name="ZValue" type="xsd:float" use="optional"/>
        <xsd:attribute name="keepOnAlien" type="xsd:boolean" use="optional"/>
        <xsd:attribute name="compositionMode" use="optional">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="Source"/>
                    <xsd:enumeration value="NotSource"/>
                    <xsd:enumeration value="Plus"/>
                    <xsd:enumeration value="Multiply"/>
                    <xsd:enumeration value="Screen"/>
                    <xsd:enumeration value="Overlay"/>
                    <xsd:enumeration value="Darken"/>
                    <xsd:enumeration value="Lighten"/>
                    <xsd:enumeration value="ColorDodge"/>
                    <xsd:enumeration value="ColorBurn"/>
                    <xsd:enumeration value="HardLight"/>
                    <xsd:enumeration value="SoftLight"/>
                    <xsd:enumeration value="Difference"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
    </xsd:complexType>

    <xsd:complexType name="triggerType">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="id" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="count" type="xsd:nonNegativeInteger" use="optional"/>
        <xsd:attribute name="timer" type="xsd:nonNegativeInteger" use="optional"/>
        <xsd:attribute name="chance" type="xsd:positiveInteger" use="optional"/>
        <xsd:attribute name="randomPosRadius" type="xsd:float" use="optional"/>
        <xsd:attribute name="damage" type="xsd:float" use="optional"/>
        <xsd:attribute name="radius" type="xsd:float" use="optional"/>
        <xsd:attribute name="delParent" type="xsd:boolean" use="optional"/>
        <xsd:attribute name="type" use="required">
           <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="onDestination"/>
                    <xsd:enumeration value="onTimer"/>
                    <xsd:enumeration value="onAlienInRadius"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
        <xsd:attribute name="childAim" use="optional">
           <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="noAim"/>
                    <xsd:enumeration value="parentAim"/>
                    <xsd:enumeration value="allSide"/>
                    <xsd:enumeration value="nearestAlien"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:attribute>
    </xsd:complexType>

    <xsd:complexType name="towerType">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="id" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="imageType" type="xsd:integer" use="required"/>
        <xsd:attribute name="buildTime" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="cost" type="xsd:nonNegativeInteger" use="required"/>
        <xsd:attribute name="splash" type="xsd:integer" use="required"/>
        <xsd:attribute name="reload" type="xsd:nonNegativeInteger" use="required"/>
        <xsd:attribute name="radius" type="xsd:float" use="required"/>
        <xsd:attribute name="expByShot" type="xsd:float" use="optional"/>
        <xsd:attribute name="expByKill" type="xsd:float" use="optional"/>
        <xsd:attribute name="expByDamage" type="xsd:float" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="mapType">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="id" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="maxPlayers" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="width" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="height" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="imageType" type="xsd:integer" use="required"/>
        <xsd:attribute name="data" type="xsd:string" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="morphType">
        <xsd:attribute name="from" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="to" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="cost" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="expRequired" type="xsd:float" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="upgradeType">
        <xsd:attribute name="tower" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="trigger" type="xsd:positiveInteger" use="optional"/>
        <xsd:attribute name="cost" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="radius" type="xsd:float" use="optional"/>
        <xsd:attribute name="reload" type="xsd:positiveInteger" use="optional"/>
        <xsd:attribute name="damage" type="xsd:float" use="optional"/>
        <xsd:attribute name="damageRadius" type="xsd:float" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="wavePartType">
        <xsd:attribute name="alien" type="xsd:positiveInteger" use="required"/>
<!--        <xsd:attribute name="wave" type="xsd:positiveInteger" use="required"/>-->
        <xsd:attribute name="count" type="xsd:positiveInteger" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="chainType">
        <xsd:attribute name="tower" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="parent" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="trigger" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="child" type="xsd:positiveInteger" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="waveType">
        <xsd:sequence>
            <xsd:element name="wavePart" type="wavePartType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="timeout" type="xsd:nonNegativeInteger" use="required"/>
        <xsd:attribute name="prise" type="xsd:nonNegativeInteger" use="required"/>
        <!--xsd:attribute name="type" type="xsd:nonNegativeInteger" use="required"-->
    </xsd:complexType>

    <xsd:complexType name="waveOnLevelType">
        <xsd:attribute name="level" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="wave" type="xsd:positiveInteger" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="towerOnLevelType">
        <xsd:attribute name="level" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="tower" type="xsd:positiveInteger" use="required"/>
        <!--xsd:attribute name="enableWave" type="xsd:nonNegativeInteger" use="optional"-->
    </xsd:complexType>

    <xsd:complexType name="levelType">
        <xsd:attribute name="id" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="map" type="xsd:nonNegativeInteger" use="required"/>
        <xsd:attribute name="score" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="startMoney" type="xsd:positiveInteger" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="animationType">
        <xsd:attribute name="id" type="xsd:positiveInteger" use="required"/>
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="pathes" type="xsd:string" use="required"/>
    </xsd:complexType>

</xsd:schema>

