public stChassisISCOBP() {
   AC.SetISCodes('E', 'X', 'X', 'E');
   AC.SetISDates(3056, 3061, true, 3061, 0, 0, false, false);
   AC.SetISFactions("FC", "FS", "", "");
   AC.SetRulesLevels(
       AvailableCode.RULES_EXPERIMENTAL,
       AvailableCode.RULES_UNALLOWED,
       AvailableCode.RULES_UNALLOWED,
       AvailableCode.RULES_UNALLOWED,
       AvailableCode.RULES_UNALLOWED);
 }
Ejemplo n.º 2
0
 public stChassisREQD() {
   AC.SetISCodes('E', 'X', 'X', 'E');
   AC.SetISDates(3055, 3057, true, 3057, 0, 0, false, false);
   AC.SetISFactions("CS", "CS/WB", "", "");
   AC.SetCLCodes('E', 'X', 'X', 'E');
   AC.SetCLDates(3060, 3065, true, 3065, 0, 0, false, false);
   AC.SetCLFactions("CGB", "CGB", "", "");
   AC.SetRulesLevels(
       AvailableCode.RULES_EXPERIMENTAL,
       AvailableCode.RULES_UNALLOWED,
       AvailableCode.RULES_UNALLOWED,
       AvailableCode.RULES_UNALLOWED,
       AvailableCode.RULES_UNALLOWED);
 }
Ejemplo n.º 3
0
  public static boolean IsAllowed(AvailableCode AC, ifUnit u) {
    // check an available code to see if it can be used legally

    // switch by type and filter.
    switch (u.GetUnitType()) {
      case AvailableCode.UNIT_BATTLEMECH:
        if (!(u instanceof Mech)) {
          return false;
        }
        switch (u.GetRulesLevel()) {
          case AvailableCode.RULES_INTRODUCTORY:
            if (AC.GetRulesLevel_BM() != AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_TOURNAMENT:
            if (AC.GetRulesLevel_BM() > AvailableCode.RULES_TOURNAMENT
                || AC.GetRulesLevel_BM() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_ADVANCED:
            if (AC.GetRulesLevel_BM() > AvailableCode.RULES_ADVANCED
                || AC.GetRulesLevel_BM() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_EXPERIMENTAL:
            if (AC.GetRulesLevel_BM() > AvailableCode.RULES_EXPERIMENTAL
                || AC.GetRulesLevel_BM() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_ERA_SPECIFIC:
            if (AC.GetRulesLevel_BM() > AvailableCode.RULES_ERA_SPECIFIC
                || AC.GetRulesLevel_BM() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          default:
            return false;
        }
        // is the 'Mech primitive and is this equipment allowed?
        if (((Mech) u).IsPrimitive()) {
          if (!AC.IsPBMAllowed()) {
            return false;
          }
        } else {
          if (AC.IsPrimitiveOnly()) {
            return false;
          }
        }

        // If this 'Mech is Super Heavy, the equipment must be compatible
        if (((Mech) u).IsSuperheavy()) {
          if (!AC.IsSuperHeavyCompatible()) {
            return false;
          }
        } else {
          if (AC.IsSuperHeavyOnly()) {
            return false;
          }
        }

        break;
      case AvailableCode.UNIT_INDUSTRIALMECH:
        if (!(u instanceof Mech)) {
          return false;
        }
        switch (u.GetRulesLevel()) {
          case AvailableCode.RULES_INTRODUCTORY:
            if (AC.GetRulesLevel_IM() != AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_TOURNAMENT:
            if (AC.GetRulesLevel_IM() > AvailableCode.RULES_TOURNAMENT
                || AC.GetRulesLevel_IM() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_ADVANCED:
            if (AC.GetRulesLevel_IM() > AvailableCode.RULES_ADVANCED
                || AC.GetRulesLevel_IM() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_EXPERIMENTAL:
            if (AC.GetRulesLevel_IM() > AvailableCode.RULES_EXPERIMENTAL
                || AC.GetRulesLevel_IM() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_ERA_SPECIFIC:
            if (AC.GetRulesLevel_IM() > AvailableCode.RULES_ERA_SPECIFIC
                || AC.GetRulesLevel_IM() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          default:
            return false;
        }
        // is the 'Mech primitive and is this equipment allowed?
        if (((Mech) u).IsPrimitive()) {
          if (!AC.IsPIMAllowed()) {
            return false;
          }
        } else {
          if (AC.IsPrimitiveOnly()) {
            return false;
          }
        }
        break;
      case AvailableCode.UNIT_COMBATVEHICLE:
        switch (u.GetRulesLevel()) {
          case AvailableCode.RULES_INTRODUCTORY:
            if (AC.GetRulesLevel_CV() != AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_TOURNAMENT:
            if (AC.GetRulesLevel_CV() > AvailableCode.RULES_TOURNAMENT
                || AC.GetRulesLevel_CV() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_ADVANCED:
            if (AC.GetRulesLevel_CV() > AvailableCode.RULES_ADVANCED
                || AC.GetRulesLevel_CV() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_EXPERIMENTAL:
            if (AC.GetRulesLevel_CV() > AvailableCode.RULES_EXPERIMENTAL
                || AC.GetRulesLevel_CV() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          case AvailableCode.RULES_ERA_SPECIFIC:
            if (AC.GetRulesLevel_CV() > AvailableCode.RULES_ERA_SPECIFIC
                || AC.GetRulesLevel_CV() < AvailableCode.RULES_INTRODUCTORY) {
              return false;
            }
            break;
          default:
            return false;
        }
        // is the 'Mech primitive and is this equipment allowed?
        if (((CombatVehicle) u).IsPrimitive()) {
          if (!AC.IsPIMAllowed()) {
            return false;
          }
        } else {
          if (AC.IsPrimitiveOnly()) {
            return false;
          }
        }
        break;
      case AvailableCode.UNIT_CONVFIGHTER:
        switch (u.GetRulesLevel()) {
          case AvailableCode.RULES_INTRODUCTORY:
            break;
          case AvailableCode.RULES_TOURNAMENT:
            break;
          case AvailableCode.RULES_ADVANCED:
            break;
          case AvailableCode.RULES_EXPERIMENTAL:
            break;
          case AvailableCode.RULES_ERA_SPECIFIC:
            break;
          default:
            return false;
        }
        break;
      case AvailableCode.UNIT_AEROFIGHTER:
        switch (u.GetRulesLevel()) {
          case AvailableCode.RULES_INTRODUCTORY:
            break;
          case AvailableCode.RULES_TOURNAMENT:
            break;
          case AvailableCode.RULES_ADVANCED:
            break;
          case AvailableCode.RULES_EXPERIMENTAL:
            break;
          case AvailableCode.RULES_ERA_SPECIFIC:
            break;
          default:
            return false;
        }
        break;
      default:
        return false;
    }

    // is this within our techbase?
    switch (u.GetTechbase()) {
      case AvailableCode.TECH_INNER_SPHERE:
        if (AC.GetTechBase() == AvailableCode.TECH_CLAN) {
          return false;
        }
        break;
      case AvailableCode.TECH_CLAN:
        if (AC.GetTechBase() == AvailableCode.TECH_INNER_SPHERE) {
          return false;
        }
        break;
      case AvailableCode.TECH_BOTH:
        // this does nothing, put here to avoid default
        break;
      default:
        return false;
    }

    // are we restricting by year?
    if (u.IsYearRestricted()) {
      // we are.
      switch (u.GetTechbase()) {
        case AvailableCode.TECH_INNER_SPHERE:
          if (AC.WentExtinctIS()) {
            if (AC.WasReIntrodIS()) {
              if ((u.GetYear() >= AC.GetISIntroDate() && u.GetYear() < AC.GetISExtinctDate())
                  || u.GetYear() >= AC.GetISReIntroDate()) {
                return true;
              } else {
                return false;
              }
            } else {
              if (u.GetYear() >= AC.GetISIntroDate() && u.GetYear() < AC.GetISExtinctDate()) {
                return true;
              } else {
                return false;
              }
            }
          } else {
            if (u.GetYear() >= AC.GetISIntroDate()) {
              return true;
            } else {
              return false;
            }
          }
        case AvailableCode.TECH_CLAN:
          if (AC.WentExtinctCL()) {
            if (AC.WasReIntrodCL()) {
              if ((u.GetYear() >= AC.GetCLIntroDate() && u.GetYear() < AC.GetCLExtinctDate())
                  || u.GetYear() >= AC.GetCLReIntroDate()) {
                return true;
              } else {
                return false;
              }
            } else {
              if (u.GetYear() >= AC.GetCLIntroDate() && u.GetYear() < AC.GetCLExtinctDate()) {
                return true;
              } else {
                return false;
              }
            }
          } else {
            if (u.GetYear() >= AC.GetCLIntroDate()) {
              return true;
            } else {
              return false;
            }
          }
        case AvailableCode.TECH_BOTH:
          boolean Okay_IS = false, Okay_CL = false;
          if (AC.WentExtinctIS()) {
            if (AC.WasReIntrodIS()) {
              if ((u.GetYear() >= AC.GetISIntroDate() && u.GetYear() < AC.GetISExtinctDate())
                  || u.GetYear() >= AC.GetISReIntroDate()) {
                Okay_IS = true;
              } else {
                Okay_IS = false;
              }
            } else {
              if (u.GetYear() >= AC.GetISIntroDate() && u.GetYear() < AC.GetISExtinctDate()) {
                Okay_IS = true;
              } else {
                Okay_IS = false;
              }
            }
          } else {
            if (u.GetYear() >= AC.GetISIntroDate()) {
              Okay_IS = true;
            } else {
              Okay_IS = false;
            }
          }
          if (AC.WentExtinctCL()) {
            if (AC.WasReIntrodCL()) {
              if ((u.GetYear() >= AC.GetCLIntroDate() && u.GetYear() < AC.GetCLExtinctDate())
                  || u.GetYear() >= AC.GetCLReIntroDate()) {
                Okay_CL = true;
              } else {
                Okay_CL = false;
              }
            } else {
              if (u.GetYear() >= AC.GetCLIntroDate() && u.GetYear() < AC.GetCLExtinctDate()) {
                Okay_CL = true;
              } else {
                Okay_CL = false;
              }
            }
          } else {
            if (u.GetYear() >= AC.GetCLIntroDate()) {
              Okay_CL = true;
            } else {
              Okay_CL = false;
            }
          }
          if (Okay_IS || Okay_CL) {
            return true;
          } else {
            return false;
          }
      }
    } else {
      // we aren't, go by the era
      switch (u.GetEra()) {
        case AvailableCode.ERA_STAR_LEAGUE:
          switch (u.GetTechbase()) {
            case AvailableCode.TECH_INNER_SPHERE:
            case AvailableCode.TECH_BOTH:
              if (AC.GetISSLCode() < 'X') {
                return true;
              } else {
                return false;
              }
            case AvailableCode.TECH_CLAN:
              return false;
          }
        case AvailableCode.ERA_SUCCESSION:
          switch (u.GetTechbase()) {
            case AvailableCode.TECH_INNER_SPHERE:
              if (u.GetRulesLevel() > AvailableCode.RULES_TOURNAMENT) {
                if (AC.GetISSWCode() < 'X') {
                  return true;
                } else {
                  return false;
                }
              } else {
                if (AC.GetISSWCode() < 'F') {
                  return true;
                } else {
                  return false;
                }
              }
            case AvailableCode.TECH_CLAN:
              if (AC.GetCLSWCode() < 'X') {
                return true;
              } else {
                return false;
              }
            case AvailableCode.TECH_BOTH:
              if (AC.GetBestSWCode() < 'X') {
                return true;
              } else {
                return false;
              }
            default:
              return false;
          }
        case AvailableCode.ERA_CLAN_INVASION:
          switch (u.GetTechbase()) {
            case AvailableCode.TECH_INNER_SPHERE:
              if (AC.GetISCICode() < 'X') {
                return true;
              } else {
                return false;
              }
            case AvailableCode.TECH_CLAN:
              if (AC.GetCLCICode() < 'X') {
                return true;
              } else {
                return false;
              }
            case AvailableCode.TECH_BOTH:
              if (AC.GetBestCICode() < 'X') {
                return true;
              } else {
                return false;
              }
            default:
              return false;
          }
        case AvailableCode.ERA_DARK_AGES:
          switch (u.GetTechbase()) {
            case AvailableCode.TECH_INNER_SPHERE:
              if (AC.GetISDACode() < 'X') {
                return true;
              } else {
                return false;
              }
            case AvailableCode.TECH_CLAN:
              if (AC.GetCLDACode() < 'X') {
                return true;
              } else {
                return false;
              }
            case AvailableCode.TECH_BOTH:
              if (AC.GetBestDACode() < 'X') {
                return true;
              } else {
                return false;
              }
            default:
              return false;
          }
        case AvailableCode.ERA_ALL:
          // the "All" era.
          return true;
      }
    }

    return false;
  }