@Override public int getValidity( final Object criterionUser, final Object criterionTarget, final Object criterionContent, final Object criterionContext) { final BasicCharacterInfo character = CriteriaUtils.getTargetCharacterInfoFromParameters( this.m_target, criterionUser, criterionTarget, criterionContext, criterionContent); if (character == null) { return -1; } final BasicFight<?> fight = (BasicFight<?>) character.getCurrentFight(); if (fight == null) { return -1; } final Collection<? extends BasicCharacterInfo> fighters = (Collection<? extends BasicCharacterInfo>) fight.getFighters(); for (final BasicCharacterInfo fighter : fighters) { if (fighter.getProtector() != null) { return 0; } } return -1; }
@Override public boolean fightShouldContinue(final BasicFight<? extends BasicCharacterInfo> fight) { boolean enoughTeamsLeft = false; boolean playerPresent = false; final TByteHashSet remainingTeams = new TByteHashSet(); final Collection<? extends BasicCharacterInfo> inPlayFighters = fight.getInPlayOrSimulatingFighters(); for (final BasicCharacterInfo f : inPlayFighters) { if (f.getTeamId() == -1) { EnoughTeamWithPlayersOrCompanionLeftChecker.m_logger.error( (Object) fight.withFightId( "[FIGHT_REFACTOR] On a un fighter inPlay avec un teamId \u00e0 -1 " + f + " - " + ExceptionFormatter.currentStackTrace(8))); } else { remainingTeams.add(f.getTeamId()); enoughTeamsLeft |= (remainingTeams.size() >= fight.getMinTeam()); playerPresent |= (f.getType() == 0 || f.getType() == 5); if (playerPresent && enoughTeamsLeft) { break; } continue; } } return enoughTeamsLeft && playerPresent; }