Пример #1
0
  public List<Ability> getClanLevelEffectsList(final MOB mob, final Integer level) {
    if (clanEffectNames == null) return empty;

    if ((clanEffectMap == null)
        && (clanEffectNames != null)
        && (clanEffectLevels != null)
        && (clanEffectParms != null)) clanEffectMap = new Hashtable<Integer, List<Ability>>();

    if (clanEffectMap == null) return empty;

    if (clanEffectMap.containsKey(level)) return clanEffectMap.get(level);
    final CMObjUniqSortSVec<Ability> finalV = new CMObjUniqSortSVec<Ability>();
    for (int v = 0; v < clanEffectLevels.length; v++) {
      if ((clanEffectLevels[v] <= level.intValue())
          && (clanEffectNames.length > v)
          && (clanEffectParms.length > v)) {
        Ability A = CMClass.getAbility(clanEffectNames[v]);
        if (A != null) {
          // mob was set to null here to make the cache map actually relevant .. see caching below
          A.setProficiency(CMLib.ableMapper().getMaxProficiency((MOB) null, true, A.ID()));
          A.setMiscText(clanEffectParms[v]);
          A.makeNonUninvokable();
          A.setSavable(false); // must go AFTER the ablve
          finalV.add(A);
        }
      }
    }
    finalV.trimToSize();
    clanEffectMap.put(level, finalV);
    return finalV;
  }
Пример #2
0
  public ChameleonList<Ability> getClanLevelEffects(final MOB mob, final Integer level) {
    if (level == null) return getEmptyClanLevelEffects(mob);
    final DefaultClanGovernment myGovt = this;
    final List<Ability> myList = getClanLevelEffectsList(mob, level);
    final List<Ability> finalV = new Vector<Ability>(myList.size());
    for (final Ability A : myList) {
      Ability finalA = (Ability) A.copyOf();
      finalA.makeNonUninvokable();
      finalA.setSavable(false); // must come AFTER the above
      finalA.setAffectedOne(mob);
      finalV.add(finalA);
    }
    final ChameleonList<Ability> finalFinalV;
    if (mob == null) {
      finalFinalV =
          new ChameleonList<Ability>(
              finalV,
              new ChameleonList.Signaler<Ability>(myList) {
                public boolean isDeprecated() {
                  return false;
                }

                public void rebuild(final ChameleonList<Ability> me) {}
              });
    } else {
      finalFinalV =
          new ChameleonList<Ability>(
              finalV,
              new ChameleonList.Signaler<Ability>(myList) {
                public boolean isDeprecated() {
                  if ((mob == null) || (mob.amDestroyed())) return true;
                  final Clan C = mob.getMyClan();
                  if (C == null) return true;
                  if ((C.getGovernment() != myGovt)
                      || (getClanLevelEffectsList(mob, Integer.valueOf(C.getClanLevel()))
                          != oldReferenceListRef.get())) return true;
                  return false;
                }

                public void rebuild(final ChameleonList<Ability> me) {

                  final Clan C = (mob != null) ? mob.getMyClan() : null;
                  if ((mob == null) || (mob.amDestroyed()) || (C == null))
                    me.changeMeInto(getEmptyClanLevelEffects(mob));
                  else
                    me.changeMeInto(
                        C.getGovernment()
                            .getClanLevelEffects(mob, Integer.valueOf(C.getClanLevel())));
                }
              });
    }
    return finalFinalV;
  }
Пример #3
0
 public List<Ability> getClanLevelAbilities(Integer level) {
   if ((clanAbilityMap == null)
       && (clanAbilityNames != null)
       && (clanAbilityLevels != null)
       && (clanAbilityProficiencies != null)
       && (clanAbilityQuals != null)) {
     CMLib.ableMapper().delCharMappings(ID()); // necessary for a "clean start"
     clanAbilityMap = new Hashtable<Integer, List<Ability>>();
     for (int i = 0; i < clanAbilityNames.length; i++) {
       CMLib.ableMapper()
           .addDynaAbilityMapping(
               ID(),
               clanAbilityLevels[i],
               clanAbilityNames[i],
               clanAbilityProficiencies[i],
               "",
               !clanAbilityQuals[i],
               false);
     }
   }
   if (clanAbilityMap == null) return empty;
   if (clanAbilityMap.containsKey(level)) return clanAbilityMap.get(level);
   List<AbilityMapper.AbilityMapping> V =
       CMLib.ableMapper().getUpToLevelListings(ID(), level.intValue(), true, true);
   CMObjUniqSortSVec<Ability> finalV = new CMObjUniqSortSVec<Ability>();
   for (AbilityMapper.AbilityMapping able : V) {
     Ability A = CMClass.getAbility(able.abilityID);
     if (A != null) {
       A.setProficiency(CMLib.ableMapper().getDefaultProficiency(ID(), false, A.ID()));
       A.setSavable(false);
       A.setMiscText(CMLib.ableMapper().getDefaultParm(ID(), false, A.ID()));
       finalV.add(A);
     }
   }
   finalV.trimToSize();
   clanAbilityMap.put(level, finalV);
   return finalV;
 }