Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Objective-Potter
HWWand *wand = [[HWWand alloc] init];
HWMagic *magic = [HWSpell genericSpell];
[wand setMagic:(__bridge HWSpell *)magic];
@jab2109
Copy link

jab2109 commented Jan 25, 2013

UIWaveGestureRecognizer *waveRecognizer = 
    [[UIWaveGestureRecognizer alloc] initWithTarget:wizardWorld action:@selector:(vanquishEvil)];
[wand addGestureRecognizer:waveRecognizer];

@cnstoll
Copy link

cnstoll commented Jan 25, 2013

HWWandSpell *harrySpell = [HWWandSpell expelliarmus];
HWWandSpell *voldemortSpell = [HWWandSpell avadaKedavra];

HWSpellComparisonResult spellResult = [harrySpell evaluateSpellVersusSpell:voldemortSpell withSpellComparator:(^HWSpellComparator)(id spell1, id spell2) ^{
if ([spell1.wizard.wand == nil])
    return HWSpellResultLose;
if ([spell1.wizard isKindOfClass:[[HWCreature houseElf] class]])
    return HWSpellResultWin;
if ([spell1.wizard containsSoulFragmentOfWizard:spell2.wizard]) 
    return HWSpellResultWin;
if ([spell2.wizard.power > spell1.wizard.power])
    return HWSpellResultLose;

return HWSpellResultDraw;
}];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment