コード例 #1
0
ファイル: CMD_AddCounter.java プロジェクト: sonjayatandon/dce
  @Override
  public void execute(XCFRequest request) throws XCFException {
    XCFContext context = request.getContext();
    XCFLogger logger = context.getFacade().getLogManager().getLogger("combat");
    String characterName = getString(request, "character", XCF_TAG);
    MODEL_CombatCharacter character = getCharacter(request, characterName, XCF_TAG);
    String best = (String) getProperty("best");
    if (best != null) {
      character = character.getBest(best);
    }

    String counterName = getString(request, "counter", XCF_TAG);
    Integer counter = character.getAttribute(counterName, 0);
    int min = getInt(request, "min", 0, XCF_TAG);
    int amount = getInt(request, "amount", XCF_TAG);

    counter = counter + amount;
    if (counter < min) counter = min;

    ICombatLog mlog = UTIL_Helper.getMatchLog(request);
    ICombatFormulas f = UTIL_Helper.getFormulas(request);
    logger.logMessage(
        context,
        XCFLogger.LogTypes.INFO,
        "Set " + character.getName() + "'s " + counterName.toUpperCase() + " TO " + counter);
    mlog.logEvent(
        character.getID(),
        5,
        7,
        new int[] {character.getID(), f.getPropertyID(counterName), counter});
    character.setAttribute(counterName, counter);
  }
コード例 #2
0
  @Override
  public void execute(XCFRequest request) throws XCFException {
    XCFContext context = request.getContext();
    XCFLogger logger = context.getFacade().getLogManager().getLogger("combat");

    MODEL_Card damageSource = UTIL_Helper.getDamageSource(request);

    String damageDealer = getString(request, "damage-dealer", XCF_TAG);
    String characterName = getString(request, "character", XCF_TAG);
    String damageType = getString(request, "damage-type", XCF_TAG);
    int damage = getInt(request, "damage", XCF_TAG);
    int fatigue = getInt(request, "fatigue", 0, XCF_TAG);
    MODEL_CombatCharacter character = getCharacter(request, characterName, XCF_TAG);

    UTIL_Helper.setDamageDealer(request, getCharacter(request, damageDealer, XCF_TAG));
    UTIL_Helper.setDamageSource(request, getCard(request, XCF_TAG));

    ICombatLog mlog = UTIL_Helper.getMatchLog(request);
    damage = character.takeDamage(request, damage, 0);
    logger.logMessage(
        context, XCFLogger.LogTypes.INFO, character.getName() + " takes " + damage + " damage.");
    mlog.logEvent(character.getID(), 15, 21, new int[] {character.getID(), damage});
    UTIL_Helper.setDamageSource(request, damageSource);
    mlog.logDamage(request, character, damageType, damage, fatigue);
  }