本文整理汇总了C#中Spellbook.GetSpell方法的典型用法代码示例。如果您正苦于以下问题:C# Spellbook.GetSpell方法的具体用法?C# Spellbook.GetSpell怎么用?C# Spellbook.GetSpell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spellbook
的用法示例。
在下文中一共展示了Spellbook.GetSpell方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Game_OnCastSpell
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args)
{
if (!spellbook.Owner.IsMe)
return;
var sData = spellbook.GetSpell(args.Slot);
string name;
if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name))
{
//Evade.isChanneling = true;
//Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D;
lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100;
}
if (EvadeSpell.lastSpellEvadeCommand != null &&
EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount)
{
args.Process = false;
}
lastSpellCast = args.Slot;
lastSpellCastTime = EvadeUtils.TickCount;
//moved from processPacket
/*if (args.Slot == SpellSlot.Recall)
{
lastStopPosition = myHero.ServerPosition.To2D();
}*/
if (Situation.ShouldDodge())
{
if (isDodging && SpellDetector.spells.Count() > 0)
{
foreach (KeyValuePair<String, SpellData> entry in SpellDetector.windupSpells)
{
SpellData spellData = entry.Value;
if (spellData.spellKey == args.Slot) //check if it's a spell that we should block
{
args.Process = false;
return;
}
}
}
}
foreach (var evadeSpell in EvadeSpell.evadeSpells)
{
if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot)
{
if (evadeSpell.evadeType == EvadeType.Blink
|| evadeSpell.evadeType == EvadeType.Dash)
{
//Block spell cast if flashing/blinking into spells
if (args.EndPosition.To2D().CheckDangerousPos(6, true)) //for blink + dash
{
args.Process = false;
return;
}
if (evadeSpell.evadeType == EvadeType.Dash)
{
var extraDelayBuffer =
ObjectCache.menuCache.cache["ExtraPingBuffer"].Cast<Slider>().CurrentValue;
var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].Cast<Slider>().CurrentValue;
var dashPos = Game.CursorPos.To2D(); //real pos?
if (evadeSpell.fixedRange)
{
var dir = (dashPos - myHero.ServerPosition.To2D()).Normalized();
dashPos = myHero.ServerPosition.To2D() + dir*evadeSpell.range;
}
//Draw.RenderObjects.Add(new Draw.RenderPosition(dashPos, 1000));
var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed,
extraDelayBuffer + ObjectCache.gamePing, extraDist);
if (posInfo.posDangerLevel > 0)
{
args.Process = false;
return;
}
}
lastPosInfo = PositionInfo.SetAllUndodgeable(); //really?
if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500)
{
EvadeCommand.MoveTo(Game.CursorPos.To2D()); //block moveto
lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100;
}
}
return;
}
}
}
示例2: Spellbook_OnCastSpell
private static void Spellbook_OnCastSpell(Spellbook sender, SpellbookCastSpellEventArgs args)
{
if (sender == null || !sender.HasSpellCaster || !sender.Owner.IsMe)
{
return;
}
var target = args.Target as Obj_AI_Base;
var castTime = sender.GetSpell(args.Slot).SData.CastFrame / 30f * 1000f + Game.Ping / 2f;
// target offscreen
if (target != null)
{
if (!target.IsHPBarRendered) {}
//StartPathWorld(target.ServerPosition);
}
//StartPathWorld(args.StartPosition);
}
示例3: Game_OnCastSpell
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args)
{
if (!spellbook.Owner.IsMe)
return;
var sData = spellbook.GetSpell(args.Slot);
string name;
if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name))
{
//Evade.isChanneling = true;
//Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D;
lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100;
}
if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount)
{
args.Process = false;
}
lastSpellCast = args.Slot;
lastSpellCastTime = EvadeUtils.TickCount;
//moved from processPacket
if (Situation.ShouldDodge())
{
if (isDodging && SpellDetector.spells.Count() > 0)
{
foreach (KeyValuePair<String, SpellData> entry in SpellDetector.windupSpells)
{
SpellData spellData = entry.Value;
if (spellData.spellKey == args.Slot) //check if it's a spell that we should block
{
args.Process = false;
return;
}
}
}
}
foreach (var evadeSpell in EvadeSpell.evadeSpells)
{
if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot)
{
lastPosInfo = PositionInfo.SetAllUndodgeable();
if (evadeSpell.evadeType == EvadeType.Blink
|| evadeSpell.evadeType == EvadeType.Dash)
{
if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500)
{
EvadeCommand.MoveTo(Game.CursorPos.To2D());
lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100;
}
}
return;
}
}
}
示例4: IsWard
private bool IsWard(Spellbook spellBook, SpellbookCastSpellEventArgs args)
{
return
SAssemblies.Ward.WardItems.Exists(
y =>
y.Id ==
(int)
ObjectManager.Player.InventoryItems.Find(
x => x.SpellSlot == spellBook.GetSpell(args.Slot).Slot).Id);
}
示例5: Game_OnCastSpell
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args)
{
if (!spellbook.Owner.IsMe)
return;
var sData = spellbook.GetSpell(args.Slot);
string name;
if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name))
{
lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100;
}
//block spell commmands if evade spell just used
if (EvadeSpell.lastSpellEvadeCommand != null &&
EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount)
{
args.Process = false;
}
lastSpellCast = args.Slot;
lastSpellCastTime = EvadeUtils.TickCount;
if (Situation.ShouldDodge())
{
if (isDodging && SpellDetector.spells.Any())
{
foreach (KeyValuePair<String, SpellData> entry in SpellDetector.windupSpells)
{
SpellData spellData = entry.Value;
if (spellData.spellKey == args.Slot) //check if it's a spell that we should block
{
args.Process = false;
return;
}
}
}
}
foreach (var evadeSpell in EvadeSpell.evadeSpells)
{
if (evadeSpell.isItem == false &&
evadeSpell.spellKey == args.Slot && evadeSpell.untargetable == false)
{
if (evadeSpell.evadeType == EvadeType.Blink)
{
var dir = (args.StartPosition.LSTo2D() - myHero.ServerPosition.LSTo2D()).LSNormalized();
var end = myHero.ServerPosition.LSTo2D() + dir * myHero.ServerPosition.LSTo2D().LSDistance(Game.CursorPos.LSTo2D());
if (evadeSpell.fixedRange || end.LSDistance(myHero.ServerPosition.LSTo2D()) > evadeSpell.range)
{
end = myHero.ServerPosition.LSTo2D() + dir * evadeSpell.range;
}
var posInfo = EvadeHelper.CanHeroWalkToPos(end, evadeSpell.speed, ObjectCache.gamePing, 0);
if (posInfo.posDangerCount > 0)
{
args.Process = false;
}
else
{
lastPosInfo.position = end;
lastDodgingEndTime = EvadeUtils.TickCount;
if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500)
{
EvadeCommand.MoveTo(Game.CursorPos.LSTo2D()); //block moveto
lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100;
}
return;
}
}
if (evadeSpell.evadeType == EvadeType.Dash)
{
var dashPos = args.StartPosition.LSTo2D();
if (args.Target != null)
{
dashPos = args.Target.Position.LSTo2D();
}
if (evadeSpell.fixedRange || dashPos.LSDistance(myHero.ServerPosition.LSTo2D()) > evadeSpell.range)
{
var dir = (dashPos - myHero.ServerPosition.LSTo2D()).LSNormalized();
dashPos = myHero.ServerPosition.LSTo2D() + dir * evadeSpell.range;
}
var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, ObjectCache.gamePing, 0);
if (posInfo.posDangerLevel > 0)
{
args.Process = false;
}
else
{
lastPosInfo.position = dashPos;
lastDodgingEndTime = EvadeUtils.TickCount;
//.........这里部分代码省略.........
示例6: load
private void load()
{
sBook = _player.Spellbook;
qData = sBook.GetSpell(SpellSlot.Q);
wData = sBook.GetSpell(SpellSlot.W);
eData = sBook.GetSpell(SpellSlot.E);
rData = sBook.GetSpell(SpellSlot.R);
}