public void passDream(Dream d, int index) { Dream dream = d; Dreams[index - 1] = dream; recalculateCharacter(); }
public void passAmountODreamsAndNightmares() { Dreams.Clear(); Nightmares.Clear(); for (int i = 0; i < TotalDreams; i++) { Dream d = new Dream(); Dreams.Add(d); } for (int i = 0; i < TotalNightmares; i++) { Nightmare n = new Nightmare(); Nightmares.Add(n); } }
protected void roll_Dream_Click(object sender, EventArgs e) { Button button = sender as Button; int index = 0; if (button.Name.Length == 5) { Int32.TryParse("" + button.Name[button.Name.Length - 2] + "" + button.Name[button.Name.Length - 1], out index); } else { Int32.TryParse("" + button.Name[button.Name.Length - 1], out index); } int roll = RollRandom(1, 41); dreamRolled[index - 1].Text = "" + roll; Dream dream = getDream(roll, index); dreamName[index - 1].Content = "" + dream.Name; //if (character.Dreams.Contains(dream)) //{ // //int i = character.Dreams.IndexOf(dream); // int dc; // Int32.TryParse(dreamCount[index - 1].Text, out dc); // dreamCount[index - 1].Text = "" + (dc + 1); // //character.Dreams.Remove(dream); // //Grid_Dreams.Children.RemoveRange((i) * 6,6); //} //else //{ dreamCount[index - 1].Text = "1"; //} character.passDream(dream, index); fillCharacterStats(); }
private Dream getDream(int roll, int ind) { Dream dream = new Dream(); if (roll <= 2) { dream = Dream.Wetness; } else if (roll > 2 && roll <= 4) { dream = Dream.Fragments; } else if (roll > 4 && roll <= 6) { dream = Dream.Power; } else if (roll > 6 && roll <= 8) { dream = Dream.Peace; } else if (roll > 8 && roll <= 10) { dream = Dream.Friends; } else if (roll > 10 && roll <= 12) { dream = Dream.Freedom; } else if (roll > 12 && roll <= 14) { dream = Dream.Forests; } else if (roll > 14 && roll <= 16) { dream = Dream.Life; } else if (roll > 16 && roll <= 18) { dream = Dream.Family; } else if (roll > 18 && roll <= 20) { dream = Dream.Love; } else if (roll > 20 && roll <= 22) { dream = Dream.Colours; } else if (roll > 22 && roll <= 24) { dream = Dream.Harmony; } else if (roll > 24 && roll <= 26) { dream = Dream.Riches; } else if (roll > 26 && roll <= 28) { dream = Dream.Flying; } else if (roll > 28 && roll <= 30) { dream = Dream.Home; } else if (roll > 30 && roll <= 32) { dream = Dream.Rest; } else if (roll > 32 && roll <= 34) { dream = Dream.Angels; } else if (roll > 34 && roll <= 36) { dream = Dream.Yourself; } else if (roll > 36 && roll <= 38) { dream = Dream.Defiance; } else if (roll > 38 && roll <= 40) { dream = Dream.Progeny; } else if (roll == 41) { dream = Dream.Fantasia; } int dc; Int32.TryParse(dreamCount[ind - 1].Text, out dc); if (dream.Stack != 0 && dc + 1 > dream.Stack) { roll = RollRandom(1, 41); dreamRolled[ind - 1].Text = "" + roll; dream = getDream(roll, ind); } return(dream); }