コード例 #1
0
ファイル: Summon.java プロジェクト: cqhaoer/CardFantasy
 public static void apply(
     SkillResolver resolver,
     SkillUseInfo skillUseInfo,
     CardInfo summoner,
     String... summonedCardsDescs)
     throws HeroDieSignal {
   if (summoner == null) {
     throw new CardFantasyRuntimeException("summoner should not be null");
   }
   Skill skill = skillUseInfo.getSkill();
   if (summoner.hasUsed(skillUseInfo)) {
     return;
   }
   List<CardInfo> livingCards = summoner.getOwner().getField().getAliveCards();
   for (CardInfo fieldCard : livingCards) {
     if (fieldCard.getStatus().containsStatusCausedBy(skillUseInfo, CardStatusType.召唤)) {
       return;
     }
   }
   resolver.getStage().getUI().useSkill(summoner, skill, true);
   List<CardInfo> summonedCards =
       DeckBuilder.build(summonedCardsDescs).getCardInfos(summoner.getOwner());
   for (int i = 0; i < summonedCards.size(); ++i) {
     CardInfo summonedCard = summonedCards.get(i);
     resolver.summonCard(summoner.getOwner(), summonedCard, summoner, true);
     CardStatusItem weakStatusItem = CardStatusItem.weak(skillUseInfo);
     resolver.getStage().getUI().addCardStatus(summoner, summonedCard, skill, weakStatusItem);
     summonedCard.addStatus(weakStatusItem);
     CardStatusItem summonedStatusItem = CardStatusItem.summoned(skillUseInfo);
     resolver.getStage().getUI().addCardStatus(summoner, summonedCard, skill, summonedStatusItem);
     summonedCard.addStatus(summonedStatusItem);
   }
   summoner.setUsed(skillUseInfo);
 }
コード例 #2
0
ファイル: MagicMark.java プロジェクト: zhjzjnb/CardFantasy
 public static void apply(
     SkillResolver resolver,
     SkillUseInfo skillUseInfo,
     EntityInfo caster,
     Player enemyPlayer,
     int victimCount)
     throws HeroDieSignal {
   GameUI ui = resolver.getStage().getUI();
   Skill skill = skillUseInfo.getSkill();
   Randomizer random = Randomizer.getRandomizer();
   List<CardInfo> victims =
       random.pickRandom(enemyPlayer.getField().toList(), victimCount, true, null);
   ui.useSkill(caster, victims, skill, true);
   for (CardInfo victim : victims) {
     CardStatusItem statusItem = CardStatusItem.magicMark(skillUseInfo);
     if (!resolver.resolveAttackBlockingSkills(caster, victim, skill, 1).isAttackable()) {
       return;
     }
     ui.addCardStatus(caster, victim, skill, statusItem);
     victim.addStatus(statusItem);
   }
 }
コード例 #3
0
 public static boolean isBlockSkillDisabled(
     SkillResolver resolver,
     Skill attackSkill,
     Skill blockSkill,
     CardInfo attacker,
     CardInfo defender) {
   if (attacker == null) {
     throw new CardFantasyRuntimeException("attacker is null");
   }
   if (defender == null) {
     throw new CardFantasyRuntimeException("defender is null");
   }
   if (blockSkill.getType().containsTag(SkillTag.物理护甲)) {
     resolver.getStage().getUI().useSkill(attacker, defender, attackSkill, true);
     resolver.getStage().getUI().disableBlock(attacker, defender, attackSkill, blockSkill);
     return true;
   } else {
     return false;
   }
 }