♯ C# EVOCATION DIFFICULTY: Apprentice Creational

The Prototype Clone

Perfect cellular duplication of existing magical entities.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Biomancy // Cellular Duplication
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CSHARP PATTERN //
using System;

namespace EnterpriseEvocation
{
    public interface ICloneableFamiliar
    {
        ICloneableFamiliar Clone();
    }

    public class RavenFamiliar : ICloneableFamiliar
    {
        public string Name { get; set; }
        public int Feathers { get; set; }

        public RavenFamiliar(string name, int feathers)
        {
            Name = name;
            Feathers = feathers;
        }

        public ICloneableFamiliar Clone()
        {
            return new RavenFamiliar(Name, Feathers);
        }

        public void Speak() => Console.WriteLine($"Nevermore, says {Name} with {Feathers} feathers.");
    }
}

When manifesting a new entity is too costly in raw vis, the Prototype pattern offers a cheaper alternative: cloning an existing entity perfectly. Biomancers often employ this to duplicate familiars without performing the initial summoning rite again.

Runic Tags: #creational #prototype #cloning #csharp