public bool EarnExp(uint ap, out Kernel_bin.Abilities ability) { bool ret = false; ability = Kernel_bin.Abilities.None; if (!IsGameOver) { if (EXPtoNextLevel <= ap && Level < 100) { ret = true; } Experience += ap; if (!Learning.Equals(Kernel_bin.Abilities.None) && Kernel_bin.AllAbilities.ContainsKey(Learning)) { byte ap_tolearn = Kernel_bin.AllAbilities[Learning].AP; if (JunctionableGFsData.Ability.TryGetIndexByKey(Learning, out int ind) && TestGFCanLearn(Learning, false)) { if (ap_tolearn < APs[ind] + ap) { APs[ind] = ap_tolearn; ability = Learning; Learn(Learning); } else { APs[ind] += (byte)ap; } } } } return(ret); }
/// <summary> /// Learn this ability /// </summary> /// <param name="ability"></param> /// <returns></returns> public bool Learn(Kernel_bin.Abilities ability) { if (!MaxGFAbilities) { if (!Complete[(int)ability]) { Complete[(int)ability] = true; if (Learning.Equals(ability)) { SetLearning(); } return(true); } } return(false); }