XRWS           N  S  M~ext_01.cat ext_01.dat md/EuclidsBailout.xml 6048 1420706024 1b64fd07c7f4f6abf9da385b3bf0531e
md/EuclidsClaim.xml 1384 1420577622 69718f1a53f180cfaad4a1c03ac8e681
md/EuclidsCombatRank.xml 8901 1427177168 e62363b8960928b0edebc73fed6581aa
t/0001-L007.xml 2032 1427177890 6af001513e8af653b4b60f7045fbe23a
t/0001.xml 1473 1427177580 23122ac760551203fa95aa88f8f42bc7
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="EuclidsBailout" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
	<cues>
		<cue name="EuclidsBailoutInit" instantiate="true" >
      <conditions>
				<event_player_attacked_object />
				<check_value value="event.param.owner and event.param.owner != faction.player and event.param.owner != faction.ownerless" />
        <check_value value="not event.param3.iswreck" />
			</conditions>
			
	<!-- give it some time  -->				
			
			 <delay min="1s" max="3s" />
			
			<actions>
				
				
				
	<!-- only for ships with pilot (no drones) -->		
				
				<do_if value="event.param.isclass.ship and @event.param.pilot">
				  <set_value name="$Ship" exact="event.param" />
					<set_value name="$pilot" exact="event.param.pilot" />
					<set_value name="$execute" exact="true"/>
					
	<!-- cap ships must have player dock -->	
					
					<do_if value="event.param.isclass.ship_xl or event.param.isclass.ship_l">
						<find_dock_location name="$target_dock" container="$Ship" size="tag.dock_p"/>
						<do_if value="$target_dock == null ">
						  <set_value name="$execute" exact="false"/>
            </do_if>  
					</do_if>	
					
	<!-- no mass-traffic ships, i.e. consumer compact or police -->
					
					<do_if value="$Ship.ismasstraffic">
						<set_value name="$execute" exact="false"/>
					</do_if>
					
<!-- Start: 1h cooldown on same ship -->					
						
					<do_if value="@$pilot.$BAttacked">
						<do_if value="(player.age-$pilot.$BAttacked)/1h lt 1"> 
				      <set_value name="$execute" exact="false"/>
			      </do_if>
						<do_else>
					    <set_value name="$pilot.$BAttacked" exact="player.age"/>
					  </do_else>
					</do_if>
					<do_else>
						<set_value name="$pilot.$BAttacked" exact="player.age"/>
				  </do_else>	
						
		<!-- End: cooldown on same ship -->
						
          <do_if value="$execute">	
						
					
						
	<!-- calculating bailout chance -->	
						
		<!-- harder for military -->				
					  <set_value name="$Aweight" exact="1" />  
				    <do_if value="$Ship.tags.indexof.{tag.military}?">
						  <set_value name="$Aweight" exact="2" /> 
				    </do_if>
						
		<!-- much harder for cap ships -->			
					  <set_value name="$Bweight" exact="1" />  
				    <do_if value="$Ship.isclass.ship_xl or $Ship.isclass.ship_l">
						  <set_value name="$Bweight" exact="$Ship.boardingresistance" /> 
				    </do_if>
						
		<!-- harder for increased difficulty -->		  
					  <set_value name="$Cweight" exact="1" />  
				    <do_if value="player.difficulty" exact="level.medium">
						  <set_value name="$Cweight" exact="2" /> 
				    </do_if>
				    <do_elseif value="player.difficulty" exact="level.hard">
						  <set_value name="$Cweight" exact="3" /> 
				    </do_elseif>
						
						
			<!-- con the larger the harder -->	
					  <set_value name="$Con" exact="$Aweight*$Bweight*$Cweight" />			
						
			<!-- is player rookie (hard) or xtreme (easier) ? -->	  
				    <set_value name="$Pro" exact="player.entity.$Combat" />	
					
			<!-- base chance -->		
						<set_value name="$Bchance" exact="player.entity.$Bbail"/>
						
			<!-- corrections: con min = 0, max = 6* boardingresistance (static) -->			
						
						
				    <set_value name="$Corr" exact="0" /> 
						<do_if value="$Con gt 1">
						  <set_value name="$Corr" exact="3" />  
					  </do_if>
					  <do_if value="$Con gt 2">
						  <set_value name="$Corr" exact="5" />  
					  </do_if>
					  <do_if value="$Con gt 5">
						  <set_value name="$Corr" exact="8" />  
					  </do_if>
					  <do_if value="$Con gt 200">
					  	<set_value name="$Corr" exact="11" />  
					  </do_if>
						<do_if value="$Con gt 400">
						  <set_value name="$Corr" exact="15" />  
					  </do_if>
				  	<do_if value="$Con gt 600">
						  <set_value name="$Corr" exact="19" />  
					  </do_if>
						<do_if value="$Con gt 1200">
						  <set_value name="$Corr" exact="25" />  
					  </do_if>
					  <do_if value="$Con gt 2000">
						  <set_value name="$Corr" exact="30" />  
					  </do_if>
						
					  <set_value name="$Bchance" exact="[0,$Bchance-$Corr].max" /> 
						
						
			
					
	  <!-- cleanup 1 -->		
						
					  <remove_value name="$Aweight" />
				    <remove_value name="$Bweight" />
				    <remove_value name="$Cweight" />
				    <remove_value name="$Con" />
				    <remove_value name="$Pro" />
				    <remove_value name="$Corr" />
				    <remove_value name="$target_dock" />
						
		<!-- bailout or not -->		  	
						
             <do_any>
							 
               <do_all weight="$Bchance">
								 
			    <!-- stop scripts on control NPCs and kill them before change owner -->
							  <get_control_entities object="$Ship" groupname="$ControlEntities"/>
						  	<do_all exact="$ControlEntities.count" counter="$Counter">
									<abort_scripts entity="$ControlEntities.{$Counter}"/>
                  <destroy_object object="$ControlEntities.{$Counter}"/>
                </do_all>
								 
					<!-- ship can be assigned to superior, remove it!! -->					 
							  <remove_object_commander object="$Ship" />			 
						  	<set_owner object="$Ship" faction="faction.ownerless"/> 
								<cease_fire object="$Ship"/>
							  <remove_value name="$pilot.$BAttacked" />
				 
							</do_all>

							 
                <do_all weight="100-$Bchance">
					<!-- do nothing, bailout failed -->
							   </do_all>
							 
              </do_any>
						
			<!-- cleanup 2 -->	
						
			    	  <remove_value name="$Bchance" />
				      <remove_value name="$Ship" />
				      <remove_value name="$ControlEntities" />
						  <remove_value name="$pilot" />
				      <remove_value name="$execute" />
						  <remove_value name="$subordinates" />
					  </do_if>
				  </do_if>
			  </actions>
		</cue>
	</cues> 
</mdscript><?xml version="1.0" encoding="utf-8"?>
<mdscript name="EuclidsClaim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
	<cues>
		<cue name="EuclidsClaimInit" instantiate="true" >
      <conditions>
				<check_all>
					<event_object_changed_room object="player.entity" comment="If player docked"/>
          <check_value value="player.platform.exists"/>
				</check_all>	
			</conditions>
			<actions>
				
			  <set_value name="$iscapital" exact="@player.platform.container.isclass.ship_l or @player.platform.container.isclass.ship_xl" />
				<set_value name="$isowner" exact="@player.platform.container.owner == faction.player" />
				<get_control_entities object="player.platform.container" groupname="$ControlEntities"/>
				<set_value name="$ispopulated" exact="$ControlEntities.count" />
				<do_if value="$iscapital and not $isowner and not $ispopulated">
					 <set_owner object="player.platform.container" faction="faction.player"/>
					 <set_value name="stat.ships_boarding_attempts" operation="add" /> 
					 <set_value name="stat.ships_boarded" operation="add" /> 
				</do_if>
				
				<remove_value name="$iscapital" />
				<remove_value name="$isowner" />
				<remove_value name="$ispopulated" />
				<remove_value name="$ControlEntities" />
				
      </actions>
		</cue>
	</cues> 
</mdscript><?xml version="1.0" encoding="utf-8"?>
<mdscript name="EuclidsCombatRank" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
 <cues>
	 <cue name="EuclidsCR" instantiate="true" >
		 <!-- updates player's combat rank and title on loading a saved game -->
		 <conditions>
			 <check_any>
		     <event_player_killed_object />
				 <event_game_loaded />
				 <event_cue_signalled cue="md.Setup.GameStart"/>
			 </check_any>
		 </conditions>
		
		 <actions>
			
			 <set_value name="$Drones" exact="stat.drones_destroyed"/>
			 <set_value name="$Ships" exact="stat.ships_destroyed"/>
			 <set_value name="$Cships" exact="stat.capships_destroyed"/>
			 <set_value name="$Turrets" exact="stat.turrets_destroyed"/>
			 <set_value name="$Boarded" exact="stat.ships_boarded" /> 
						    
			 
			 <set_value name="$Pro" exact="$Ships+10*$Drones+20*$Turrets+50*$Boarded+100*$Cships"/>
			 
<!-- title hierachy in 30 steps (k): c(k)=round(2*exp(0.42*k+0.8)) and base bail chance b(k)=round(round(2*exp(0.55*k+1)))/c(k))-->	  
			 
			 <set_value name="player.entity.$Combat" exact="$Pro"/>
			 
			 <set_value name="$title" exact="{305000,50}"/>    <!-- 1 -->
			 <set_value name="$Cbail" exact="0"/>
			 <set_value name="$Next" exact="0"/>
			 <do_if value="$Pro ge 7">
				 <set_value name="$title" exact="{305000,51}"/>
				 <set_value name="$Cbail" exact="1"/>
				 <set_value name="$Next" exact="10-$Pro"/>
			 </do_if>
	     <do_if value="$Pro ge 10">
				 <set_value name="$title" exact="{305000,52}"/>
				 <set_value name="$Cbail" exact="2"/>
				 <set_value name="$Next" exact="16-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 16">
				 <set_value name="$title" exact="{305000,53}"/>
				 <set_value name="$Next" exact="24-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 24">
				 <set_value name="$title" exact="{305000,54}"/>
				 <set_value name="$Next" exact="36-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 36">
				 <set_value name="$title" exact="{305000,55}"/>
				 <set_value name="$Next" exact="55-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 55">
				 <set_value name="$title" exact="{305000,56}"/>
				 <set_value name="$Cbail" exact="3"/>
				 <set_value name="$Next" exact="84-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 84">
				 <set_value name="$title" exact="{305000,57}"/>
				 <set_value name="$Next" exact="120-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 128">
				 <set_value name="$title" exact="{305000,58}"/>
				 <set_value name="$Next" exact="195-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 195">
				 <set_value name="$title" exact="{305000,59}"/>   <!-- 10 -->
				 <set_value name="$Cbail" exact="4"/>
				 <set_value name="$Next" exact="297-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 297">
				 <set_value name="$title" exact="{305000,60}"/>
				 <set_value name="$Next" exact="452-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 452">
				 <set_value name="$title" exact="{305000,61}"/>
				 <set_value name="$Cbail" exact="5"/>
				 <set_value name="$Next" exact="688-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 688">
				 <set_value name="$title" exact="{305000,62}"/>
				 <set_value name="$Cbail" exact="6"/>
				 <set_value name="$Next" exact="1046-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 1046">
				 <set_value name="$title" exact="{305000,63}"/>
				 <set_value name="$Cbail" exact="7"/>
				 <set_value name="$Next" exact="1593-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 1593">
				 <set_value name="$title" exact="{305000,64}"/>
				 <set_value name="$Cbail" exact="8"/>
				 <set_value name="$Next" exact="2424-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 2424">
				 <set_value name="$title" exact="{305000,65}"/>
				 <set_value name="$Cbail" exact="9"/>
				 <set_value name="$Next" exact="3689-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 3689">
				 <set_value name="$title" exact="{305000,66}"/>
				 <set_value name="$Cbail" exact="10"/>
				 <set_value name="$Next" exact="5615-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 5615">
				 <set_value name="$title" exact="{305000,67}"/>
				 <set_value name="$Cbail" exact="11"/>
				 <set_value name="$Next" exact="8545-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 8545">
				 <set_value name="$title" exact="{305000,68}"/>
				 <set_value name="$Cbail" exact="13"/>
				 <set_value name="$Next" exact="13006-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 13006">
				 <set_value name="$title" exact="{305000,69}"/>   <!-- 20 -->
				 <set_value name="$Cbail" exact="14"/>
				 <set_value name="$Next" exact="19794-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 19794">
				 <set_value name="$title" exact="{305000,70}"/>
				 <set_value name="$Cbail" exact="16"/>
				 <set_value name="$Next" exact="30126-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 30126">
				 <set_value name="$title" exact="{305000,71}"/>
				 <set_value name="$Cbail" exact="19"/>
				 <set_value name="$Next" exact="45851-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 45851">
				 <set_value name="$title" exact="{305000,72}"/>
				 <set_value name="$Cbail" exact="21"/>
				 <set_value name="$Next" exact="69783-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 69783">
				 <set_value name="$title" exact="{305000,73}"/>
				 <set_value name="$Cbail" exact="24"/>
				 <set_value name="$Next" exact="106207-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 106207">
				 <set_value name="$title" exact="{305000,74}"/>
				 <set_value name="$Cbail" exact="28"/>
				 <set_value name="$Next" exact="161643-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 161643 ">
				 <set_value name="$title" exact="{305000,75}"/>
				 <set_value name="$Cbail" exact="32"/>
				 <set_value name="$Next" exact="246015-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 246015">
				 <set_value name="$title" exact="{305000,76}"/>
				 <set_value name="$Cbail" exact="36"/>
				 <set_value name="$Next" exact="374425-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 374425">
				 <set_value name="$title" exact="{305000,77}"/>
				 <set_value name="$Cbail" exact="41"/>
				 <set_value name="$Next" exact="569861-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 569861">
				 <set_value name="$title" exact="{305000,78}"/>
				 <set_value name="$Cbail" exact="47"/>
				 <set_value name="$Next" exact="867306-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 867306">
				 <set_value name="$title" exact="{305000,79}"/>   <!-- 30 -->
				 <set_value name="$Cbail" exact="53"/>
				 <set_value name="$Next" exact="1320006-$Pro"/>
			 </do_if>
			 <do_if value="$Pro ge 1320006">
				 <set_value name="$title" exact="{305000,80}"/>
				 <set_value name="$Cbail" exact="60"/>
			 </do_if>
       
       <set_value name="player.entity.$Bbail" exact="$Cbail"/>
			 
			 
			 <do_if value="$Cbail lt 60">
			   <write_to_logbook category="missions" text="{305000,41} .[$Next]"/>
			 </do_if>
			 
			 
			 <do_if value="@player.entity.$Title">
				
				 <do_if value="player.entity.$Title != $title">
					 <set_value name="$Text" exact="{305000,42} .[$title]" />
					 <show_help log="true" custom="$Text" position="6" duration="4s" />
				 </do_if> 
				 
				<!-- 	 check player ships name change (player may have changed name) -->	 
				 <set_value name="$currentname" exact="player.primaryship.name"/>
				 <set_value name="$currenttitle" exact="player.entity.$Title"/>
				 <do_if value="$currentname != player.entity.$name + ' [' + $currenttitle + ']'">
					 
						<set_value name="$currentnamecheck" exact="$currentname"/>
					 
				<!-- 	 avoid double title: check if current name still has title -->	
						<substitute_text text="$currentnamecheck">
              <replace string="' [' + $currenttitle + ']'" with="''"/>
            </substitute_text>
					<!-- 	 that's the pure name in any case -->
					  <set_value name="player.entity.$name" exact="$currentnamecheck"/>
				 </do_if>
				 
			 </do_if>
			 <do_else>
				 
				 <set_value name="player.entity.$name" exact="player.primaryship.name"/>
				 
			 </do_else>
			 
			 <set_value name="player.entity.$Title" exact="$title"/>
			 <set_object_name object="player.primaryship" name="player.entity.$name + ' [' + $title + ']'" />
			 
			 
		
			 
			
			 
		<!-- cleanup -->	 
			 <remove_value name="$Drones" />
			 <remove_value name="$Ships" />
			 <remove_value name="$Cships" />
			 <remove_value name="$Boarded" />
			 <remove_value name="$Turrets" />
			 <remove_value name="$title" />
			 <remove_value name="$Pro" />
			 <remove_value name="$Cbail" />
			 <remove_value name="$Text" /> 
			 
			 
		 </actions>	 										
	 </cue>												 
 </cues>
</mdscript>
<?xml version="1.0" encoding="UTF-8"?>
<language>
	<page id="305000">
	  <!-- EuclidsBailout 0-20 -->
		 <!-- EuclidsClaim  21 - 40-->
            <!-- EuclidsCombatRank акь 41 - ~ -->
         <t id="41">Ваш боевой уровень обновлен:\n Осталось очей до нового боевого звания - %1.</t>
         <t id="42">Вам присвоено новое боевое звание: %1.</t>
		        <!-- EuclidsCombatRank - Rank - 50 - ~ -->
         <t id="50">Новобранец</t>
         <t id="51">Младший рекрут</t>
         <t id="52">Рекрут</t>
         <t id="53">Старший рекрут</t>
         <t id="54">Солдат</t>
         <t id="55">Рядовой</t>
         <t id="56">Специалист</t>
         <t id="57">Старший специалист</t>
         <t id="58">Разведчик</t>
         <t id="59">Капрал</t>
         <t id="60">Командир звена</t>
         <t id="61">Сержант</t>
         <t id="62">Комендор-сержант</t>
         <t id="63">Младший офицер</t>
         <t id="64">Старший офицер</t>
         <t id="65">Младший лейтенант</t>
         <t id="66">Лейтенант</t>
         <t id="67">Старший лейтенант</t>
         <t id="68">Капитан</t>
         <t id="69">Майор</t>
         <t id="70">Подполковник</t>
         <t id="71">Полковник</t>
         <t id="72">Генерал</t>
         <t id="73">Генерал армии</t>
         <t id="74">Главнокомандующий</t>
         <t id="75">Маршал</t>
         <t id="76">Верховный Главнокомандующий</t>
         <t id="77">Повелитель</t>
         <t id="78">Огненный Фихрь</t>
         <t id="79">Легенда</t>
         <t id="80">ВЛАСТЕЛИН Х-ВСЕЛОЙ</t>
	</page>
</language>﻿<?xml version="1.0" encoding="UTF-8"?>
<language>
	<page id="305000">
	  <!-- EuclidsBailout 0-20 -->
		 <!-- EuclidsClaim  21 - 40-->
            <!-- EuclidsCombatRank от 41 - 50 -->
         <t id="41">Combat Rank Update:\n %1\n more points to go.</t>
         <t id="42">You have gained a new combat rank %1.</t>
		        <!-- EuclidsCombatRank - Rank - 50 - ~ -->
         <t id="50">Harmless</t>
         <t id="51">Nuisance</t>
         <t id="52">Greenhorn</t>
         <t id="53">Novice</t>
         <t id="54">Rookie</t>
         <t id="55">Trainee</t>
         <t id="56">Competent</t>
         <t id="57">Graduate</t>
         <t id="58">Skilled</t>
         <t id="59">Fighter</t>
         <t id="60">Veteran</t>
         <t id="61">Marksman</t>
         <t id="62">Sharpshooter</t>
         <t id="63">Eagle Eye</t>
         <t id="64">Professional</t>
         <t id="65">Instructor</t>
         <t id="66">Specialist</t>
         <t id="67">Fighter Chief</t>
         <t id="68">Master Chief</t>
         <t id="69">Militant</t>
         <t id="70">Warrior</t>
         <t id="71">Assassin</t>
         <t id="72">Vindicator</t>
         <t id="73">Warlord</t>
         <t id="74">Crusader</t>
         <t id="75">Battlemaster</t>
         <t id="76">Conqueror</t>
         <t id="77">Overlord</t>
         <t id="78">Legend</t>
         <t id="79">Hero</t>
         <t id="80">X-TREME</t>
	</page>
</language><?xml version="1.0" encoding="utf-8"?>
<content id="" name="" description="" author="Euclid" version="046" date="2015-03-24" save="0" lastupdate="">
  <text language="7" name="CombatRank_Bailout" description="Начисление очков и присвоение боевых званий, что дает шанс на капитуляцию врагов." author="Euclid"/>
  <text language="44" name="CombatRank_Bailout" description="Combat ranks and bailout chance" author="Euclid"/>
  <text language="49" name="CombatRank_Bailout" description="Kampftitle und Chance einer Schiffaufgaben" author="Euclid"/>
</content>
