public Sk1() : base() { Number = 1; Name = "爱之双刃"; Description = "『爱之双刃』【自】[将我方的「米迪娅」转为已行动状态]这名单位攻击时,你可以支付费用。如果支付,则直到战斗结束为止,这名单位的战斗力+40。"; Optional = true; TypeSymbols.Add(SkillTypeSymbol.Auto); Keyword = SkillKeyword.Null; }
public Sk1() : base() { Number = 1; Name = "太阳"; Description = "『太阳』【自】这名单位的攻击击破敌方单位时,直到下一次对手的回合结束为止,这名单位的战斗力+20。"; Optional = false; TypeSymbols.Add(SkillTypeSymbol.Auto); Keyword = SkillKeyword.Null; }
public Sk2() : base() { Number = 2; Name = "英雄之纹章"; Description = "〖攻击型〗『英雄之纹章』【支】我方的攻击单位是<圣痕>势力的场合,直到战斗结束为止,那名单位的攻击所将破坏的宝玉变为2颗。"; TypeSymbols.Add(SkillTypeSymbol.Support); Keyword = SkillKeyword.Null; Symbol = SymbolEnum.Blue; }
public Sk2() : base() { Number = 2; Name = "二刀流"; Description = "『二刀流』【自】[翻面1]这名单位的攻击击破敌方单位时,你可以支付费用。如果支付,选择1名主人公以外的出击费用2以下的敌方单位,将其击破。"; Optional = true; TypeSymbols.Add(SkillTypeSymbol.Auto); Keyword = SkillKeyword.Null; }
public Sk2() : base() { Number = 2; Name = "报酬是甜食"; Description = "〖转职技〗『报酬是甜食』【自】这名单位的『暗杀』击破敌方单位时,抽1张卡。(〖转职技〗仅限这名单位经过转职后才能使用)"; Optional = false; TypeSymbols.Add(SkillTypeSymbol.Auto); Keyword = SkillKeyword.CCS; }
public Sk1() : base() { Number = 1; Name = "神军师的指挥"; Description = "『神军师的指挥』【自】每次其它我方单位转职时,你可以选择1名敌方单位,将其移动。"; Optional = true; TypeSymbols.Add(SkillTypeSymbol.Auto); Keyword = SkillKeyword.Null; }
public Sk1() : base() { Number = 1; Name = "圣者的祝福"; Description = "『圣者的祝福』【自】〖1回合1次〗[翻面1]出击费用2以下的我方单位出击时,你可以支付费用。如果支付,从自己的退避区中选择1张「蕾娜」以外的出击费用1的卡,将其加入手牌。"; OncePerTurn = true; Optional = true; TypeSymbols.Add(SkillTypeSymbol.Auto); Keyword = SkillKeyword.Null; }
public Sk1() : base() { Number = 1; Name = "疾风迅雷"; Description = "『疾风迅雷』【自】〖1回合1次〗这名单位的攻击击破敌方单位时,将这名单位转为未行动状态。"; OncePerTurn = true; Optional = false; TypeSymbols.Add(SkillTypeSymbol.Auto); Keyword = SkillKeyword.Null; }
public Sk1() : base() { Number = 1; Name = "库洛姆警卫队"; Description = "『库洛姆警卫队』【自】〖1回合1次〗其他我方单位转职时,直到回合结束为止,那名我方单位的战斗力+20,那名我方单位的攻击所将破坏的宝玉变为2颗。"; OncePerTurn = true; Optional = false; TypeSymbols.Add(SkillTypeSymbol.Auto); Keyword = SkillKeyword.Null; }
public Sk2() : base() { Number = 2; Name = "圣光"; Description = "『圣光』【起】〖1回合1次〗[翻面1]直到回合结束为止,这名单位的战斗力+20。"; OncePerTurn = true; TypeSymbols.Add(SkillTypeSymbol.Action); Keyword = SkillKeyword.Null; OncePerTurn = true; }
public Sk1() : base() { Number = 1; Name = "炎魔之阵"; Description = "『炎魔之阵』【起】〖1回合1次〗[将2名其他我方单位转为已行动状态]直到回合结束为止,这名单位的战斗力+20。"; OncePerTurn = true; TypeSymbols.Add(SkillTypeSymbol.Action); Keyword = SkillKeyword.Null; OncePerTurn = true; }
public Sk2() : base() { Number = 2; Name = "翱翔天空者"; Description = "『翱翔天空者』【起】〖1回合1次〗将这名单位移动。这个能力只能在这名单位处于未行动状态时使用。"; OncePerTurn = true; TypeSymbols.Add(SkillTypeSymbol.Action); Keyword = SkillKeyword.Null; OncePerTurn = true; }
public Sk1() : base() { Number = 1; Name = "睿智之泉"; Description = "『睿智之泉』【自】〖1回合1次〗[翻面1]出击费用2以下的我方单位出击时,你可以支付费用。如果支付,则抽1张卡。"; OncePerTurn = true; Optional = true; TypeSymbols.Add(SkillTypeSymbol.Auto); Keyword = SkillKeyword.Null; }
public Sk1() : base() { Number = 1; Name = "烈风"; Description = "『烈风』【起】〖1回合1次〗[翻面1]直到回合结束为止,这名单位获得『飞行特效』。(『飞行特效』【常】这名单位攻击<飞行>属性单位的期间,这名单位的战斗力+30。)"; OncePerTurn = true; TypeSymbols.Add(SkillTypeSymbol.Action); Keyword = SkillKeyword.Null; OncePerTurn = true; }
public Sk1() : base() { Number = 1; Name = "光之王子"; Description = "『光之王子』〖1回合1次〗【自】出击费用2以下的我方单位出击时,你可以选择1名敌方后卫区上的单位,将其移动。"; OncePerTurn = true; Optional = true; TypeSymbols.Add(SkillTypeSymbol.Auto); Keyword = SkillKeyword.Null; }
private void WriteName(ISymbol symbol, string text) { if (TypeSymbols != null && symbol is INamedTypeSymbol typeSymbol && TypeSymbols.Contains(typeSymbol)) { _writer.WriteLink( text, "#" + DocumentationUtility.CreateLocalLink(symbol, LocalLinkPrefix), symbol.ToDisplayString(TypeSymbolDisplayFormats.Name_ContainingTypes_TypeParameters)); }
public override void Read(Message message) { if (!Available) { DetachAll(); return; } if (!TypeSymbols.Contains(SkillTypeSymbol.Special) && !Owner.IsOnField) { DetachAll(); return; } if (Keyword == SkillKeyword.CCS && (!Owner.IsClassChanged)) { DetachAll(); return; } foreach (Card card in Game.AllCards) { if (CanTarget(card) && !Targets.Contains(card)) { ItemsToApply.Clear(); SetItemToApply(); CleanItemsToApply(); if (ItemsToApply.Count > 0) { Attach(card, ItemsToApply); } } else if (!CanTarget(card) && Targets.Contains(card)) { Detach(card); } else if (CanTarget(card) && Targets.Contains(card)) { ItemsToApply.Clear(); SetItemToApply(); CleanItemsToApply(); if (CheckItemUpdated(card)) { Detach(card); Attach(card, ItemsToApply); } } } }
/// <summary> /// 判断该能力是否可以发动 /// </summary> /// <returns>若可以发动,返回true</returns> public bool Check() { foreach (var card in Controller.AllCards) { foreach (var item in card.SubSkillList) { if (item is IUserForbidActionSkill) { if (((IUserForbidActionSkill)item).ForbiddenSkillName == Name) { return(false); } } } } if (!Available) { return(false); } if (UsedInThisTurn) { return(false); } if (!Owner.IsOnField) { if ( !(Controller.Bond.Contains(Owner) && Owner.FrontShown && TypeSymbols.Contains(SkillTypeSymbol.Bond)) && !(TypeSymbols.Contains(SkillTypeSymbol.Special)) ) { return(false); } } if (Keyword == SkillKeyword.CCS && (!Owner.IsClassChanged)) { return(false); } if (!CheckConditions()) { return(false); } Cost = DefineCost(); return(Cost.Check()); }
private static ISymbol?GetSymbolIfWhoseTypeIs( SemanticModel model, SyntaxToken token, string instanceType) { var span = token.Span; var symbol = model.LookupSymbols(span.Start, null, token.Text) .FirstOrDefault(); if (symbol is null) { return(null); } var typeSymbol = GetType(symbol); if (typeSymbol is null) { return(null); } var typeFullName = TypeSymbols.GetFullName(typeSymbol); return((instanceType != typeFullName) ? null : symbol); }
public override void Read(Message message) { if (!Available || UsedInThisTurn) { return; } if (!TypeSymbols.Contains(SkillTypeSymbol.Special) && !Owner.IsOnField) { return; } if (Keyword == SkillKeyword.CCS && (!Owner.IsClassChanged)) { return; } base.Read(message); var induction = CheckInduceConditions(message); if (induction != null) { induction.Message = message; induction.Skill = this; Induce(induction); } }
private static async Task <Solution> RemoveUsing( Document document, UsingStatementSyntax node, CancellationToken cancellationToken) { var solution = document.Project.Solution; var root = await document.GetSyntaxRootAsync(cancellationToken) .ConfigureAwait(false); if (root is null) { return(solution); } var model = await document.GetSemanticModelAsync(cancellationToken) .ConfigureAwait(false); if (model is null) { return(solution); } var declaration = node.Declaration; if (declaration is null) { return(solution); } var type = declaration.Type; var variables = declaration.Variables; var n = variables.Count; var k = 0; List <VariableDeclaratorSyntax> GetList(Func <string, bool> matches) { var syntaxList = new List <VariableDeclaratorSyntax>(n); for (; k < n; ++k) { var v = variables[k]; var initializer = v.Initializer; if (initializer is null) { continue; } var value = initializer.Value; var o = model.GetOperation(value, cancellationToken); if (o is null) { continue; } var valueType = o.Type; var name = TypeSymbols.GetFullName(valueType); if (matches(name)) { break; } syntaxList.Add(v); } return(syntaxList); } var list = new List <( List <VariableDeclaratorSyntax> InList, List <VariableDeclaratorSyntax> OutList)>(); do { var inList = GetList(s => !Analyzer.DisposesNothing(s)); var outList = GetList(s => Analyzer.DisposesNothing(s)); list.Add((inList, outList)); }while (k < n); VariableDeclarationSyntax ToDeclaration( IEnumerable <VariableDeclaratorSyntax> declarators) { return(SyntaxFactory.VariableDeclaration( type, SyntaxFactory.SeparatedList(declarators))); } var newNode = node.Statement; if (list[0].InList.Count > 0) { for (var count = list.Count - 1; count >= 0; --count) { var(inList, outList) = list[count]; var inStatement = SyntaxFactory.LocalDeclarationStatement( ToDeclaration(inList)); var outStatement = (outList.Count > 0) ? SyntaxFactory.UsingStatement( ToDeclaration(outList), null, newNode) : newNode; newNode = SyntaxFactory.Block(inStatement, outStatement) .WithAdditionalAnnotations(Formatter.Annotation); } } else { for (var count = list.Count - 1; count >= 0; --count) { var(inList, outList) = list[count]; var outStatement = (outList.Count > 0) ? SyntaxFactory.UsingStatement( ToDeclaration(outList), null, newNode) : newNode; newNode = ((inList.Count > 0) ? SyntaxFactory.Block( SyntaxFactory.LocalDeclarationStatement( ToDeclaration(inList)), outStatement) : outStatement) .WithAdditionalAnnotations(Formatter.Annotation); } } var targetNode = (newNode is BlockSyntax && node.Parent is BlockSyntax parent && parent.ChildNodes().Count() == 1) ? parent as SyntaxNode : node; var workspace = solution.Workspace; var formattedNode = Formatter.Format( newNode, Formatter.Annotation, workspace, workspace.Options) .WithTriviaFrom(targetNode); var newRoot = root.ReplaceNode(targetNode, formattedNode); return(solution.WithDocumentSyntaxRoot(document.Id, newRoot)); }
private static void AnalyzeModel( SemanticModelAnalysisContext context) { var cancellationToken = context.CancellationToken; var model = context.SemanticModel; var root = model.SyntaxTree .GetCompilationUnitRoot(cancellationToken); var all = root.DescendantNodes() .OfType <UsingStatementSyntax>(); if (!all.Any()) { return; } IEnumerable <ISymbol> ToSymbols( VariableDeclaratorSyntax v, Func <string, bool> matches) { if (!(model.GetOperation(v, cancellationToken) is IVariableDeclaratorOperation declaratorOperation)) { return(EmptySymbol); } var initialzer = v.Initializer; if (initialzer is null) { return(EmptySymbol); } var value = initialzer.Value; var operation = model.GetOperation(value, cancellationToken); if (operation is null || !matches(TypeSymbols.GetFullName(operation.Type))) { return(EmptySymbol); } return(Create(declaratorOperation.Symbol)); } foreach (var @using in all) { var declaration = @using.Declaration; if (declaration is null) { continue; } var first = declaration.Variables .SelectMany(v => ToSymbols(v, DisposesNothing)) .FirstOrDefault(); if (first is null) { continue; } var location = @using.GetLocation(); var diagnostic = Diagnostic.Create( Rule, location, first.Name); context.ReportDiagnostic(diagnostic); } }