/// <summary> /// Từ ngũ hành của quẻ và ngũ hành của hào, lấy ra lục thân. /// Hành của quẻ chính là đại diện cho ta. /// </summary> /// <param name="hanhCuaQue"></param> /// <param name="hanhCuaHao"></param> /// <returns>Lục thân</returns> public static NguHanh GetLucThan(NguHanh hanhCuaQue, NguHanh hanhCuaHao) { // Nếu hào có cùng ngũ hành với ta thì là huynh đệ. if (hanhCuaHao.Id == hanhCuaQue.Id) { return(NguHanh.HuynhDe); } else if (hanhCuaHao.Id == hanhCuaQue.Sinh.Id) { // Cái ta (huynh đệ) sinh ra là tử tôn. return(NguHanh.TuTon); } else if (hanhCuaHao.Id == hanhCuaQue.Khac.Id) { // Cái ta (huynh đệ) khắc là thê tài. return(NguHanh.TheTai); } else if (hanhCuaHao.Id == hanhCuaQue.SinhBoi.Id) { // Sinh ra ta (huynh đệ) là phụ mẫu. return(NguHanh.PhuMau); } else if (hanhCuaHao.Id == hanhCuaQue.KhacBoi.Id) { // Cái khắc ta (huynh đệ) là quan quỷ. return(NguHanh.QuanQuy); } else { throw new Exception("Invalid NguHanh."); } }
/// <summary> /// Clone que. /// </summary> /// <returns></returns> internal Que Clone(NguHanh hanhCuaQue) { var que = new Que { Id = this.Id, Name = this.Name, NameShort = this.NameShort, NameChinese = this.NameChinese, Desc = this.Desc, QueId = this.QueId, Cach = this.Cach, YNghiaNgan = this.YNghiaNgan, EnglishName = this.EnglishName, Unicode = this.Unicode, YNghia = this.YNghia, ViDu = this.ViDu, TuongQue = this.TuongQue, QueThuan = this.QueThuan, NguHanh = hanhCuaQue, Hao6 = this.Hao6.CloneChoQueBien(hanhCuaQue), Hao5 = this.Hao5.CloneChoQueBien(hanhCuaQue), Hao4 = this.Hao4.CloneChoQueBien(hanhCuaQue), Hao3 = this.Hao3.CloneChoQueBien(hanhCuaQue), Hao2 = this.Hao2.CloneChoQueBien(hanhCuaQue), Hao1 = this.Hao1.CloneChoQueBien(hanhCuaQue), }; return(que); }
/// <summary> /// Từ hành của hào, kiểm tra xem nhật thìn hay nguyệt kiến có bị mộ. /// Giai đoạn mộ sẽ rơi vào thìn tuất sửu mùi. /// </summary> /// <param name="hanh"></param> /// <param name="chi"></param> /// <returns></returns> public static bool IsMo(NguHanh hanh, DiaChi chi) { if (hanh == Tho) { // Hành thổ không thể có mộ ở Thìn giống Thủy, // vì không lẽ Thìn thổ (nhật kiến, nguyệt kiến) cũng mộ ở Thìn? return(false); } return(GetThoiKi(hanh, chi) == Mo); }
private void SetPhucThan(NguHanh lucThanBiThieu) { for (int i = QueThuan.SauHao.Count - 1; i >= 0; i--) { if (QueThuan.SauHao[i].LucThan == lucThanBiThieu) { ViTriHaoPhuc = (ViTriHao)(6 - i); HaoPhuc = QueThuan.SauHao[i]; break; } } }
internal Hao CloneChoQueBien(NguHanh hanhCuaQue) { var hao = new Hao { HanhCuaQue = hanhCuaQue, Id = Id, Duong = Duong, Chi = Chi, The = The, Ung = Ung, }; return(hao); }
public TruongSinhNguHanh(NguHanh hanh, DiaChi chiBatDau) { NguHanh = hanh; var index = chiBatDau.Id - 1; var lastIndex = KinhDichCommon.DiaChi.All.Count - 1; for (int i = 0; i <= lastIndex; i++) { if (index > lastIndex) { index = 0; } DiaChi.Add(KinhDichCommon.DiaChi.All[index]); index++; } }
/// <summary> /// Từ ngũ hành của nguyệt kiến kiểm tra xem địa chi thuộc thời kì nào của vòng trường sinh. /// </summary> /// <param name="hanh">ngũ hành của tháng</param> /// <param name="chi">địa chi của hào</param> /// <returns></returns> public static VongTruongSinh GetThoiKi(NguHanh hanh, DiaChi chi) { foreach (var truongSinh in TruongSinhList) { if (hanh == truongSinh.NguHanh) { for (int i = 0; i < truongSinh.DiaChi.Count; i++) { if (chi == truongSinh.DiaChi[i]) { return(All[i]); } } } } throw new System.Exception("Wrong code in VongTruongSinh."); }