protected override void OnCreate (Bundle bundle)
		{
			dice = new Dice(5, 1, 6);
			fc = new FireCombat();
			odds = fc.DefaultOdds;
			audio = new PlayAudio (this);
		
			base.OnCreate (bundle);

			game = LbManager.GetGame(Intent.GetIntExtra ("Battle", -1), Intent.GetIntExtra("Scenario", -1));

			// set our layout to be the home screen
			SetContentView(Resource.Layout.FireCombat);		

			imgBack = FindViewById<ImageView> (Resource.Id.titleSubLbBack);
			imgLb = FindViewById<ImageView> (Resource.Id.titleSubLb);

			// title
			txtBattleName = FindViewById<TextView>(Resource.Id.titleSubBattleName);
			txtScenarioName = FindViewById<TextView>(Resource.Id.titleSubScenarioName);
			
			// attacker
			btnAttackerValuePrev = FindViewById<Button>(Resource.Id.btnFireAttackerPrev);
			btnAttackerValueNext = FindViewById<Button>(Resource.Id.btnFireAttackerNext);
			editAttackerValue = FindViewById<EditText>(Resource.Id.textFireAttackerValue);
			btnAttackerMod13 = FindViewById<ToggleButton>(Resource.Id.btnFireAttacker13);
			btnAttackerMod12 = FindViewById<ToggleButton>(Resource.Id.btnFireAttacker12);
			btnAttackerMod32 = FindViewById<ToggleButton>(Resource.Id.btnFireAttacker32);
			btnAttackerModCann = FindViewById<ToggleButton>(Resource.Id.btnFireAttackerCann);
			
			// defender
			btnDefenderValuePrev = FindViewById<Button>(Resource.Id.btnFireDefenderPrev);
			btnDefenderValueNext = FindViewById<Button>(Resource.Id.btnFireDefenderNext);
			editDefenderValue = FindViewById<EditText>(Resource.Id.textFireDefenderValue);
			
			btnDefenderIncrPrev = FindViewById<Button>(Resource.Id.btnFireDefenderIncrPrev);
			btnDefenderIncrNext = FindViewById<Button>(Resource.Id.btnFireDefenderIncrNext);
			editDefenderIncr = FindViewById<EditText>(Resource.Id.textFireDefenderIncr);
			
			editAttackerValue.Text = "1";
			editDefenderValue.Text = "1";
			editDefenderIncr.Text = "1";
			
			spinFireOdds = FindViewById<Spinner> (Resource.Id.spinFireOdds);
			
			imgFireDie1 = FindViewById<ImageView> (Resource.Id.imgFireDie1);
			imgFireDie2 = FindViewById<ImageView> (Resource.Id.imgFireDie2);
			imgFireDie3 = FindViewById<ImageView> (Resource.Id.imgFireDie3);
			imgFireDie4 = FindViewById<ImageView> (Resource.Id.imgFireDie4);
			imgFireDie5 = FindViewById<ImageView> (Resource.Id.imgFireDie5);
			btnFireDiceRoll = FindViewById<Button>(Resource.Id.btnFireDiceRoll);
			
			// results
			txtFireResults = FindViewById<TextView>(Resource.Id.txtFireResults);
			//txtFireResults.SetText(txtFireResults.Text, TextView.BufferType.Editable);
			imgFireLeaderLossSide = FindViewById<ImageView>(Resource.Id.imgFireLeaderLossSide);
			txtFireLeaderLoss = FindViewById<TextView>(Resource.Id.txtFireLeaderLoss);
			//txtFireLeaderLoss.SetText(txtFireLeaderLoss.Text, TextView.BufferType.Editable);
			imgFireLeaderLoss = FindViewById<ImageView>(Resource.Id.imgFireLeaderLoss);
		}
Beispiel #2
0
		public string Resolve(Odds odds, int dice) 
		{
			var result = "Blank";
			if (odds.Value == -2)
			{
				if (dice <= 14) {
					result = "AR";
                }
				else if (dice <= 34) {
					result = "AD";
				}
				else if (dice == 52) {
					result = "0*/0";
                }
				else if (dice == 53) {
					result = "1/1";
                }
				else if (dice == 54) {
					result = "1/2*";
                }
				else if (dice == 55) {
					result = "0/1";
                }
				else if (dice == 56) {
					result = "1*/0";
                }

				else if (dice == 61) {
					result = "0/2";
                }
				else if (dice == 62) {
					result = "2/1*";
                }
				else if (dice == 63) {
					result = "0/0";
                }
				else if (dice == 64) {
					result = "2/2";
                }

				else if (dice >= 65) {
					result = "DD";
                }
			}
			else if (odds.Value == 1)
			{
				if 		(dice <= 15) {
					result = "AD";
                }

				else if (dice == 42) {
					result = "2*/1";
                }
				else if (dice == 43) {
					result = "2/1*";
                }
				else if (dice == 44) {
					result = "2/1";
                }
				else if (dice == 45) {
					result = "1*/1";
                }
				else if (dice == 46) {
					result = "1/2";
                }

				else if (dice == 51) {
					result = "1/1";
                }
				else if (dice == 52) {
					result = "0/0*";
                }
				else if (dice == 53) {
					result = "2/1";
                }
				else if (dice == 54) {
					result = "1*/2";
                }
				else if (dice == 55) {
					result = "2/2";
                }
				else if (dice == 56) {
					result = "0/0";
                }

				else if (dice == 61) {
					result = "1/0*";
                }
					
				else if (dice >= 62) {
					result = "DD";
                }
			}
			else if (odds.Value == 1.5)
			{
				if 		(dice <= 12) {
					result = "AD";
                }

				else if (dice == 33) {
					result = "1/2";
                }
				else if (dice == 34) {
					result = "0/0";
                }
				else if (dice == 35) {
					result = "1/1";
                }
				else if (dice == 36) {
					result = "2*/0";
                }

				else if (dice == 41) {
					result = "0/1*";
                }
				else if (dice == 42) {
					result = "1/1";
                }
				else if (dice == 43) {
					result = "2/2*";
                }
				else if (dice == 44) {
					result = "3/1";
                }
				else if (dice == 45) {
					result = "0/2";
                }
				else if (dice == 46) {
					result = "2/1";
                }

				else if (dice == 51) {
					result = "1/1*";
                }
				else if (dice == 52) {
					result = "2*/1";
                }

				else if (dice >= 53) {
					result = "DD";
                }
			}
			else if (odds.Value == 2)
			{
				if 		(dice <= 11) {
					result = "AD";
                }

				else if (dice == 25) {
					result = "0/3";
                }
				else if (dice == 26) {
					result = "1/2";
                }
				else if (dice == 31) {
					result = "2*/1";
                }
				else if (dice == 32) {
					result = "0/0";
                }
				else if (dice == 33) {
					result = "0/1*";
                }
				else if (dice == 34) {
					result = "1/0";
                }
				else if (dice == 35) {
					result = "3/2*";
                }
				else if (dice == 36) {
					result = "1/1";
                }
				else if (dice == 41) {
					result = "2/2*";
                }
				else if (dice == 42) {
					result = "1*/2";
                }
				else if (dice == 43) {
					result = "1*/1";
                }
				else if (dice == 44) {
					result = "0/2*";
                }
					
				else if (dice >= 45) {
					result = "DD";
                }
			}
			else if (odds.Value == 2.5)
			{
				if 		(dice == 23) {
					result = "1/4";
                }
				else if (dice == 24) {
					result = "2/3";
                }
				else if (dice == 25) {
					result = "0*/0";
                }
				else if (dice == 26) {
					result = "1/1*";
                }
				else if (dice == 31) {
					result = "2/3*";
                }
				else if (dice == 32) {
					result = "3/3";
                }
				else if (dice == 33) {
					result = "0/1";
                }
				else if (dice == 34) {
					result = "1/0";
                }
				else if (dice == 35) {
					result = "2/2*";
                }

				else if (dice >= 36) {
					result = "DD";
                }
			}
			else if (odds.Value == 3)
			{
				if 		(dice == 16) {
					result = "0/0*";
                }
				else if (dice == 21) {
					result = "2/3";
                }
				else if (dice == 22) {
					result = "0/2";
                }
				else if (dice == 23) {
					result = "2*/0";
                }
				else if (dice == 24) {
					result = "1/2";
                }
				else if (dice == 25) {
					result = "0/1";
                }
				else if (dice == 26) {
					result = "2*/3";
                }
				else if (dice == 31) {
					result = "1/2*";
                }
					
				else if (dice >= 65) {
					result = "DR";
                }

				else if (dice >= 32) {
					result = "DD";
                }
			}
			else if (odds.Value == 3.5)
			{
				if 		(dice == 12) {
					result = "0/0";
                }
				else if (dice == 13) {
					result = "2*/2";
                }
				else if (dice == 14) {
					result = "3/3";
                }
				else if (dice == 15) {
					result = "2/4";
                }
				else if (dice == 16) {
					result = "3/1";
                }
				else if (dice == 21) {
					result = "0/1*";
                }
					
				else if (dice >= 62) {
					result = "DR";
                }

				else if (dice >= 22) {
					result = "DD";
                }
			}
			else if (odds.Value == 4)
			{
				if 		(dice == 11) {
					result = "2*/1";
                }
				else if (dice == 12) {
					result = "1/2";
                }
				else if (dice == 13) {
					result = "0/2";
                }
				else if (dice == 14) {
					result = "0/1*";
                }
				else if (dice == 15) {
					result = "1/1*";
                }
					
				else if (dice >= 56) {
					result = "DR";
                }

				else if (dice >= 16) {
					result = "DD";
                }
			}
			else if (odds.Value == 4.5)
			{
				if 		(dice == 11) {
					result = "3/2";
                }

				else if (dice >= 66) {
					result = "DS";
                }

				else if (dice >= 42) {
					result = "DR";
                }

				else if (dice >= 12) {
					result = "DD";
                }
			}
			else if (odds.Value == 5)
			{
				if (dice >= 62) {
					result = "DS";
                }

				else if (dice >= 33) {
					result = "DR";
                }

				else if (dice >= 11) {
					result = "DD";
                }
			}
			else
			{
				result = "Blank";
			}
			
	        /*
			if (dice <= 12) {
	        	result = "& " + result;
	        } 
			else if (dice >= 64) {
		        result += " &";
	        }
	        */

	        return result;
		}
		void CalcOdds() 
		{
			odds = fc.Calculate(GetAttackerValue(), GetDefenderValue(), btnAttackerModCann.Checked);
			if (odds == null)
				odds = fc.DefaultOdds;
			DisplayOdds();
		}
		protected override void OnResume ()
		{
			base.OnResume ();

			imgBack.Click += (sender, e) => {
				NavigateUp();
			};

			imgLb.Click += (sender, e) => {
				NavigateUp();
			};

			txtBattleName.Text = game.Battle.Name;
			txtScenarioName.Text = game.Scenario.Name;
			
			// attacker
			btnAttackerValuePrev.Click += (sender, e) => {
				var value = GetAttackerValue();
				if (--value < 1) value = 1;
				editAttackerValue.Text = value.ToString();
				CalcOdds();
				UpdateResults();
			};
			btnAttackerValueNext.Click += (sender, e) => {
				var value = GetAttackerValue();
				editAttackerValue.Text = (++value).ToString();
				CalcOdds();
				UpdateResults();
			};
			editAttackerValue.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => {
				CalcOdds();
				UpdateResults();
			};
			btnAttackerMod13.Click += (sender, e) => {
				var value = GetAttackerValue();
				if (btnAttackerMod13.Checked) 
				{
					value /= 3;
				}
				else
				{
					value *= 3;
				}
				editAttackerValue.Text = value.ToString();
				CalcOdds();
				UpdateResults();
			};
			btnAttackerMod12.Click += (sender, e) => {
				var value = GetAttackerValue();
				if (btnAttackerMod12.Checked) 
				{
					value /= 2;
				}
				else
				{
					value *= 2;
				}
				editAttackerValue.Text = value.ToString();
				CalcOdds();
				UpdateResults();
			};
			btnAttackerMod32.Click += (sender, e) => {
				var value = GetAttackerValue();
				if (btnAttackerMod32.Checked) 
				{
					value *= 1.5;
				}
				else
				{
					value /= 1.5;
				}
				editAttackerValue.Text = value.ToString();
				CalcOdds();
				UpdateResults();
			};
			btnAttackerModCann.Click += (sender, e) => {
				UpdateResults();
			};

			// defender
			btnDefenderValuePrev.Click += (sender, e) => {
				double value = GetDefenderValue();
				value = FindNearestDefenseValue(value - 1, true);
				editDefenderValue.Text = value.ToString();
				CalcOdds();
				UpdateResults();
			};
			btnDefenderValueNext.Click += (sender, e) => {
				double value = GetDefenderValue();
				value = FindNearestDefenseValue(value + 1, false);
				editDefenderValue.Text = value.ToString();
				CalcOdds();
				UpdateResults();
			};
			editDefenderValue.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => {
				CalcOdds();
				UpdateResults();
			};
			
			btnDefenderIncrPrev.Click += (sender, e) => {
				var value = GetDefenderIncrements();
				if (--value < 1) value = 1;
				editDefenderIncr.Text = value.ToString();
				UpdateResults();
			};
			btnDefenderIncrNext.Click += (sender, e) => {
				var value = GetDefenderIncrements();
				editDefenderIncr.Text = (++value).ToString();
				UpdateResults();
			};
			editDefenderIncr.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => {
				UpdateResults();
			};
			
			spinFireOdds.ItemSelected +=  (object sender, AdapterView.ItemSelectedEventArgs e) => {
				odds = fc.OddsItem(e.Position);
				UpdateResults();
			};
				
			ArrayAdapter<String> adapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleSpinnerDropDownItem, fc.OddsList);
			adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
			spinFireOdds.Adapter = adapter;
			
			
			imgFireDie1.Click += (sender, e) => {
				IncrementDie(1);
				DisplayDice();
				UpdateResults();
			};
			imgFireDie2.Click += (sender, e) => {
				IncrementDie(2);
				DisplayDice();
				UpdateResults();
			};
			imgFireDie3.Click += (sender, e) => {
				IncrementDie(3);
				DisplayDice();
				UpdateResults();
			};
			imgFireDie4.Click += (sender, e) => {
				IncrementDie(4);
				DisplayDice();
				UpdateResults();
			};
			imgFireDie5.Click += (sender, e) => {
				IncrementDie(5);
				DisplayDice();
				UpdateResults();
			};
			
			btnFireDiceRoll.Click += (sender, e) => {
				audio.Play();
				dice.Roll();
				DisplayDice();
				UpdateResults();
			};
			
			DisplayOdds();
			DisplayDice();
		}
Beispiel #5
0
		protected override void OnCreate (Bundle bundle)
		{
			dice = new Dice(5, 1, 6);
			mc = new MeleeCombat();
			odds = mc.DefaultOdds;
			audio = new PlayAudio (this);
		
			base.OnCreate (bundle);

			game = LbManager.GetGame(Intent.GetIntExtra ("Battle", -1), Intent.GetIntExtra("Scenario", -1));

			// set our layout to be the home screen
			SetContentView(Resource.Layout.Melee);		

			imgBack = FindViewById<ImageView> (Resource.Id.titleSubLbBack);
			imgLb = FindViewById<ImageView> (Resource.Id.titleSubLb);

			// title
			txtBattleName = FindViewById<TextView>(Resource.Id.titleSubBattleName);
			txtScenarioName = FindViewById<TextView>(Resource.Id.titleSubScenarioName);
			
			btnMeleeAttackerPrev	 = FindViewById<Button>(Resource.Id.btnMeleeAttackerPrev	);
			btnMeleeAttackerNext		 = FindViewById<Button>(Resource.Id.btnMeleeAttackerNext	);
			editMeleeAttackerValue	 = FindViewById<EditText>(Resource.Id.editMeleeAttackerValue);
			btnMeleeAttackerAdd		 = FindViewById<Button>(Resource.Id.btnMeleeAttackerAdd		);
			btnMeleeAttackerReset	 = FindViewById<Button>(Resource.Id.btnMeleeAttackerReset	);
			
			btnMeleeDefenderPrev	 = FindViewById<Button>(Resource.Id.btnMeleeDefenderPrev	);
			btnMeleeAttackerNext		 = FindViewById<Button>(Resource.Id.btnMeleeAttackerNext	);
			editMeleeDefenderValue	 = FindViewById<EditText>(Resource.Id.editMeleeDefenderValue);
			btnMeleeDefenderAdd		 = FindViewById<Button>(Resource.Id.btnMeleeDefenderAdd		);
			btnMeleeDefenderReset	 = FindViewById<Button>(Resource.Id.btnMeleeDefenderReset	);
			
			spinMeleeOdds = FindViewById<Spinner> (Resource.Id.spinMeleeOdds);
			
			imgMeleeDie1 = FindViewById<ImageView> (Resource.Id.imgMeleeDie1);
			imgMeleeDie2 = FindViewById<ImageView> (Resource.Id.imgMeleeDie2);
			imgMeleeDie3 = FindViewById<ImageView> (Resource.Id.imgMeleeDie3);
			imgMeleeDie4 = FindViewById<ImageView> (Resource.Id.imgMeleeDie4);
			imgMeleeDie5 = FindViewById<ImageView> (Resource.Id.imgMeleeDie5);
			btnMeleeDiceRoll = FindViewById<Button>(Resource.Id.btnMeleeDiceRoll);
			
			txtMeleeResults = FindViewById<TextView>(Resource.Id.txtMeleeResults);
			imgMeleeLeaderLossSide = FindViewById<ImageView>(Resource.Id.imgMeleeLeaderLossSide);
			txtMeleeLeaderLoss = FindViewById<TextView>(Resource.Id.txtMeleeLeaderLoss);
			imgMeleeLeaderLoss = FindViewById<ImageView>(Resource.Id.imgMeleeLeaderLoss);
			
			btnMeleeIncrPrev	 = FindViewById<Button>(Resource.Id.btnMeleeIncrPrev	);
			btnMeleeIncrNext	 = FindViewById<Button>(Resource.Id.btnMeleeIncrNext	);
			editMeleeIncrValue	 = FindViewById<EditText>(Resource.Id.editMeleeIncrValue);
								
			btnMeleeLossPrev	 = FindViewById<Button>(Resource.Id.btnMeleeLossPrev	);
			btnMeleeLossNext	 = FindViewById<Button>(Resource.Id.btnMeleeLossNext	);
			editMeleeLossValue	 = FindViewById<EditText>(Resource.Id.editMeleeLossValue);
			
			btnMeleeValuePrev	 = FindViewById<Button>(Resource.Id.btnMeleeValuePrev	);
			btnMeleeValueNext	 = FindViewById<Button>(Resource.Id.btnMeleeValueNext	);
			editMeleeValueValue	 = FindViewById<EditText>(Resource.Id.editMeleeValueValue);
			
			btnMeleeLancePrev	 = FindViewById<Button>(Resource.Id.btnMeleeLancePrev	);
			btnMeleeLanceNext	 = FindViewById<Button>(Resource.Id.btnMeleeLanceNext	);
			editMeleeLanceValue	 = FindViewById<EditText>(Resource.Id.editMeleeLanceValue);
			
			btnMeleeTotalPrev	 = FindViewById<Button>(Resource.Id.btnMeleeTotalPrev	);
			btnMeleeTotalNext	 = FindViewById<Button>(Resource.Id.btnMeleeTotalNext	);
			editMeleeTotalValue	 = FindViewById<EditText>(Resource.Id.editMeleeTotalValue);
			
			btnMeleeMods13  = FindViewById<ToggleButton>(Resource.Id.btnMeleeMods13 );
			btnMeleeMods12  = FindViewById<ToggleButton>(Resource.Id.btnMeleeMods12 );
			btnMeleeMods32  = FindViewById<ToggleButton>(Resource.Id.btnMeleeMods32 );
			btnMeleeMods2   = FindViewById<ToggleButton>(Resource.Id.btnMeleeMods2  );
			btnMeleeModsLnc = FindViewById<ToggleButton>(Resource.Id.btnMeleeModsLnc);
			
			editMeleeAttackerValue.Text = "1";
			editMeleeDefenderValue.Text = "1";
			editMeleeIncrValue.Text = "1";
			editMeleeLossValue.Text = "1";
			editMeleeValueValue.Text = "1";
			editMeleeLanceValue.Text = "1";
			editMeleeTotalValue.Text = "1";
		}
Beispiel #6
0
		void CalcOdds() 
		{
			odds = mc.Calculate(GetAttackerValue(), GetDefenderValue());
			if (odds == null)
				odds = mc.DefaultOdds;
			DisplayOdds();
		}
Beispiel #7
0
		protected override void OnResume ()
		{
			base.OnResume ();

			imgBack.Click += (sender, e) => {
				NavigateUp();
			};

			imgLb.Click += (sender, e) => {
				NavigateUp();
			};

			txtBattleName.Text = game.Battle.Name;
			txtScenarioName.Text = game.Scenario.Name;
			
			// attacker
			btnMeleeAttackerPrev.Click += (sender, e) => {
				var value = GetAttackerValue();
				if (--value < 1) value = 1;
				editMeleeAttackerValue.Text = value.ToString();
				CalcOdds();
				UpdateResults();
			};
			btnMeleeAttackerNext.Click += (sender, e) => {
				var value = GetAttackerValue();
				editMeleeAttackerValue.Text = (++value).ToString();
				CalcOdds();
				UpdateResults();
			};
			editMeleeAttackerValue.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => {
				CalcOdds();
				UpdateResults();
			};
			// defender
			btnMeleeDefenderPrev.Click += (sender, e) => {
				double value = GetDefenderValue();
				if (--value < 1) value = 1;
				editMeleeDefenderValue.Text = value.ToString();
				CalcOdds();
				UpdateResults();
			};
			btnMeleeDefenderNext.Click += (sender, e) => {
				double value = GetDefenderValue();
				editMeleeDefenderValue.Text = (++value).ToString();
				CalcOdds();
				UpdateResults();
			};
			editMeleeDefenderValue.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => {
				CalcOdds();
				UpdateResults();
			};
			
			spinMeleeOdds.ItemSelected +=  (object sender, AdapterView.ItemSelectedEventArgs e) => {
				odds = mc.OddsItem(e.Position);
				UpdateResults();
			};
				
			ArrayAdapter<String> adapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleSpinnerDropDownItem, mc.OddsList);
			adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
			spinMeleeOdds.Adapter = adapter;
			
			
			imgMeleeDie1.Click += (sender, e) => {
				IncrementDie(1);
				DisplayDice();
				UpdateResults();
			};
			imgMeleeDie2.Click += (sender, e) => {
				IncrementDie(2);
				DisplayDice();
				UpdateResults();
			};
			imgMeleeDie3.Click += (sender, e) => {
				IncrementDie(3);
				DisplayDice();
				UpdateResults();
			};
			imgMeleeDie4.Click += (sender, e) => {
				IncrementDie(4);
				DisplayDice();
				UpdateResults();
			};
			imgMeleeDie5.Click += (sender, e) => {
				IncrementDie(5);
				DisplayDice();
				UpdateResults();
			};
			
			btnMeleeDiceRoll.Click += (sender, e) => {
				audio.Play();
				dice.Roll();
				DisplayDice();
				UpdateResults();
			};
			
			
			btnMeleeIncrPrev.Click += (sender, e) => {
				var value = GetMeleeIncrements();
				if (--value < 1) value = 1;
				editMeleeIncrValue.Text = value.ToString();
				UpdateUnit();
			};
			btnMeleeIncrNext.Click += (sender, e) => {
				var value = GetMeleeIncrements();
				editMeleeIncrValue.Text = (++value).ToString();
				UpdateResults();
			};
			editMeleeIncrValue.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => {
				UpdateUnit();
			};
			
			btnMeleeLossPrev.Click += (sender, e) => {
				var value = GetMeleeLoss();
				if (--value < 1) value = 1;
				editMeleeLossValue.Text = value.ToString();
				UpdateUnit();
			};
			btnMeleeLossNext.Click += (sender, e) => {
				var value = GetMeleeLoss();
				editMeleeLossValue.Text = (++value).ToString();
				UpdateUnit();
			};
			editMeleeLossValue.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => {
				UpdateUnit();
			};
			
			btnMeleeValuePrev.Click += (sender, e) => {
				var value = GetMeleeValue();
				if (--value < 1) value = 1;
				editMeleeValueValue.Text = value.ToString();
				UpdateUnit();
			};
			btnMeleeValueNext.Click += (sender, e) => {
				var value = GetMeleeValue();
				editMeleeValueValue.Text = (++value).ToString();
				UpdateUnit();
			};
			editMeleeValueValue.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => {
				UpdateUnit();
			};
			
			btnMeleeLancePrev.Click += (sender, e) => {
				var value = GetMeleeLance();
				if (--value < 1) value = 1;
				editMeleeLanceValue.Text = value.ToString();
				UpdateUnit();
			};
			btnMeleeLanceNext.Click += (sender, e) => {
				var value = GetMeleeLance();
				editMeleeLanceValue.Text = (++value).ToString();
				UpdateUnit();
			};
			editMeleeLanceValue.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => {
				UpdateUnit();
			};
			
			btnMeleeTotalPrev.Click += (sender, e) => {
				var value = GetMeleeTotal();
				if (--value < 1) value = 1;
				editMeleeTotalValue.Text = value.ToString();
			};
			btnMeleeTotalNext.Click += (sender, e) => {
				var value = GetMeleeTotal();
				editMeleeTotalValue.Text = (++value).ToString();
			};
			editMeleeTotalValue.AfterTextChanged += (object sender, Android.Text.AfterTextChangedEventArgs e) => {
			};
			
			
			btnMeleeMods13.Click += (sender, e) => {
				var value = GetMeleeTotal();
				if (btnMeleeMods13.Checked) 
				{
					value /= 3;
				}
				else
				{
					value *= 3;
				}
				editMeleeTotalValue.Text = value.ToString();
			};
			btnMeleeMods12.Click += (sender, e) => {
				var value = GetMeleeTotal();
				if (btnMeleeMods12.Checked) 
				{
					value /= 2;
				}
				else
				{
					value *= 2;
				}
				editMeleeTotalValue.Text = value.ToString();
			};
			btnMeleeMods32.Click += (sender, e) => {
				var value = GetMeleeTotal();
				if (btnMeleeMods32.Checked) 
				{
					value *= 1.5;
				}
				else
				{
					value /= 1.5;
				}
				editMeleeTotalValue.Text = value.ToString();
			};
			btnMeleeMods2.Click += (sender, e) => {
				var value = GetMeleeTotal();
				if (btnMeleeMods2.Checked) 
				{
					value *= 2;
				}
				else
				{
					value /= 2;
				}
				editMeleeTotalValue.Text = value.ToString();
			};
			
			btnMeleeModsLnc.Click += (sender, e) => {
				var value = GetMeleeLance();
				if (btnMeleeModsLnc.Checked) 
				{
					value *= 2;
				}
				else
				{
					value /= 2;
				}
				editMeleeLanceValue.Text = value.ToString();
				UpdateUnit();
			};

			
			DisplayOdds();
			DisplayDice();
		}
Beispiel #8
0
		public string Resolve(Odds odds, int defincr, int dice) 
		{
	    	if (defincr > 9) 
			{
	        	var b6i = new Base6Value(dice);
	        	dice = b6i.Add(defincr - 9);
	        }
	        
	        var result = "NE";
			if (odds.Value == -3)
			{	//1-3
				if (dice >= 65) {
					result = "1";
	            }
			}
			else if (odds.Value == -2.5)
			{	//1-2.5
				if (dice >= 64) {
					result = "1";
                }
			}
			else if (odds.Value == -2)
			{	//1-2
				if (dice >= 62) {
					result = "1";
                }
			}
			else if (odds.Value == -1.5)
			{	//1-1.5
				if (dice >= 55) {
					result = "1";
                }
			}
			else if (odds.Value == 1)
			{	//1-1
				if (dice >= 51) {
					result = "1";
                }
			}
			else if (odds.Value == 1.5)
			{	//1.5-1
				if (dice >= 42) {
					result = "1";
                }
			}
			else if (odds.Value == 2)
			{	//2-1
				if (dice >= 33) {
					result = "1";
                }
			}
			else if (odds.Value == 2.5)
			{	//2.5-1
				if (dice >= 64) {
					result = "2";
                }
				else if (dice >= 26) {
					result = "1";
                }
			}
			else if (odds.Value == 3)
			{	//3-1
				if 	(dice >= 56) {
					result = "2";
                }
				else if (dice >= 22) {
					result = "1";
                }
			}
			else if (odds.Value == 4)
			{	//4-1
				if (dice >= 54) {
					result = "2";
                }
				else if (dice >= 13) {
					result = "1";
                }
			}
			else if (odds.Value == 5)
			{	//5-1
				if (dice >= 66) {
					result = "3";
                }
				else if (dice >= 45) {
					result = "2";
                }
				else if (dice >= 11) {
					result = "1";
                }
			}
			else if (odds.Value == 6)
			{	//6-1
				if (dice >= 62) {
					result = "3";
                }
				else if (dice >= 33) {
					result = "2";
                }
				else if (dice >= 11) {
					result = "1";
                }
			}
			else if (odds.Value == 7)
			{	//7-1
				if (dice >= 52) {
					result = "3";
                }
				else if (dice >= 23) {
					result = "2";
                }
				else if (dice >= 11) {
					result = "1";
                }
			}
			else if (odds.Value == 8)
			{	//8-1
				if (dice >= 66) {
					result = "4";
                }
				else if (dice >= 45) {
					result = "3";
                }
				else if (dice >= 15) {
					result = "2";
                }
				else if (dice >= 11) {
					result = "1";
                }
			}
			else if (odds.Value == 9)
			{	//9-1
				if (dice >= 63) {
					result = "4";
                }
				else if (dice >= 42) {
					result = "3";
                }
				else if (dice >= 11) {
					result = "2";
                }
			}
			else if (odds.Value == 10)
			{	//10-1
				if (dice >= 65) {
					result = "5";
                }
				else if (dice >= 55) {
					result = "4";
                }
				else if (dice >= 26) {
					result = "3";
                }
				else if (dice >= 11) {
					result = "2";
                }
			}
			else 
			{
				result = "NE";
			}
			
	        /*
			if (dice >= 65) {
	        	result += " &";
			}            
			*/
	        
	        return result;
		}